We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I wrote this really simple sketch on my macbook after installing the processing.sound library. it works exactly as it should ( moving the mouse along the horizontal axis I can control the speed of reproduction of the audio file )
When I tried to run this very same example on my windows 7 pro machine I got no audio and the following error in the console : "cannot free root node 0".
Help please?
import processing.sound.*;
SoundFile file;
void setup() {
size(640, 360);
background(255);
// Load a soundfile from the data folder of the sketch and play it
file = new SoundFile(this, "sample_m.mp3");
file.loop();
file.rate(1);
}
void draw() {
}
void mouseMoved() {
float value = (float)mouseX/width * 2;
println(value);
file.rate(value);
}
Answers
here is a royalty free mp3 file that i tested and works on mac:
Not sure - I am on macOS - but saw this message once before:
yes I have seen it in a couple of places ( I usually google before I ask ) but they were all dead ends, anyone out there willing to give it a shot? Is there a Github page for the library where I can ask?
Ok I got it to ( sorta ) work, it was a stupid 3rd party audio driver thing, basically it had the digital out port as the default audio device. I went in and set the speaker as the Default audio device and it worked( sorta ).
Now I have a new problem: It does not loop on my windows machine, it's a mono mp3 file. it loops just fine on mac.
When I run the sketch if I quit before it reaches the end of the first playback i get nothing. if i wait for the file to fully play and then quit i get two error messages:
Which now leads me to believe loop tries to free the memory from the two channels it allocates for the stereo out when it reaches the EOF and reinitialiaze the file.
I could not find documentation about sound on the javadoc page.
Could someone please help? is it because i'm trying to play a mono file on a stereo system? Seems like a big problem. I know the sound library is less than robust and the error messages hard to divine but this is just broken....
Have you tried the minim library? Unfortunately I don't think processing.sound is getting proper support these days. Most of sounds posts seems to be dealing with minim instead.
Kf
Keywords: kf_keyword playback speed rate beads library sound kf_keyword_sound kf_keyword_audio
minim is great but it's lacking the one thing I need, setting the playback speed for my sound file.
@jacopom I ran your sketch on my laptop with Windows 7 Pro (64-bit) using Processing 3.3.6 and a Mac Book Pro with El Capitan using Processing 3.3.7 -- I did cut the sample MP3 down from 10 minutes to 9 seconds.
On both machines the music stopped after the 9 seconds -- so it did not loop -- and I started to see the error message "ERROR: /node/set: Synth 1 not found" (same error on both machines).
Sorry, I have no idea why the Sound library will not play the music in a continuous loop.
BTW: If you haven't found it yet the documentation for the library is here: https://processing.org/reference/libraries/sound/index.html
Curse my curiosity! :))
Take a look at the Beads library (part of the Contributed libraries for Processing). It can change the playback rate and a lot more. Here is the equivalent of your original sketch, but using Beads. I've modified the playback rate to go from -2.0 (rewind at double speed) to +2.0 (fast-forward at double speed).