pvsvoc

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

Description

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] 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. Play pvsvoc.csd

Example 856. Example of the pvsvoc opcode.

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

Credits

Author: Victor Lazzarini
April 2005

New plugin in version 5

April 2005.