line2sine manual

Contents: [ Basics | Time | Frequency | Amplitude | Envelope | Tips ]


The line2sine program reads lines from a Diagram document and converts these lines to sinusoids. the Diagram program can be found at CCRMA in /LocalApps/ .

Interpretation of dimensions

Program options

The program prompts you for several settings which are explained in the sections below.
  1. duration of the output soundfile in seconds
  2. to interpret y-axis as being interval or harmonic space
  3. minimum frequency which will be the lower limit of the window
  4. maximum frequency which will be the upper limit of the window
  5. global amplitude scaling
  6. default amplitude envelope
  7. print out oscillator parameters or not


Lines can be drawn in any direction and will be sorted so that they always increase in time.

Currently, if a line changes time direction, all of the vertices of the line will be resorted so that they increase in time. It may be nice to change this property to the case where a time reversal in the line will create a new oscillator track. Anyway, here is what happens to a single line which changes time direction:
Line drawn as: time-mixed line Will be interpreted as: time-sorted line
Note that the time-sorted line will not be drawn or visible in the Diagram window. Also note that you can create two lines which join at their ends which looks like the left diagram window above. In that case, there is no problem since there are no time reversals on either line, since they both only have two vertices each.

Increasing the width of the Diagram document

To increase the width of the Diagram document by a certain number of pages, select Format/Page Layout (command-P) from the Diagram menu to get the following window:
[page layout window]
In the layout window above, the width of the Diagram document is set to 4 pages across.


There are two types of frequency space available for use with the line2sine program: interval space and harmonic space.

In harmonic space, equal distances in linear space are mapped directly to frequency space. For example, any pair of lines in the Diagram document which are 1 centimeter apart will always have the same frequency separation no matter where along the y-axis direction they are placed. This means that equally spaced lines with respect to 0 Hertz will be equivalent to harmonics of a fundamental. You are not allowed to use negative frequencies but are allow to alias as much as you like. The sampling rate is hardwired to 44100 Hz.

In interval space, equal distances in linear space are mapped into equal size intervals. For example, any pair of lines in the Diagram document which are 1 centimeter apart will always have the same musical interval relation no matter where along the y-axis direction they are placed. When using Interval space, you cannot use frequencies below 20 Hz.

Separate frequency tracks

You can have several frequency tracks which run in parallel by adding more tiling page rows to the Diagram document. Each page row has the same frequency range as the first row. These rows allow for editing simultaneous independent textures with greater ease, and eventually can be used for different instruments. To increase the number of page rows in the Diagram document, go to the Format/Page Layout window (command-P) and increase the number of pages down. You can use command-Y to hide/show the horizontal page breaks which will be the borders between tracks.


The total amplitude at any given time cannot exceed 1.0; otherwise, clipping will occur in the output soundfile. There are several ways to control the loudness of the sound.

Global amplitude control

The line2sine program prompts for a global amplitude. This amplitude scales the amplitude of all sound in the output soundfile. Values greater than 1.0 will make the sound louder; values less than 1.0 will make the sound quieter.

The line2sine program also prompts for a default amplitude envelope. This envelope will be applied to all lines which do not have their own local amplitude envelope. See the envelope section below for how to make an envelope.

Local amplitude control

The thickness of a line controls the relative loudness of that line to other lines in the Diagram window. to change the thickness of a line, click the i button on the toolbar at the top of the Diagram window. Then select a line to change the amplitude of, and select the style button. This will open up the style inspector as shown below:

style inspector window

The amplitude units are specified in units of centimeters. You may be using other measurement units according to If you would like to change to centimeters in the thickness window, then open /NextApps/ (usually second icon in your dock), then click on the flag icon and set measurement units to centimeters. You will probably have to restart in order for the change to take place. The default thickness of a line is 0.035 cm.

The global amplitude envelope for lines can be overridden by attaching a local amplitude envelope to a line. double-click on a line to create a label:

label highlighted label changed to amplitude envleope
Note that you can hide the local amplitude envelope by setting its width to 0.


Envelopes for this program are pairs of numbers separated by semi-colons and enclosed in parentheses. Each pair of numbers represents a time, value pairing. The value in this case can represent either amplitude or frequency. The frequency envelopes for the line2sine program are generated automatically, so you can only change the amplitude envelopes. Here is an example triangular window:
     (0 0; 1 1; 2 0)
The duration of the above envelope is relative, and the envelope will be stretched to fit the whole duration of a line. You can also place a sustain point in a line by using the s command, for example:
     (0 0; 1000 1; s; 2000 0)
This amplitude envelope will ramp up to a value of 1 over a span of 1000 samples. If the length of the line is more than 2000 samples, then that value of 1 will be held (hence "S"ustain point) until 1000 samples before the end of the line, where the amplitude value will decrease from 1 to 0. Currently the envelope is ill-behaved(?) when the time is less than 2000 samples. For example if the line lasts for 1000 samples, then the amplitude envelope will go from 0 to 1.

There are several types of interpolation available:

You can control the interpolation on two levels, the first being the default interpolation for the entire envelope, for example the envelope below will be geometrically interpolated:

     g(0 0.0001; 1 1; 2 0.0001)
The default interpolation is L. Currently there is a bug such that you cannot set the default interpolation type for local amplitude envelopes.

The local interpolation between points can be controlled by placing the interpolation letter after the first pair to be interpolated:

     (0 0; 5 0.1 g; 50 1; 100 0)
This envelope is interpolated linearly, except between time points 5 and 50 where geometric interpolation is used.

Also, you can optionally use commas in time-value pairs:

     (0, 0; 1, 1; 2, 0)

Note there is a bug in the envelope string which will be fixed eventually: you must place a zero before the decimal point for numbers less than 1.


Coarse/Fine movement

Making harmonics

Making a musical "staff"

How to rotate and scale lines

Page Layout

The width of the Diagram document area must be exactly 10.5" (26.67 cm), and the height must be 8" (20.32 cm). This is the default for Diagram when using Letter size (8.5"x11") with 0.25" margins (in landscape orientation). If you are using another type of paper (e.g., printing in Europe), then just make sure that the dimensions of the paper minus the margins give the document dimensions of (26.67cm x 20.32cm). The paper size and margins are stored in binary format, and I don't want to reverse engineer to get them.