pvswarp

pvswarp — Warp the spectral envelope of a PVS signal

Description

Warp the spectral envelope of a PVS signal by means of shifting and scaling.

Syntax

fsig pvswarp fsigin, kscal, kshift[, klowest, kmeth, kgain, kcoefs]

Performance

fsig -- output pv stream

fsigin -- input pv stream

kscal -- spectral envelope scaling ratio. Values > 1 stretch the envelope and < 1 compress it.

kshift -- spectral envelope shift (in Hz), values > 0 shift the envelope linearly upwards and values < 0 shift it downwards.

klowest -- lowest frequency shifted (affects only kshift, defaults to 0).

kmethod -- spectral envelope extraction method 1: liftered cepstrum method; 2: true envelope method (defaults to 1).

kgain -- amplitude scaling (defaults to 1).

kcoefs -- number of cepstrum coefs used in formant preservation (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 pvswarp opcode. It uses the file pvswarp.csd.

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

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

instr 1

kscal = p4
kshift = p5
asig  soundin "fox.wav"			; get the signal in
fsig  pvsanal asig, 1024, 256, 1024, 1	; analyse it
ftps  pvswarp fsig, kscal, kshift		; warp it
atps  pvsynth ftps			; synthesise it                      
      outs atps/2, atps/2

endin
</CsInstruments>
<CsScore>
 ;change scale
i 1 0 3 1
i 1 + . 1.5
i 1 + . 3
i 1 + . .25
 ;change shift
i 1 + . 1 0
i 1 + . . 300
i 1 + . . 0
i 1 + . . -300
e
</CsScore>
</CsoundSynthesizer>


Used with vocal sounds, it will shift the formants and result in a changed vowel timbre, similar to the effect of a singer inhaling helium (the 'donald duck' effect).

See also

Tools for Real-time Spectral Processing (pvs opcodes)

Credits

Author: Victor Lazzarini
November 2004

New plugin in version 5

November 2004.