Transient shaper algorithm

In a nuthsell, i-rate vars are constants, but can be updated on each new instance of an instrument, k-rate values are scalars which are updated every ksmps samples, and a-rate vars are blocks of ksmps samples. So the output of follow2 is a block samples. If you pass it through a tone you can smooth the signal. Here’s a simple example.

instr 1
    a1 diskin2 "voice.wav", 1, 0, 1
    a2 follow2 a1, .1, .1
    a3 tone a2, 10
    ;outs a1, a1
    fout "followOut.wav", 4, a2
    fout "followOutTone.wav", 4, a3
endin

follow2Test.csd (746 Bytes)