The Alternative Csound Reference Manual
Previous |  | Next

# follow

follow -- Envelope follower unit generator.

## Description

Envelope follower unit generator.

## Syntax

ar follow asig, idt

## Initialization

idt -- This is the period, in seconds, that the average amplitude of asig is reported. If the frequency of asig is low then idt must be large (more than half the period of asig )

## Performance

asig -- This is the signal from which to extract the envelope.

## Examples

Here is an example of the follow opcode. It uses the files follow.orc, follow.sco, and beats.wav.

Example 1. Example of the follow opcode.

    /* follow.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1 - play a WAV file.
    instr 1
      a1 soundin "beats.wav"
      out a1
    endin

    ; Instrument #2 - have another waveform follow the WAV file.
    instr 2
      ; Follow the WAV file.
      as soundin "beats.wav"
      af follow as, 0.01

      ; Use a sine waveform.
      as oscil 4000, 440, 1
      ; Have it use the amplitude of the followed WAV file.
      a1 balance as, af

      out a1
    endin
    /* follow.orc */

    /* follow.sco */
    ; Just generate a nice, ordinary sine wave.
    f 1 0 32768 10 1

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

To avoid zipper noise, by discontinuities produced from complex envelope tracking, a lowpass filter could be used, to smooth the estimated envelope.

## Credits

Author: Paris Smaragdis
MIT, Cambridge
1995

Previous | Home | Next
fold | Up | follow2