ifn -- function table number. Requires a wrap-around guard point.
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.
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 = 1,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.
Here is an example of the foscil opcode. It uses the files foscil.orc and foscil.sco.
Example 1. Example of the foscil opcode.
/* foscil.orc */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
; Instrument #1 - a basic FM waveform.
instr 1
kamp = 10000
kcps = 440
kcar = 600
kmod = 210
kndx = 2
ifn = 1
a1 foscil kamp, kcps, kcar, kmod, kndx, ifn
out a1
endin
/* foscil.orc */
/* foscil.sco */
; Table #1, a sine wave.
f 1 0 16384 10 1
; Play Instrument #1 for 2 seconds.
i 1 0 2
e
/* foscil.sco */