Create Sound as Shepard tone...

One of the commands that create a Sound.

### Settings

Name
the name of the resulting Sound object.
Minimum time (s) and Maximum time (s)
the start and end time of the resulting Sound.
Sampling frequency (Hz)
the sampling frequency of the resulting Sound.
Lowest frequency (Hz)
the frequency of the lowest component in the tone complex.
Number of components
the number of frequency components in the tone complex.
Frequency change (semitones/s)
determines how many semitones the frequency of each component will change in one second. The number of seconds needed to change one octave will then be 12 divided by Frequency change. You can make rising, falling and monotonous tone complexes by chosing a positive, negative or zero value.
Amplitude range (dB)
determines the relative size in decibels of the maximum and the minimum amplitude of the components in a tone complex. These relative amplitudes will then be 10amplitudeRange/20.
Octave shift fraction (0-1)
shifts all frequency components by this fraction at the start. You will probably only need this if you want to generate static tone complexes as the example script below shows.

### Purpose

To create a Sound that is a continuous variant of the sound sequences used by Shepard (1964) in his experiment about the circularity in judgments of relative pitch.

The tone consists of many sinusoidal components whose frequencies might increase exponentially in time. All frequencies are always at successive intervals of an octave and sounded simultaneously. Thus the frequency of each component above the lowest is at each moment in time exactly twice the frequency of the one just below. The amplitudes are large for the components of intermediate frequency only, and tapered off gradually to subthreshold levels for the components at the highest and lowest extremes of frequency.

For a rising tone complex, the Sound is generated according to the following specification:

 s(t) = ∑i=1..numberOfComponents Ai(t) sin (argi(t)), where
 argi(t) = ∫ 2π fi(τ) dτ , and
 fi(t) = lowestFrequency · 2(i – 1 + octaveShiftFraction + t/(12/frequencyChange_st), with
 Ai(t) = 10((Lmin + (Lmax – Lmin) (1 – cos 2πθi(t)) / 2) / 20), where,
 Lmax = 0, Lmin = 10–amplitudeRange/20, and,
 θi(t) = 2π log2 (f(t) / lowestFrequency) / numberOfComponents.

The maximum frequency that can be reached during a sweep by any single tone is:

 maximumFrequency = lowestFrequency·2numberOfComponents.

A component that reaches the maximum frequency falls instantaneously to the lowest frequency and then starts rising again.

The absolute sound pressure level of the resulting sound will not be set, it is only guaranteed that the peak value is just below 1. You can always scale the intensity with the Scale Intensity... command.

### Example

The following script generates 12 static Shepard tone complexes, 1 semitone 'apart', with a cosine window to temper the abrupt start and finish.

``` fadeTime = 0.010``` ``` for i to 12``` ```    fraction = (i-1)/12``` ```    Create Sound as Shepard tone: "s" + string\$ (i), 0, 0.1, 22050, 4.863, 10, 0, 34, fraction``` ```    Fade in: 0, 0, fadeTime, "no"``` ```    Fade out: 0, 0.1, -fadeTime, "no"``` ``` endfor```