Loading...
Logo
Processing Forum
I am so ticked off. I'm trying to add audio into my game, and I was getting nothing but errors, so I made a new document and copied the text WORD FOR WORD from this website (adding my own song in) and I keep getting, first of all, "unexpected token: [" then it tells me "Java" is unexpected.
AND, it just keeps telling me "unexpected token: \" and that's not even in this script. I give up. 

Replies(10)

Without posting your code, there is no way to help you...
All examples of minim are available in the Processing examples, too, so no need to type them in!
Moved to Core Library Questions (assuming it's about the Minim version shipped with Processing).

Try the Minim examples that come with Processing.

Otherwise just post your code so the forum can help. We're not psychic you know.
It's not the library that shipped with Processing. I looked it up and it said you had to use this program to play sound, so that's what I did. 

[snip java]
import ddf.minim.*;

Minim minim;
AudioPlayer song;

void setup()
{
size(100, 100);

minim = new Minim(this);

// this loads mysong.wav from the data folder
song = minim.loadFile(“music.mp3”);
song.play();
}

void draw()
{
background(0);
}

void stop()
{
song.close();
minim.stop();

super.stop();
}
[/snip]

This is just the basic one I used to see what the heck was going on.
Can you post the complete error message?
I think you have a file called "music.mp3" in your data directory, right!?
It's not the library that shipped with Processing. I looked it up and it said you had to use this program to play sound, so that's what I did.
Does this mean you have installed a more recent Minim version from it's website? If so, have you removed the Minim version that comes with Processing, as the website you link to instructs? Otherwise multiple versions of Minim may cause problems.

Note by the way, that the (older) Minim library that comes with Processing is perfectly fine for playing sounds and includes the code sample you posted.
Error message:



processing.app.SketchException: unexpected token: [
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:326)
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:197)
at processing.mode.java.JavaBuild.build(JavaBuild.java:156)
at processing.mode.java.JavaBuild.build(JavaBuild.java:135)
at processing.mode.java.JavaMode.handleRun(JavaMode.java:176)
at processing.mode.java.JavaEditor$20.run(JavaEditor.java:481)
at java.lang.Thread.run(Thread.java:662)

Yes, I installed it and deleted from where it told me. 
I didn't know that worked for playing sounds. I'm sorry.

Any thoughts? This is the last thing we need done, and we can't figure it out.

Just to be sure: the [snip java] and [/snip] parts must NOT be in the PDE... They are just delimiters of the code, not part of the code.
Maybe just download the latest stable release (1.5.1.) and check if the minim examples work there! 
Try to put P3D to your size.
 
like this
 
size(100, 100 , P3D);
 
and run it.