The latest saolc has a core opcode called 'grain' implemented
which is not yet in the spec. I'm going to propose this
as a replacement for 'fof' in the next draft, since 'fof'
is only a special case of 'grain'.
Here is some documentation for 'grain'.
aopcode grain(table wave, table env, ksig density, ksig freq, ksig amp,
ksig dur, ksig time, ksig rand_ph)
wave is the waveshape for the grain.
env is the envelope for the grain.
density is the time-spacing of the grain trigger points in Hz.
freq is the frequency at which to place grains.
amp is the amplitude of grains.
dur is the duration of grains.
time is the offset from the trigger at which grains start (jitter).
rand_ph is a flag; if set, the grains start with random phase, otherwise
all grains are zero-phase.
To synth from this:
Every 1/density seconds, a countdown timer is begun with duration time,
if time < 1/density. When this timer expires, a new grain is
dispatched, at the current values of freq, amp, and dur. (So
if time=constant, grains are evenly spaced at density grains/second,
but if time is a noise signal, there is jitter but still the same
average density). A list of all active grains is maintained.
For each active grain, it is modulated according to 'freq' as follows:
- if the waveshape table has srate and basefreq parameters set (it's a
pitched sample), it's pitch-matched to 'freq' in the manner of loscil().
- if the waveshape table has srate but no base (it's an unpitched
sample), it's sr-matched to the orch in the manner of doscil() and
'freq' is ignored.
- if the waveshape table has neither srate nor base set (it's a
waveshape), it's oscillated at 'freq' cps in the manner of oscil().
The output value from each grain is the waveshape modulated in that
manner, multiplied by the envelope table stretched to be 'dur'
seconds long, multiplied by 'amp'. If 'freq', 'dur' and 'amp'
are modified during a grain's lifetime, the grain is not affected;
the grain uses only the parameters from when it was dispatched.
Once a grain has been alive for 'dur' seconds, it goes away.
The output value from the opcode is the sum of the output
values for all grains.
Best to all,
-- +-----------------+ | Eric Scheirer |A-7b5 D7b9|G-7 C7|Cb C-7b5 F7#9|Bb |B-7 E7| |firstname.lastname@example.org| < http://sound.media.mit.edu/~eds > | 617 253 0112 |A A/G# F#-7 F#-/E|Eb-7b5 D7b5|Db|C7b5 B7b5|Bb| +-----------------+
This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 11:46:32 EST