Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Why? - "ERROR: /node/set: Control input index 2 out of range for synth 1"

$
0
0

Using the example SineWave Oscillator code from the official library in Processing 3.2.3 always throws up the error: ERROR: /node/set: Control input index 2 out of range for synth 1. Interestingly, the same thing doesn't happen with the SquareWave example?

If anybody is able to offer any insight I would really like to know why this is happening and prevent it from doing so!

Code is as follows:

import processing.sound.*;

SinOsc sine;

float freq=400;
float amp=0.5;
float pos;

void setup() {
    size(640, 360);
    background(255);

    // Create and start the sine oscillator.

    sine = new SinOsc(this);

    //Start the Sine Oscillator.
    sine.play();
}

void draw() {

  // Map mouseY from 0.0 to 1.0 for amplitude
  amp=map(mouseY, 0, height, 1.0, 0.0);
  sine.amp(amp);

  // Map mouseX from 20Hz to 1000Hz for frequency
  freq=map(mouseX, 0, width, 80.0, 1000.0);
  sine.freq(freq);

  // Map mouseX from -1.0 to 1.0 for left to right
  pos=map(mouseX, 0, width, -1.0, 1.0);
  sine.pan(pos);
}

Many thanks. :)


Viewing all articles
Browse latest Browse all 2896

Trending Articles