Skip to content

Lesson 1: Patching

npisanti edited this page Feb 14, 2016 · 32 revisions

For this tutorial we need the basic setup object and also:

    pdsp::VAOscillator osc;
    pdsp::Amp amp
    pdsp::Processor engine; // the name is the same and it is called in audioOut as seen in the setup wiki

We will do our patching in the of setup() method, before calling ofxPDSPSetup().

You can use the patch operator >> to connect pdsp objects (that we will call "modules"). All the modules have some input and outputs, when you use the >> operator you are connecting one of those outputs to one of those inputs. For example in the setup method, before ofxPDSPSetup() we could write.

    osc >> engine.channels[0];

we have just patched the oscillator output to our system left channel. Lower your system volume out, compile and run. You should hear a buzzing pitched sound from your left speaker / headphone.

When you are patching something you could use the * operator to scale the signal, for example:

    osc * 0.25f >> engine.channels[0];
    osc * 0.50f >> engine.channels[1];

Compile and run. Now you should ear the same sound but lower in volume and slightly panned to the right.

When you are using the patch operator on the modules you are patching the default outputs / inputs. You could access other inputs and outputs with some in____() and out____() methods. What ins/outs are available and what are the default is described in the documentation. For example we could take a look at the VAOscillator page for knowing what outputs we have. We have outputs for all the four basic waveform, so we could try:

    osc.out_sine() * 0.25f >> engine.channels[0];
    osc.out_sine() * 0.25f >> engine.channels[1];

Compile and run. You should hear a sine wave with no panning. Now our code is really the same of the example-hello_world example