pvsinfo

pvsinfo — Get information from a PVOC-EX formatted source.

Description

Get format information about fsrc, whether created by an opcode such as pvsanal, or obtained from a PVOCEX file by pvsfread. This information is available at init time, and can be used to set parameters for other pvs opcodes, and in particular for creating function tables (e.g. for pvsftw), or setting the number of oscillators for pvsadsyn.

Syntax

ioverlap, inumbins, iwinsize, iformat pvsinfo fsrc

Initialization

ioverlap -- The stream overlap size.

inumbins -- The number of analysis bins (amplitude+frequency) in fsrc. The underlying FFT size is calculated as (inumbins -1) * 2.

iwinsize -- The analysis window size. May be larger than the FFT size.

iformat -- The analysis frame format. If fsrc is created by an opcode, iformat will always be 0, signifying amplitude+frequency. If fsrc is defined from a PVOC-EX file, iformat may also have the value 1 or 2 (amplitude+phase, complex).

Examples

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

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

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

; by Menno Knevel 2021

; analyze sound file and output result to pvoc-ex file
ires  system_i 1,{{ pvanal fox.wav fox.pvx }}          ; default settings
ires1 system_i 1,{{ pvanal -n256 MSjungleMid.wav MSjungleMid.pvx }}    ; different frame size

instr 1

if p4 == 0 then
    idur filelen  "fox.pvx"		;find duration of analysis file
    kpos line     0,p3,idur		;to ensure we process whole file
    fsrc pvsfread kpos, "fox.pvx"	;create fsig from (mono) file
    prints  "\n---***you now hear the analyzed file fox.pvx***---"
else
    idur filelen  "MSjungleMid.pvx"		;find duration of analysis file
    kpos line     0,p3,idur		;to ensure we process whole file
    fsrc pvsfread kpos, "MSjungleMid.pvx"	;create fsig from (mono) file
    prints  "\n---***you now hear the analyzed file MSjungleMid.pvx***---"
endif

iovl,inb,iws,ifmt pvsinfo fsrc	;get info
prints "\n          Overlap size   = %d\n", iovl  ;print info
prints "          Number of bins = %d\n",inb
prints "          Window size    = %d\n",iws
prints "          Frame Format   = %d\n",ifmt
prints "\n"
aout pvsynth fsrc
     outs aout, aout

endin
</CsInstruments>
<CsScore>
i 1 0  3     0  ; the fox
i 1 5 13     1  ; the jungle
e
</CsScore>
</CsoundSynthesizer>


The example will produce the following output:

instr 1:  iovl = 256.000  inb = 513.000  iws = 2048.000  ifmt = 0.000
      

See also

Tools for Real-time Spectral Processing (pvs opcodes)

Credits

Author: Richard Dobson
August 2001

New in version 4.13