SHEPARD
SHEPARD - A Shepard tone generator
Usage:
SHEPARD SR L F1 F2 A T Q
Inputs:
- SR
- The sampling rate in Hz
- L
- The length of the output buffer (number of samples / evaluation cycle).
- F1
- The start frequency in Hz.
- F2
- The end frequency in Hz.
- A
- The maximum component magnitude (linear).
- T
- The frequency change rate (seconds / interval step).
- Q
- The interval stepping factor.
Outputs:
- Y
- A number (L=1) or vector (L>1) samples of synthesized Shepard tone.
Function:
The SHEPARD
atom implements a method for synthesizing rising and falling Shepard tones. The factor Q defines the interval ratio between two components (def.=2) and the value of T is the duration used for one interval step (in seconds, def.=1). If F1 is lower than F2, a tone with raising frequencies is generated, otherwise the frequencies are falling. The number of components n
is computed to satisfy the conditions for fn
. In one time interval T, the frequency of a component i
is changed continuously from fi
to fi
.Q (rising) or fi
/Q (falling). After each interval one component leaves the frequency range (and is removed) while a component with starting frequency F1 is added to the tone.
with:
fmin = min(F1,F2), fmax = max(F1, F2)