turn transforms an initial link into a final one.
Example:
* turn
name: t2
first link name: l1
3 elem; 60 samples
position? 1
last link name: l2
4 elem; 100 samples
position? 1
rotate? n
play last link? y
Amplitude range 1000 to 4000
use default values ? y
Linkstates = 41, linksum 3280
turnsum? 44100
statements= 10
Wavy ? y
Explanation:
* turn
name: t2 # name of turn (identifier)
first link name: l1 # initial link
3 elem; 60 samples # duration of link in samples
position? 1 # which element should the
# initial link start with?
last link name: l2 # final link
4 elem; 100 samples # duration of link in samples
position? 1 # which element should the final
# link start with?
rotate? n # if 'no' then
# (e1 e2 e3) (e1 e2 e3) (etc)
# else
# (e1 e2 e3) (e2 e3 e1) (e3 e1 e2) (etc)
play last link? y #
Amplitude range 1000 to 4000
use default values ? y #
Linkstates = 41, linksum 3280 #
turnsum? 44100 # duration of turn in samples
statements= 10 # how many times should it be played?
Wavy ? y # if Wavy is 'y', then:
# l1 -> l2 -> l1 -> l2 (etc.)
# if Wavy is 'n', then:
# l1 -> l2 l1 -> l2 (etc.)
The algorithm turn is a solution to the problem: how to maintain a constant rate of change of pitch during a transformation?
This problem is a result of a premise of SAWDUST, and applies to both vary and turn: An inital link is linearly transformed into a final link.
For example, if there are two links, with a sum of 100 samples and 50 samples, and a transformation is made from the first to the second, the resulting sound would go up in pitch by one octave. (The first link would create a frequency of 441 Hz, and the second 882 Hz, at a sampling rate of 44100.)
However, the resulting in a sound would appear to be ascending at a faster and faster rate.
The opposite is true when moving from the second to the first link: as the pitch went down, it would appear to be getting slower and slower.
Brün invented a remarkable solution for this problem, that remained consistent with the linear change premises of SAWDUST.
In a turn, linkIn is transformed into linkOut.
Both linkIn and linkOut have constituent elements (but not necessarily the same number of elements). Each element has an amplitude (0-4096) and a duration (in samples).
The duration of each element in linkIn is transformed (step-wise, by integers) into the duration of the corresponding element in linkOut.
The amplitude of each element in linkIn follows the path of a triangle wave, as it is transformed into the corresponding element's amplitude in linkOut.
Thus, the transformations of the durations and the amplitudes are mutually independent.
If linkIn and linkOut do not have the same number of elements,
SAWDUST will add
``empty''elements to the smaller of the two,
where
is the difference between the number of elements in linkIn
and linkOut. (An ``empty'' element has zero amplitude and zero
duration.)
In a turn, each elements' amplitude in linkIn follows the path of a triangle wave, as it is transformed into its corresponding elements' amplitude in linkOut.
The amplitudes' paths are determined by the following:
if ( amp >= midpoint ) then
1. amp descends until it reaches minimum.
2. ascends until it reaches maximum.
3. descends to its destination value
else if ( amp < midpoint ) then
1. amp ascends until it reaches maximum.
2. descends until it reaches minimum.
3. ascends to its destination value.
midpoint is equal to 4096/2. By default,
and
are set to the smallest and largest amplitudes in linkIn and
linkOut.
If amp >= midpoint, the amplitude increment is:
if amp < midpoint, the amplitude increment is:
In both cases,
is the duration of the turn in samples.
Here is a plot of the amplitude paths for three elements, where linkIn has amplitudes 100, 4000, 2000, and linkOut has amplitudes 4000, 100, 3200.
In the above plot, the element that starts with an amplitude of 2000, rises to its maximum (4096), then descends to its minimum (0), and then rises to its final value (3200).
In contrast the element whose initial value is 4000, first descends to its minimum value (0), then rises to its maximum (4096), and then descends to its final value (100).
The transformation of durations in a turn follows a step-wise, integer path, from the inital to the final link. However, each state in the transformation is repeated, with the shorter states (the higher pitched ones) repeated more often than the longer states (the lower pitched ones).
The following function (written by Elizabeth Mitro) determines the number of steps in the transformation between the initial and the final link:
where
is thus the sum of the difference in durations of the
inital and final elements: it is the minimum number of steps necessary
for the transformation.
is the sum of durations of the
: it is the minimum
duration necessary for the transformation.
Once the
in the transformation is known, the
duration of each step in the transformation can be determined:
where
Once the
is known, the number of
repetitions of the link at that step is calculated:
The above calculation ensures that the smaller the link, the greater the number of repetitions.
Thus, in a transformation from a high-pitched to a low-pitched link, the high-pitched links will be repeated more times than the low-pitched links, resulting in an ``even'' descent.
To define a turn, you must input
name asks for an identifier for this turn.
first link name asks for the name of the link to be assgned as linkIn.
last link name asks for the name of the link to be assgned as linkOut.
rotate? and position? need each other.
If rotate? is answered ``y'', then at every state of the transformation, the sequence of elements will cycle.
For example, if there are three elements:
were every group of three above is a state of the transformation.
The number given in response to position? determines the starting element for the first state in the rotation, and the starting element for the final state in the rotation.
In effect, rotate increases the period length of the transformation by the number of elements in the transformation. So, if there are three elements in the transformation, the period of a rotated transformation will be three times the length of a non-rotated transformation.
By default, turn uses the greatest and smallest amplitudes in the first and last links for the minimum and maximum values to which all the amplitudes will grow and shrink.
If you wish, you can override these default values, and enter other values.
turnsum? asks for the duration of the turn in samples.
At a sampling rate of 44100 samples per second, if you wanted a turn to last for 10 seconds, you would type in 441000.
``Statements'' is the number of times the turn will be played.
If ``statements'' is greater than 1, then the question ``Wavy?'' will be asked.
A ``wavy'' turn alternates transformations between linkIn to linkOut, and linkOut to linkIn:
The first statement makes a transformation from linkIn to linkOut, the second statement makes a transformation from linkOut to linkIn, the third statement is the same as the first, the fourth is the same as the second, etc.
A non-``wavy'' turn has all the statements the same: the transformations are only from linkIn to linkOut.