METAFLUTE
METAFLUTE is another physical modelling instrument (see
CLAR), designed to simulate a flute performance. METAFLUTE has several variants: a simple flute model (SFLUTE), a model with pitch-bending (BSFLUTE), and a model with envelope-defined vibrato curves (VSFLUTE). LSFLUTE does the same thing as SFLUTE, but
without reinitializing the internal buffers, allowing you to get legato and
slurred-note effects -- just like a REAL flute!
Syntax:
for everybody:
makegen(1, 24, 1000, t0, a0, t1, a1...) /* amplitude of the noise (breath pressure) injected into the wind model in time/amplitude pairs */
makegen(2, 24, 1000, t0, a0, t1, a1...) /* amplitude of the overall output note */
for SFLUTE():
SFLUTE(outskip, duration, noiseamp, length1, length2, amp, spread, deleteflag)
for BSFLUTE():
makegen(3, 7, 1000, a0, g0, a1, g1...aN) /* pitch curve for length one, where aN and aN+1 are amplitudes and gN is the number of points in the curve to interpolate between them (the sum of the g values cannot exceed the number allocated in p2, in this case 1000) */
makegen(4, 7, 1000, a0, g0, a1, g1...aN) /* pitch curve for length two */
BSFLUTE(outskip, duration, noisamp, length1low, length1high, length2low, length2high, amp, spread, deleteflag)
for VSFLUTE():
makegen(3, 10, 1000, p0, p1...) /* vibrato function for length one, defining a waveform with partial amplitudes pN */
makegen(4, 10, 1000, p0, p1...) /* vibrato function for length two, defining a waveform with partial amplitudes pN */
VSFLUTE(outskip, duration, noisamp, length1low, length1high, length2low, length2high, amp, vibrato1low, vibrato1high, vibrato2low, vibrato2high, spread, deleteflag)
for LSFLUTE():
LSFLUTE(outskip, duration, noiseamp, length1, length2, amp, spread)
One comment about the last optional p-field for SFLUTE, BSFLUTE, and VSFLUTE (the
"deleteflag"): Generally you can safely let this default to "0". However, the METAFLUTE instrument
allocates memory for some of the delay lines it uses, and if you generate huge numbers of notes
from an interactive application you can cause a serious memory drain on the poor computer.
Setting this optional p-field to "1" will tell METAFLUTE to free this memory after every note, and
will allow you to create billions and billions of notes. A setting of "1" will
not allow you to use the LSFLUTE legato-flute following
that particular note, though... because the sound buffer memory is freed,
LSFLUTE will not have any sound to work with.
Now the scores in comment form:
/* SFLUTE -- Perry Cook's flute physical model
*
* p0 = start
* p1 = dur
* p2 = noise amp
* p3 = length1
* p4 = length2
* p5 = amp multiplier
* p6 = stereo spread (0-1)
* function slot 1 is the noise amp envelope
* function slot 2 is the output amp envelope
*
*/
An example score for SFLUTE():
rtsetparams(44100, 2)
load("METAFLUTE")
reset(2000)
makegen(1, 24, 1000, 0,1, 1.5,1)
makegen(2, 24, 1000, 0,0, 0.05,1, 1.49,1, 1.5,0)
SFLUTE(0, 1.5, 0.1, 20, 14, 10000)
SFLUTE(1.5, 1.5, 0.1, 20, 11, 10000)
Another score, for BSFLUTE():
rtsetparams(44100, 2)
load("METAFLUTE")
makegen(1, 7, 1000, 1, 1000, 1)
makegen(2, 7, 1000, 1, 1000, 1)
makegen(3, 7, 1000, 0, 500, 1, 500, 0)
makegen(4, 7, 1000, 0, 1000, 1)
BSFLUTE(0, 1.5, 0.1, 20,25, 14,19, 10000)
a third score, for VSFLUTE():
rtsetparams(44100, 2)
load("METAFLUTE")
makegen(1, 7, 1000, 1, 1000, 1)
makegen(2, 7, 1000, 1, 1000, 1)
makegen(3, 10, 1000, 1)
makegen(4, 10, 1000, 1)
VSFLUTE(0, 3.5, 0.1, 30,31, 15,19, 7000, 1.0,4.0, 1.0,5.0)
VSFLUTE(4, 3.5, 0.1, 24,25, 15,21, 7000, 4.0,7.0, 3.0,5.0)