an open-source digital signal processing and sound synthesis language
about · links · contact


convert various formats of notation and amplitude


    #include "ugens.h"

    float frequency, octpc, linoct, amp, decibel;
    frequency = cpsoct(linoct);

    frequency = cpspch(octpch);

    linoct = octcps(frequency);

    linoct = octpch(frequency);

    octpc = pchcps(frequency);

    frequency = pchoct(linoct);

    amp = ampdb(decibel);

    decibel = dbamp(amp);

    amp = boost(decibel);


These are functions which convert values between linear octaves, octave.pitch-class, cycles per second, and sampling increment. There are also two amplitude conversion routines.

    cpsoct(oct) - convert linear octaves to cycles per second.
    cpspch(pch) - convert octave.pitch-class to cycles per second.
    octcps(cps) - convert cycles per second to linear octaves.
    octpch(pch) - convert octave.pitch-class to linear octaves.
    pchcps(cps) convert cycles per second to octave.pitch-class.
    pchoct(oct) - convert linear octaves to octave.pitch-class.
    ampdb(db) - convert amp in decibels to a real amplitude.
    dbamp(amp) - convert real amplitude to an amp in decibels.
    boost(db) - converts an amplitude in decibels to an amplitude multiplier. It simply returns 10 ** (db/20).

See also the cpspch and pchcps (etc...) scorefile commands for more information about these representations.