pvsdemix

pvsdemix — Spectral azimuth-based de-mixing of stereo sources.

Description

Spectral azimuth-based de-mixing of stereo sources, with a reverse-panning result. This opcode implements the Azimuth Discrimination and Resynthesis (ADRess) algorithm, developed by Dan Barry (Barry et Al. "Sound Source Separation Azimuth Discrimination and Resynthesis". DAFx'04, Univ. of Napoli). The source separation, or de-mixing, is controlled by two parameters: an azimuth position (kpos) and a subspace width (kwidth). The first one is used to locate the spectral peaks of individual sources on a stereo mix, whereas the second widens the 'search space', including/exclufing the peaks around kpos. These two parameters can be used interactively to extract source sounds from a stereo mix. The algorithm is particularly successful with studio recordings where individual instruments occupy individual panning positions; it is, in fact, a reverse-panning algorithm.

[Warning] Warning

It is unsafe to use the same f-variable for both input and output of pvs opcodes. Using the same one might lead to undefined behavior on some opcodes. Use a different one on the left and right sides of the opcode.

Syntax

fsig pvsdemix fleft, fright, kpos, kwidth, ipoints

Performance

fsig -- output pv stream

fleft -- left channel input pv stream.

fright -- right channel pv stream.

kpos -- the azimuth target centre position, which will be de-mixed, from left to right (-1 <= kpos <= 1). This is the reverse pan-pot control.

kwidth -- the azimuth subspace width, which will determine the number of points around kpos which will be used in the de-mixing process. (1 <= kwidth <= ipoints)

ipoints -- total number of discrete points, which will divide each pan side of the stereo image. This ultimately affects the resolution of the process.

Examples

The example below takes a stereo input and passes through a de-mixing process revealing a source located at ipos +/- iwidth points. These parameters can be controlled in realtime (e.g. using FLTK widgets or MIDI) for an interactive search of sound sources.

[Note] Note
Regarding the azimuth kpos, there is a stray image at around azimuth 0, which in case of a source with good intensity may possibly be masked.

Example 829. Example

ifftsize = 1024  
iwtype   = 1     /* cleaner with hanning window      */
ipos     = -0.8  /* to the left of the stereo image  */
iwidth   = 20    /* use peaks of 20 points around it */

al,ar  soundin   "sinput.wav"

flc    pvsanal   al, ifftsize, ifftsize/4, ifftsize, iwtype
frc    pvsanal   ar, ifftsize, ifftsize/4, ifftsize, iwtype
fdm    pvsdemix  flc, frc, kpos, kwidth, 100
adm    pvsynth   fdm
   
       outs      adm, adm


Here is a complete example of the pvsdemix opcode. It uses the file pvsdemix.csd.

Example 830. Example of the pvsdemix opcode.

 <CsoundSynthesizer>
<CsOptions>
; 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 pvsdemix.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

instr 1     
ifftsize = 2048 
iwtype   = 1   
kpos  = p4

asig1 diskin2 "fox.wav",1,0,1
asig2 diskin2 "drumsMlp.wav",1,0,1
aL, aR pan2 asig1,0.25
aL1, aR1 pan2 asig2,0.75

if p5 == 0 then
    outs aL1+aL, aR1+aR
else
    flc    pvsanal   aL1+aL, ifftsize, ifftsize/4, ifftsize, iwtype
    frc    pvsanal   aR1+aR, ifftsize, ifftsize/4, ifftsize, iwtype
    fdm    pvsdemix  flc, frc,kpos,20,100
    adm    pvsynth   fdm
    adm     *= 0.5
    outs adm, adm
endif

endin

</CsInstruments>
<CsScore>

;         pan   choice
i 1 0 5    0      0     ; bypass
i 1 5 5  -0.5     1     ; fox
i 1 10 5  0.5     1     ; beats

e
</CsScore>
</CsoundSynthesizer>


See also

Tools for Real-time Spectral Processing (pvs opcodes)

Credits

Author: Victor Lazzarini
January 2005

New plugin in version 5

January 2005.