pvstencil — Transforms a pvoc stream according to a masking function table.
Transforms a pvoc stream according to a masking function table; if the pvoc stream amplitude falls below the value of the function for a specific pvoc channel, it applies a gain to that channel.
The pvoc stream amplitudes are compared to a masking table, if the fall below the table values, they are scaled by kgain. Prior to the operation, table values are scaled by klevel, which can be used as masking depth control.
Tables have to be at least fftsize/2 in size; for most GENS it is important to use an extended-guard point (size power-of-two plus one), however this is not necessary with GEN43.
One of the typical uses of pvstencil would be in noise reduction. A noise print can be analysed with pvanal into a PVOC-EX file and loaded in a table with GEN43. This then can be used as the masking table for pvstencil and the amount of reduction would be controlled by kgain. Skipping post-normalisation will keep the original noise print average amplitudes. This would provide a good starting point for a successful noise reduction (so that klevel can be generally set to close to 1).
Other possible transformation effects are possible, such as filtering and `inverse-masking'.
fsig -- output pv stream
fsigin -- input pv stream.
kgain -- `stencil' gain.
klevel -- masking function level (scales the ftable prior to `stenciling') .
iftable -- masking function table.
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. |
Here is an example of the pvstencil opcode. Play pvstencil.csd
Example 854. Example of the pvstencil 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 real audio input is needed too ; For Non-realtime ouput leave only the line below: ; -o pvstencil.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 ; By Stefano Cucchi - 2021 instr 1 fsource pvsdiskin "fox.pvx", 1, 0.2 kgain1 randomh p4, p5, p6 fstencil1 pvstencil fsource, kgain1, 1, 1 aout1 pvsynth fstencil1 kgain2 randomh p7, p8, p9 fstencil2 pvstencil fsource, kgain2, 1, 1 aout2 pvsynth fstencil2 outs aout1*0.2, aout2*0.2 endin </CsInstruments> <CsScore> f1 0 513 -7 0 128 0.01 256 0 128 0.9 i1 0 10 4 70 4.2 12 95 3.8 e </CsScore> </CsoundSynthesizer>
For another example of pvstencil, see GEN43