fof
Prev | Orchestra Opcodes and Operators | Next

## fof

fof — Produces sinusoid bursts useful for formant and granular synthesis.

## Description

Audio output is a succession of sinusoid bursts initiated at frequency xfund with a spectral peak at xform. For xfund above 25 Hz these bursts produce a speech-like formant with spectral characteristics determined by the k-input parameters. For lower fundamentals this generator provides a special form of granular synthesis.

## Syntax

    ares fof xamp, xfund, xform, koct, kband, kris, kdur, kdec, iolaps, \
          ifna, ifnb, itotdur [, iphs] [, ifmode] [, iskip]

## Initialization

iolaps -- number of preallocated spaces needed to hold overlapping burst data. Overlaps are frequency dependent, and the space required depends on the maximum value of xfund * kdur. Can be over-estimated at no computation cost. Uses less than 50 bytes of memory per iolap.

ifna, ifnb -- table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear (GEN07) or perhaps a sigmoid (GEN19).

itotdur -- total time during which this fof will be active. Normally set to p3. No new sineburst is created if it cannot complete its kdur within the remaining itotdur.

iphs (optional, default=0) -- initial phase of the fundamental, expressed as a fraction of a cycle (0 to 1). The default value is 0.

ifmode (optional, default=0) -- formant frequency mode. If zero, each sineburst keeps the xform frequency it was launched with. If non-zero, each is influenced by xform continuously. The default value is 0.

iskip (optional, default=0) -- If non-zero, skip initialisation (allows legato use).

## Performance

xamp -- peak amplitude of each sineburst, observed at the true end of its rise pattern. The rise may exceed this value given a large bandwidth (say, Q < 10) and/or when the bursts are overlapping.

xfund -- the fundamental frequency (in Hertz) of the impulses that create new sinebursts.

xform -- the formant frequency, i.e. freq of the sinusoid burst induced by each xfund impulse. This frequency can be fixed for each burst or can vary continuously (see ifmode).

koct -- octaviation index, normally zero. If greater than zero, lowers the effective xfund frequency by attenuating odd-numbered sinebursts. Whole numbers are full octaves, fractions transitional.

kband -- the formant bandwidth (at -6dB), expressed in Hz. The bandwidth determines the rate of exponential decay throughout the sineburst, before the enveloping described below is applied.

kris, kdur, kdec -- rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound linen generator but with rise and decay shapes derived from the ifnb input. kris inversely determines the skirtwidth (at -40 dB) of the induced formant region. kdur affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.

Csound's fof generator is loosely based on Michael Clarke's C-coding of IRCAM's CHANT program (Xavier Rodet et al.). Each fof produces a single formant, and the output of four or more of these can be summed to produce a rich vocal imitation. fof synthesis is a special form of granular synthesis, and this implementation aids transformation between vocal imitation and granular textures. Computation speed depends on kdur, xfund, and the density of any overlaps.

## Examples

Here is an example of the fof opcode. It uses the file fof.csd.

Example 360. Example of the fof opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    -odac     ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o fof.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    nchnls = 2

    instr 1
      ; Combine five formants together to create
      ; a transformation from an alto-"a" sound
      ; to an alto-"i" sound.
      ; Values common to all of the formants.
      kfund init 261.659
      koct init 0
      kris init 0.003
      kdur init 0.02
      kdec init 0.007
      iolaps = 100
      ifna = 1
      ifnb = 2
      itotdur = p3

      ; First formant.
      k1amp = ampdb(0)
      k1form line 800, p3, 350
      k1band line 80, p3, 50

      ; Second formant.
      k2amp line ampdb(-4), p3, ampdb(-20)
      k2form line 1150, p3, 1700
      k2band line 90, p3, 100

      ; Third formant.
      k3amp line ampdb(-20), p3, ampdb(-30)
      k3form line 2800, p3, 2700
      k3band init 120

      ; Fourth formant.
      k4amp init ampdb(-36)
      k4form line 3500, p3, 3700
      k4band line 130, p3, 150

      ; Fifth formant.
      k5amp init ampdb(-60)
      k5form init 4950
      k5band line 140, p3, 200

      a1 fof k1amp, kfund, k1form, koct, k1band, kris, \
             kdur, kdec, iolaps, ifna, ifnb, itotdur
      a2 fof k2amp, kfund, k2form, koct, k2band, kris, \
             kdur, kdec, iolaps, ifna, ifnb, itotdur
      a3 fof k3amp, kfund, k3form, koct, k3band, kris, \
             kdur, kdec, iolaps, ifna, ifnb, itotdur
      a4 fof k4amp, kfund, k4form, koct, k4band, kris, \
             kdur, kdec, iolaps, ifna, ifnb, itotdur
      a5 fof k5amp, kfund, k5form, koct, k5band, kris, \
             kdur, kdec, iolaps, ifna, ifnb, itotdur

      ; Combine all of the formants together
    asig sum (a1+a2+a3+a4+a5) * 13000
         outs asig, asig

    endin
    </CsInstruments>
    <CsScore>
    ; sine wave
    f 1 0 4096 10 1
    ; sigmoid wave
    f 2 0 1024 19 0.5 0.5 270 0.5

    i 1 0 1
    i 1 2 5	; same but slower
    e
    </CsScore>
    </CsoundSynthesizer>

The formant values for the alto-"a" sound were taken from the Formant Values Appendix.

## See Also

fof2, Formant Values Appendix

## Credits

Added in version 1 (1990)

Prev | Up | Next
fmwurlie | Home | fof2