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 )
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 */
/* Written by Kevin Conder */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
; Instrument #1 - play a WAV file.
instr 1
a1 diskin "beats.wav", 1
out a1
endin
; Instrument #2 - have another waveform follow the WAV file.
instr 2
; Follow the WAV file.
as diskin "beats.wav", 1
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 */
/* Written by Kevin Conder */
; 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.