Use Non-Frames Version Previous Page Next Page
Signal Generators: STFT Resynthesis (Vocoding)

pvsftw, pvsftr

  kr      pvsftw     fsig, ifnamp[, ifnfreq]
          pvsftr     fsig, ifnamp[, ifnfreq]

Description

pvsftw copies amplitude and/or frequency data of an fsig to a function table. pvsftr copies amplitude and/or frequency data from a function table to an fsig.

Initialization

ifnamp – table that stores amplitude data. Given that fsig has N analysis bins, table ifnamp must be of size N or larger. Ignored if ifnamp = 0.

ifnfreq – table that stores frequency data. Given that fsig has N analysis bins, table ifnfreq must be of size N or larger. Ignored if ifnfreq = 0. Default is 0.

Performance

kr – has the value 1 when new data is available, 0 otherwise.

These opcodes enable the contents of an fsig to be exchanged through function tables, for processing by opcodes which cannot access an fsig directly. The frame data is not updated each control period, except when the frame overlap equals ksmps, which usually will not be the case. The data in ifnamp and ifnfreq should only be processed when kr = 1. To process only frequency data, set ifnamp = 0. Since the function tables are required only to store data from fsig, there is no advantage to defining them in the score. They can be created in the instrument, using ftgen.

By exporting amplitude data from one fsig and importing it into another, basic cross-synthesis can be performed, such as in pvscross. By doing cross-synthesis in this manner, the user has the option to modify the data using the table manipulation opcodes. Note that data from an fsig which is written into a table is not typed as to format. Therefore, amplitude and frequency data may be transferred between non-identical fsigs. Used in this way, these opcodes can produce unexpected results. In such a case, resynthesis using pvsadsyn would almost certainly be required.

Note:  To perform a straight copy from one fsig to another one of identical format, it is not necessary to use function tables. The conventional assignment statement fsig1 = fsig2 can be used.

Example

  ifn     ftgen      0, 0, inbins, 10, 1  ; make ftable	
  kflag   pvsftw     fsrc, ifn            ; export  amps to table,
  kamp    init       0
	
  if kflag  ==  0    kgoto contin         ; only proc when frame is ready

          tablew     kamp, 1, ifn         ; kill lowest bins, for obvious effect
          tablew     kamp, 2, ifn
          tablew     kamp, 3, ifn
          tablew     kamp, 4, ifn	
  
          pvsftr     fsrc, ifn            ; read modified data back to fsrc
contin:
  aout    pvsynth    fsrc                 ; and resynth

Author

Richard Dobson
Somerset, England
August, 2001
New in Csound 4.14


Use Non-Frames Version Previous Page Next Page
Signal Generators: STFT Resynthesis (Vocoding)