# I need help with the background music

**URL:** <https://discourse.processing.org/t/i-need-help-with-the-background-music/37115>\
**Category:** Libraries\
**Tags:** homework\
**Created:** [May 26, 2022, 12:10pm UTC](https://discourse.processing.org/t/i-need-help-with-the-background-music/37115 "2022-05-26T12:10:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Katharina](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@Katharina](https://discourse.processing.org/u/Katharina)\
**Post date:** [May 26, 2022, 12:10pm UTC](https://discourse.processing.org/t/i-need-help-with-the-background-music/37115/1 "2022-05-26T12:10:30Z")

</div>

Hello, so I made a game but the background music isn’t working.( I’ve only copied the sound problem tho) I’ve used another sound before and it works perfectly fine but the background music won’t work. If I play my programm I get this error:  
JavaSound Minim Error  
javax.sound.sampled.UnsupportedAudioFileException: not a MPEG stream: javax.sound.sampled.UnsupportedAudioFileException: Unable to read mp3 header  
Minim Error  
Couldn’t load the file hintergrundMusik.mp3  
NullPointerException  
Could not run the sketch (Target VM failed to initialize).  
Can someone help me please? + I kinda want the music to be a loop since it’s in the background and therefor infinite.

> import processing.sound._;  
> SoundFile click;  
> import ddf.minim._;  
> Minim minim;  
> AudioPlayer music;  
> void setup() {  
> size(800, 600);  
> click= new SoundFile(this, “clickSound.mp3”);  
> minim = new Minim(this);  
> music = minim.loadFile(“hintergrundMusik.mp3”);  
> music.play();  
> void draw() {  
> background(255);  
> }  
> void mousePressed() { //Kreise klicken  
> click.play();  
> }

---

<div class="post-metadata">

**Author:** ![NumericPrime](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/numericprime/32/16318_2.png) [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Post date:** [May 26, 2022, 12:39pm UTC](https://discourse.processing.org/t/i-need-help-with-the-background-music/37115/2 "2022-05-26T12:39:46Z")

</div>

As far as I know minim doesn’t work anymore in general.

You might want to look into the examples of processing.sound  
there should be something about playing sound files.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 26, 2022, 2:21pm UTC](https://discourse.processing.org/t/i-need-help-with-the-background-music/37115/3 "2022-05-26T14:21:36Z")

</div>

> [@NumericPrime](#):
>
> As far as I know minim doesn’t work anymore in general.

I tried a few examples and it works with Processing 4.0b8 and W10 Pro.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/a/6/a6367f27472f2bceb2a345da8b4fc57c4b62f307.png)

`:)`

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 26, 2022, 2:25pm UTC](https://discourse.processing.org/t/i-need-help-with-the-background-music/37115/4 "2022-05-26T14:25:34Z")

</div>

Hello,

Try the examples that come with the Minim library:

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/c/1/c180ac60ce502d376148766666f29f4951b747c9.png)

Please format your code as per the instructions here:  
[https://discourse.processing.org/faq#format-your-code](https://discourse.processing.org/faq#format-your-code)  
Try to cut and paste your code and run it and you will see why it is important to format and post code correctly.  
It helps us help you.

Try another sound file to see if that is the issue; I sometimes have a sound file that simply will not work.

`:)`
