an open-source digital signal processing and sound synthesis language
about · links · contact
makeconverter - read data from one pfield-handle or table-handle and transform it to a different representation, passing the altered data out through another pfield-handle.


Synopsis

pfield = makeconverter(input_handle, "converter_type")


Description

makeconverter returns a pfield-handle that will deliver data by applying an RTcmix data-representation conversion routine as specified by the "convertor_type" string argument. This will be applied to data coming through the input-handle variable. The input_handle variable can be any of the PField-derived variables in RTcmix, such as a table-handle (see maketable) or another pfield-handle (see makeconnection, makeLFO or makerandom).

Many of the arguments for makeconverter may themselves also be pfield-handles.


Arguments

input_handle
This is a pfield-handle variable referring to a data stream, possibly from an external device or interface or an internal PField data-generating process.

converter_type
This string value (i.e. enclosed in "double quotes" in the scorefile) determines which RTcmix data-format conversion routines (listed below) will be used to transform the values coming through the input_handle. The pfield-handle returned from the makeconverter command will refer to this transformed data stream.


Converter Types

The string argument for the converter to operate on the input_handle data stream can be any of the following:
  • "ampdb" - convert amp in decibels to a real amplitude
  • "cpsoct" - convert linear octaves to cycles per second
  • "octcps" - convert cycles per second to linear octaves
  • "octpch" - convert octave.pitch-class to linear octaves
  • "cpspch" - convert octave.pitch-class to cycles per second
  • "pchoct" - convert linear octaves to octave.pitch-class
  • "pchcps" - convert cycles per second to octave.pitch-class
  • "pchmidi" - convert MIDI note # to octave.pitch-class
  • "octmidi" - convert MIDI note # to linear octaves
  • "midipch" - convert octave.pitch-class to MIDI note #
  • "boost" - converts a pan value (0-1) to a linear amplitude that, when multiplied by the amplitude of a note, achieves constant-power panning (compensating for the "hole in the middle")
For more information on these conversion types, see the documentation for the various RTcmix data format converters (such as ambdb, cpsoct, pchmidi, etc. (see the SEE ALSO section below.)


Examples

   mpfield = makeconnection("midi", 1, 127, 60, 0, 1, "noteonpitch")
   octpfield = makeconverter(mpfield, "pchmidi")
mpfield receives MIDI note # data from MIDI NoteOn events, and the makeconverter command will change them into the octave.pitch-class (see pchcps for a description of octave.pitch-class) notation format used by many RTcmix Instruments. The octpfield variable could then be used to control Instrument pitch dynamically.


See Also

maketable, makefilter, makeLFO, makerandom, makefilter, makemonitor, ampdb, boost, dbamp, cpsmidi, cpslet, cpsoct, cpspch, midipch, octcps, octlet, octmidi, octpch, pchcps, pchlet, pchmidi, pchoct