Skip to content

pvsvoc

Combine the spectral envelope of one fsig with the excitation (frequencies) of another.

This opcode provides support for cross-synthesis of amplitudes and frequencies. It takes the amplitudes of one input fsig and combines with frequencies from another. It is a spectral version of the well-known channel vocoder.

Syntax

fsig pvsvoc famp, fexc, kdepth, kgain [, kcoefs]

Performance

fsig -- output pv stream

famp -- input pv stream from which the amplitudes will be extracted

fexc -- input pv stream from which the frequencies will be taken

kdepth -- depth of effect, affecting how much of the frequencies will be taken from the second fsig: 0, the output is the famp signal, 1 the output is the famp amplitudes and fexc frequencies.

kgain -- gain boost/attenuation applied to the output.

kcoefs -- number of cepstrum coefs used in spectral envelope estimation (defaults to 80).

⚠ 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.

Examples

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

Example of the pvsvoc 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 pvsvoc.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; additions by Richard Boulanger

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

gisaw ftgen 1, 0, 2048, 10, 1, 0.5, 0.3, 0.25, 0.2 ;sawtooth-like

instr 1

asig diskin "fox.wav",1, 0, 1
;asig inch 1 ;uncomment for live input signal
kfrq line 350,p3,50
asyn poscil .3, kfrq, gisaw             ;excitation signal, dropping in frequency
famp pvsanal asig, 1024, 256, 1024, 1   ;analyse in signal
fexc pvsanal asyn, 1024, 256, 1024, 1   ;analyse excitation signal
ftps pvsvoc famp, fexc, 1, 1            ;cross it
atps pvsynth ftps                       ;synthesise it
outs atps, atps

endin
</CsInstruments>
<CsScore>
i 1 0 20
e
</CsScore>
</CsoundSynthesizer>

The example above shows a typical cross-synthesis operation. The input signal (say a vocal sound) is used for its amplitude spectrum. An oscillator with an arbitrary complex waveform produces the excitation signal, giving the vocal sound its pitch.

See also

Tools for Real-time Spectral Processing (pvs opcodes)

Credits

Author: Victor Lazzarini
April 2005

New plugin in version 5

April 2005.