foscil
A basic frequency modulated oscillator.
Syntax
Initialization
ifn (optional) -- function table number. Requires a wrap-around guard point. Defaults to a sine wave.
iphs (optional, default=0) -- initial phase of waveform in table ifn, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is 0.
Performance
xamp -- the amplitude of the output signal.
kcps -- a common denominator, in cycles per second, for the carrier and modulating frequencies.
xcar -- a factor that, when multiplied by the kcps parameter, gives the carrier frequency.
xmod -- a factor that, when multiplied by the kcps parameter, gives the modulating frequency.
kndx -- the modulation index.
foscil is a composite unit that effectively banks two oscil opcodes in the familiar Chowning FM setup, wherein the audio-rate output of one generator is used to modulate the frequency input of another (the “carrier”). Effective carrier frequency = kcps * xcar, and modulating frequency = kcps * xmod. For integral values of xcar and xmod, the perceived fundamental will be the minimum positive value of kcps * (xcar - n * xmod), n = 0,1,2,... The input kndx is the index of modulation (usually time-varying and ranging 0 to 4 or so) which determines the spread of acoustic energy over the partial positions given by n = 0,1,2,.., etc. ifn should point to a stored sine wave. Previous to version 3.50, xcar and xmod could be k-rate only.
The actual formula used for this implementation of FM synthesis is xamp * cos(2π * t * kcps * xcar + kndx * sin(2π * t * kcps * xmod) - π), assuming that the table is a sine wave.
Examples
Here is an example of the foscil opcode. It uses the file foscil.csd.
See Also
More information about frequency modulation on Wikipedia: http://en.wikipedia.org/wiki/Frequency_modulation_synthesis