foscil

foscil --  A basic frequency modulated oscillator.

Description

A basic frequency modulated oscillator.

Syntax

ar foscil xamp, kcps, xcar, xmod, kndx, ifn [, iphs]

Initialization

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.

Performance

xamp -- the amplitude of the output signal.

kcps -- the frequency of the output signal measured in cycles per second.

xcar -- the carrier frequency.

xmod -- 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.

Examples

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 */
/* Written by Kevin Conder */
; 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 */
/* Written by Kevin Conder */
; Table #1, a sine wave.
f 1 0 16384 10 1

; Play Instrument #1 for 2 seconds.
i 1 0 2
e
/* foscil.sco */