temposcal — Phase-locked vocoder processing with onset detection/processing, 'tempo-scaling'.


temposcal implements phase-locked vocoder processing using function tables containing sampled-sound sources, with GEN01, and temposcal will accept deferred allocation tables.

This opcode allows for time and frequency-independent scaling. Time is advanced internally, but controlled by a tempo scaling parameter; when an onset is detected, timescaling is momentarily stopped to avoid smearing of attacks. The quality of the effect is generally improved with phase locking switched on.

temposcal will also scale pitch, independently of frequency, using a transposition factor (k-rate).


asig temposcal ktimescal, kamp, kpitch, ktab, klock [,ifftsize, idecim, ithresh]


ifftsize -- FFT size (power-of-two), defaults to 2048.

idecim -- decimation, defaults to 4 (meaning hopsize = fftsize/4)

idbthresh -- threshold based on dB power spectrum ratio between two successive windows. A detected ratio above it will cancel timescaling momentarily, to avoid smearing (defaults to 1)


ktimescal -- timescaling ratio, < 1 stretch, > 1 contract.

kamp -- amplitude scaling

kpitch -- grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher; negative, backwards)

klock -- 0 or 1, to switch phase-locking on/off

ktab -- source signal function table. Deferred-allocation tables (see GEN01) are accepted, but the opcode expects a mono source. Tables can be switched at k-rate.


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

Example 1120. Example of the temposcal opcode.

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

; 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 temposcal.wav -W ;;; for file output any platform

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

ilock  =  p4
itab   =  1
ipitch =  1
iamp   =  0.8
ktime  linseg 0.3, p3/2, 0.8, p3/2, 0.3
asig   temposcal ktime, iamp, ipitch, itab, ilock
       outs asig, asig

f 1 0 0 1 "fox.wav" 0 4 0

i 1 0 3.8 0	;no locking
i 1 4 3.8 1	;locking

See Also

Short-time Fourier Transform (STFT) Resynthesis


Author: Victor Lazzarini
February 2010

New plugin in version 5.13

February 2005.