pvread

pvread — Reads from a phase vocoder analysis file and returns the frequency and amplitude from a single analysis channel or bin.

Description

pvread reads from a pvoc file and returns the frequency and amplitude from a single analysis channel or bin. The returned values can be used anywhere else in the Csound instrument. For example, one can use them as arguments to an oscillator to synthesize a single component from an analyzed signal or a bank of pvreads can be used to resynthesize the analyzed sound using additive synthesis by passing the frequency and magnitude values to a bank of oscillators.

Syntax

kfreq, kamp pvread ktimpnt, ifile, ibin

Initialization

ifile -- the pvoc number (n in pvoc.n) or the name in quotes of the analysis file made using pvanal. (See pvoc.)

ibin -- the number of the analysis channel from which to return frequency in Hz and magnitude.

Performance

kfreq, kamp -- outputs of the pvread unit. These values, retrieved from a phase vocoder analysis file, represent the values of frequency and amplitude from a single analysis channel specified in the ibin argument. Interpolation between analysis frames is performed at k-rate resolution and dependent of course upon the rate and direction of ktimpnt.

ktimpnt -- the passage of time, in seconds, through this file. ktimpnt must always be positive, but can move forwards or backwards in time, be stationary or discontinuous, as a pointer into the analysis file.

Examples

The example below shows the use pvread to synthesize a single component at a time from a phase vocoder analysis file. It should be noted that the kfreq and kamp outputs can be used for any kind of synthesis, filtering, processing, and so on.

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

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

instr 1
; analyze "fox.wav" with PVANAL first
ibin  = p4
ktime line 0, p3, 2.8
kfreq, kamp pvread ktime, "fox.pvx", ibin	;read data from 7th analysis bin.
asig  poscil kamp, kfreq, 1 			;function 1 is a stored sine
      outs asig*5, asig*5			;compensate loss of volume

endin
</CsInstruments>
<CsScore>
;sine wave
f1 0 4096 10 1

i 1 0 6 7
i 1 + 6 15
i 1 + 2 25
e
</CsScore>
</CsoundSynthesizer>


See Also

pvbufread, pvcross, pvinterp, tableseg, tablexseg

Credits

Author: Richard Karpen
Seattle, Wash
1997

New in version 3.44