We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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. :)
Answers
This link could provide further detail: https://github.com/processing/processing-sound/issues/67
Kf
I have the same problem as the OP. The link by kfrajer didn't help me. The strange thing is that there is no problem when using SawOsc or TriOsc.
The error message only appears when you use SinOsc.freq() or SinOsc.amp() f.ex.
If you only use SinOsc.play() and SinOsc.stop() you don't get any errors.
/Kaggen
And that's why I just shifted to minim. End of story. That's just one of the problems with Processing sound library.
Back in Processing 2, it never existed officially yet the reference was so full of it - you had to go to GitHub to download it, despite the existence of the download manager.
The library is also known to just fail every once in a while with no reason whatsoever. I believe the library is still very much in its developmental stage and cannot be used in any large projects that need stability.
Ah, minim. I will check it out. Thanks for the tip!
I'm new to processing, still trying to figure things out. Love it for prototyping though. I've been looking for something like this (simple to get started with and test ideas) since qbasic.
:)