Background music issue

Not sure why these codes don’t work, there is an error message [mismatched input ‘*’ expecting set null] :frowning: I have installed the sound library and add the mp3 in the sketch folder… Anyone can do me a favor ;(

import processing.sound.*;
SoundFile file;

void setup(){
    file = new SoundFile(this, "chopin.mp3");
    file.play();

}    

void draw(){
}

Hi

Make sure that you
Load a soundfile from the /data folder of the sketch and your file name chopin.mp3 with same format

Also you can try and test the library examples

Note that in general void setup run just once with out loop

Hello @muffininwinter,

This has happened to me before with the Processing IDE as I sometimes switch between modes (Java, Python, p5.js).

This is Java code and I suspect you may be running it in Python mode:

Go to the upper right of screen and change to Java mode and it works:

:)

1 Like

Thanks a lot, I really had no idea it’s about the mode… May I ask do you know how to write the python version of it :pray: :pray:
Because it seems I couldn’t search the python code online

1 Like

I only dabble with Python and not able to help with this (adding sound) at this time.

I searched in this forum for:
Python audio
or
Python sound

There are some topics.

I was not successful playing anything with my initial efforts.

:)

1 Like

thank you so much for your effort !!!
Have a nice day :grin: :grin: