partials

partials — Partial track spectral analysis.

Description

The partials opcode takes two input PV streaming signals containg AMP_FREQ and AMP_PHASE signals (as generated for instance by pvsifd or in the first case, by pvsanal) and performs partial track analysis, as described in Lazzarini et al, "Time-stretching using the Instantaneous Frequency Distribution and Partial Tracking", Proc.of ICMC05, Barcelona. It generates a TRACKS PV streaming signal, containing amplitude, frequency, phase and track ID for each output track. This type of signal will contain a variable number of output tracks, up to the total number of analysis bins contained in the inputs (fftsize/2 + 1 bins). The second input (AMP_PHASE) is optional, as it can take the same signal as the first input. In this case, however, all phase information will be NULL and resynthesis using phase information cannot be performed.

Syntax

ftrks partials ffr, fphs, kthresh, kminpts, kmaxgap, imaxtracks

Performance

ftrks -- output pv stream in TRACKS format

ffr -- input pv stream in AMP_FREQ format

fphs -- input pv stream in AMP_PHASE format

kthresh -- analysis threshold factor, defined between -1 and 1. If non-negative, the analysis threshold is taken to be relative to the maximum magnitude in each analysis frame (kthresh * max_magnitude). If negative, the absolute threshold value is relative to 0dbfs (kthresh * 0dbfs). Tracks below this threshold will be discarded.

kminpoints -- minimum number of time points for a detected peak to make a track (1 is the minimum). Since this opcode works with streaming signals, larger numbers will increase the delay between input and output, as we have to wait for the required minimum number of points.

kmaxgap -- maximum gap between time-points for track continuation (> 0). Tracks that have no continuation after kmaxgap will be discarded.

imaxtracks -- maximum number of analysis tracks (number of bins >= imaxtracks)

Example

Here is an example of the partials opcodes. It uses the file partials.csd.

Example 602. Example of the partials opcodes.

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

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if real audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o partials.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

instr 1

ain  diskin2 "fox.wav", 1
fs1,fsi2 pvsifd ain,2048,512,1		; ifd analysis
fst  partials fs1,fsi2,.003,1,3,500	; partial tracking
aout resyn fst, 1, 1.5, 500, 1		; resynthesis (up a 5th)
     outs aout, aout

endin
</CsInstruments>
<CsScore>
f 1 0 4096 10 1

i 1 0 2.8
e
</CsScore>
</CsoundSynthesizer>


The example above shows partial tracking of an ifd-analysis signal and cubic-phase additive resynthesis with pitch shifting.

Credits

Author: Victor Lazzarini
June 2005

New plugin in version 5

November 2004.