pvsfreeze

pvsfreeze — Freeze the amplitude and frequency time functions of a pv stream according to a control-rate trigger.

Description

This opcodes 'freezes' the evolution of pvs stream by locking into steady amplitude and/or frequency values for each bin. The freezing is controlled, independently for amplitudes and frequencies, by a control-rate trigger, which switches the freezing 'on' if equal to or above 1 and 'off' if below 1.

Syntax

fsig pvsfreeze fsigin, kfreeza, kfreezf

Performance

fsig -- output pv stream

fsigin -- input pv stream.

kfreeza -- freezing switch for amplitudes. Freezing is on if above or equal to 1 and off if below 1.

kfcf -- freezing switch for frequencies. Freezing is on if above or equal to 1 and off if below 1.

[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

Example 837. Example

asig  in                                       ; input
ktrig oscil     1.5, 0.25, 1                   ; trigger
fim   pvsanal   asig1, 1024, 256, 1024, 0      ; pvoc analysis 
fou   pvsfreeze fim, abs(ktrig), abs(ktrig)    ; regular 'freeze' of spectra
aout  pvsynth   fou                            ; pvoc synthesis


In the example above the input signal will be regularly 'frozen' for a short while, as the trigger rises above 1 about every two seconds.

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

Example 838. Example of the pvsfreeze 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
; Audio out   Audio in
-odac  ;;;realtime audio out
; For Non-realtime ouput leave only the line below:
; -o pvsfreeze.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

;; example written by joachim heintz 2009

seed		0

instr 1

ifftsize        = 1024
ioverlap	= ifftsize / 4
iwinsize	= ifftsize
iwinshape	= 1     ; von-Hann window
Sfile1		= "fox.wav"
ain		soundin	Sfile1
kfreq		randomh	.7, 1.1, 3; probability of freezing freqs: 1/4
kamp		randomh	.7, 1.1, 3; idem for amplitudes
fftin		pvsanal	ain, ifftsize, ioverlap, iwinsize, iwinshape; fft-analysis of file
freeze		pvsfreeze	fftin, kamp, kfreq; freeze amps or freqs independently
aout		pvsynth	freeze; resynthesize
		outs aout, aout
endin

</CsInstruments>
<CsScore>
r 10
i 1 0 2.757
e
</CsScore>
</CsoundSynthesizer>


See also

Tools for Real-time Spectral Processing (pvs opcodes)

Credits

Author: Victor Lazzarini
May 2006

New plugin in version 5

May 2006.