User-Defined Opcode Database

SigReverse

A table-based reversing opcode.

Download UDO File

Description

SigReverse takes short snapshots of a signal and then plays then back in reverse.

Syntax

asig SigReverse ain, kfade, ifn1, ifn2

Initialization

ifn1 - table to be used to hold the recorded signal. The size of the table will determine the length of the recorded snapshot.
inf2 - window used to smooth the edges of the recorded snapshot (1/2 sine, hanning or triangle window, etc.)

Performance

asig - reversed output

ain - input signal
kfade - this can be used to fade in/out the second playback tap, which is offset by 1/2 table in relation to the first. The second tap provides a more continuous signal, but also some echoes as side-effect

Code

opcode SigReverse, a, akii

      setksmps 1

asig,kfd,ifn,iwin xin

kwp init 0
awp = kwp

ilen = ftlen(ifn)  /* size of delay */
    tablew asig, awp, ifn  /* delay writing*/
as1 table  -kwp, ifn, 0, 0, 1  /* reverse tap 1 */
as2 table  -kwp, ifn, 0, ilen/2, 1 /* reverse tap 2 */
kenv table kwp*2,iwin, 0, 0, 1   /* crossfade envelope */
amix = as1*kenv + as2*(kenv-1)*kfd /* mix */
kwp = kwp + 1

if kwp > ilen then
kwp = 0
endif

      xout amix

endop

Examples

gi1 ftgen  1, 0, 32768, 7, 0, 32768, 0
gi2 ftgen  2, 0, 32768, 9, 0.5, 1, 0

instr 1

asig in
aout SigReverse asig, 1, 1, 2

     out aout

Credits

Victor Lazzarini, 2005


Previous Home Next
Vocoder   SigRec