We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to run the example in the documentation for the "Sound" library (https://processing.org/reference/libraries/sound/SoundFile.html) but I'm getting an error. I'm running v1.3.2 of the library, under Processing 3.1.1 and Windows 7 Pro. I tried both the 32-bit and 64-bit versions of Processing. The only change I made to the code was to change line 9 to point to the mp3 file on my hard drive. But when I try to open the file, I get this error message:
The constructor "SoundFile(SoundFile, String)" does not exist.
The error message doesn't make any sense, at least to me. I'm passing "this" as the first parameter, just as in the example, and a string with the full path name of the mp3 file as the second parameter. Why does it think "this" is a SoundFile?
Is the "Sound" library still working?
Here's my code, although as I said, I only changed the one line which opens the file.
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 back
file = new SoundFile(this,"C:\\Users\\owner\\Music\\% Attac\\01 Tonino Carotone & Manu Chao - La Trampa.mp3");
file.play();
}
void draw() {
}
Answers
It crashes for me in Win7 for both 64-bit P3.1.1 & P3.0.2 when trying to initialize SoundFile v1.3.2. :-&
@dfkettle
try this
import processing.video.*;
Movie movie;
void setup(){ size(200,200); movie = new Movie (this,"something.wav"); }
void draw(){ background(0); noLoop(); }
void mousePressed(){ movie.stop(); movie.play(); }
import processing.video.* supports Sound file.
Thanks, but I'd like to know if the Sound library is working (in other words, what am I doing wrong?) Is this just an issue under Windows? And I want to do more than just play the file, I want to access the metadata.
I have processing 3.1.1. and it worked for me:
Kf
@dfkettle @kfrajer
Sound library is working. Did you install the sound library? or follow this steps.
1.open contribution manager(
2.search "sound" in filter and install sound library by the processing foundation.
I hope this will help
@kfrajer: Which version of the Sound library? Which version of Windows?
@unnamed: Yes, I installed the library. I would have gotten a different error message otherwise, something like "missing library".
@dfkettle Sorry, I have no idea for that error
Maybe your audio file isn't supported, but why don't you use minim?
@redcardinal: The Sound library is supposed to support MP3, wav and aiff. Minim is another option, but I'd like to know why the Sound library isn't working, or if it is, what am I doing wrong? Nobody has either confirmed or denied that it's working under Windows. Someone said that it works, but didn't say which OS they're using.
@ dfkettle My specs:
Sound Library 1.3.2.
Windows 8.1
processing-3.1.1-windows64
I hope this helps,
Kf
@kfrajer Thanks. I'm beginning to think it might have something to do with the version of Java on my machine. Here's what I've got:
java version "1.7.0_60" Java(TM) SE Runtime Environment (build 1.7.0_60-b19) Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
Maybe I should upgrade to Java 8.
I have
I hope upgrading solves your problem.
Kf
I fixed this problem by dragging my .mp3 file onto the Processing window, only then did the path work. It automatically added the file to the sketch folder.
I solved my problems with the sound library, referring to the soundFile, with 2 actions: 1) Don't forget to save your music in a "data" File, then save at the sketchbook. 2) The program only accepts mono, so, if is the case, use audacity to transform it.