Hi all
I am using Processing 3.5.4 on linux. According to the Contribution Manager the sound library from The Processing Foundation is installed.
I tried to run this code from the Sound tutorial (Sound \ Processing.org):
/**
* Processing Sound Library, Example 1
*
* Five sine waves are layered to construct a cluster of frequencies.
* This method is called additive synthesis. Use the mouse position
* inside the display window to detune the cluster.
*/
import processing.sound.*;
SinOsc[] sineWaves; // Array of sines
float[] sineFreq; // Array of frequencies
int numSines = 5; // Number of oscillators to use
void setup() {
size(640, 360);
background(255);
sineWaves = new SinOsc[numSines]; // Initialize the oscillators
sineFreq = new float[numSines]; // Initialize array for Frequencies
for (int i = 0; i < numSines; i++) {
// Calculate the amplitude for each oscillator
float sineVolume = (1.0 / numSines) / (i + 1);
// Create the oscillators
sineWaves[i] = new SinOsc(this);
// Start Oscillators
sineWaves[i].play();
// Set the amplitudes for all oscillators
sineWaves[i].amp(sineVolume);
}
}
void draw() {
//Map mouseY from 0 to 1
float yoffset = map(mouseY, 0, height, 0, 1);
//Map mouseY logarithmically to 150 - 1150 to create a base frequency range
float frequency = pow(1000, yoffset) + 150;
//Use mouseX mapped from -0.5 to 0.5 as a detune argument
float detune = map(mouseX, 0, width, -0.5, 0.5);
for (int i = 0; i < numSines; i++) {
sineFreq[i] = frequency * (i + 1 * detune);
// Set the frequencies for all oscillators
sineWaves[i].freq(sineFreq[i]);
}
}
I receive the following error message:
Could not run the sketch (Target VM failed to initialize).
Thanks for your help!