GEN43
Loads a PVOCEX file containing a PV analysis.
This subroutine loads a PVOCEX file containing the PV analysis (amp-freq) of a soundfile and calculates the average magnitudes of all analysis frames of one or all audio channels. It then creates a table with these magnitudes for each PV bin.
Syntax
Initialisation
size -- number of points in the table, power-of-two or power-of-two plus 1. GEN 43 does not make any distinction between these two sizes, but it requires the table to be at least the fftsize/2. PV bins cover the positive spectrum from 0Hz (table index 0) to the Nyquist (table index fftsize/2+1) in equal-size frequency increments (of size sr/fftsize).
filcod -- a pvocex file (which can be generated by pvanal).
channel -- audio channel number from which the magnitudes will be extracted; a 0 will average the magnitudes from all channels.
Reading stops at the end of the file.
Note
if p4 is positive, the table will be post-normalised. A negative p4 will cause post-normalisation to be skipped.
Examples
Here is an example of the GEN43 routine. It uses the files gen43.csd.
Note: In this example, the .csd uses the ‘system_i’ opcode to launch and run the pvanal utility and analyze a section from the sound file, finneganswake1.flac, where we find a bit of reverb and noise. The ‘reverbnoise’ selection has a duration of 0.8 seconds (-d0.8) which we find after 1.04 seconds of the source (-b1.04) and thus pvanal creates the pvocex file that we use in instrument 3 to remove this noise and reverb from the original with the pvstencil opcode.
These tables can be used as a masking table for pvstencil and pvsmaska.
The first example uses a 1024-point FFT phase vocoder analysis file from which the first channel is used. The second uses all channels of a 2048-point file, without post-normalisation. For noise reduction applications with pvstencil, it is easiest to skip table normalisation (negative GEN code).
Credits
Author: Victor Lazzarini