# Playing sound with Minim on Pi breaks

**URL:** <https://discourse.processing.org/t/playing-sound-with-minim-on-pi-breaks/17354>\
**Category:** Processing for Pi\
**Created:** [January 26, 2020, 5:18pm UTC](https://discourse.processing.org/t/playing-sound-with-minim-on-pi-breaks/17354 "2020-01-26T17:18:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluemoon](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bluemoon](https://discourse.processing.org/u/bluemoon)\
**Post date:** [January 26, 2020, 5:18pm UTC](https://discourse.processing.org/t/playing-sound-with-minim-on-pi-breaks/17354/1 "2020-01-26T17:18:54Z")

</div>

Hi Folks, I’ve got a bit of a mystery for you. I’ve got some code that cycles through a folder of audio files and plays them with minim. I’m using the following that gets called in draw to check when one file is done and start the next.

```auto
  if(!player.isPlaying() && !inputing && index < lovequestions.length) {
        player.close();
        player = minim.loadFile(language + "/love/questions/" + lovequestions[index]);
        delay(100);
        player.play();
        index++;
        println("Index: " + index);
  }

```

But after about 9 tracks I get the following error. Sometimes its a few tracks less, sometimes a few more. I know that it is not related to the audio files themselves because they all will play individually, its in trying to play multiple files in sequence that I get the error.

```auto
==== JavaSound Minim Error ====
==== Couldn't open the line: line with format PCM_SIGNED 48000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.

=== Minim Error ===
=== Couldn't load the file elevator2.wav

```

It looks like there is/was an issue with Minim breaking after loading 16 sound files, maybe that’s what I am running into? [https://github.com/ddf/Minim/issues/45](https://github.com/ddf/Minim/issues/45) Thanks for any advice you have!

---

<div class="post-metadata">

**Author:** ![bluemoon](https://avatars.discourse-cdn.com/v4/letter/b/bc79bd/32.png) [@bluemoon](https://discourse.processing.org/u/bluemoon)\
**Post date:** [January 28, 2020, 1:06am UTC](https://discourse.processing.org/t/playing-sound-with-minim-on-pi-breaks/17354/2 "2020-01-28T01:06:44Z")

</div>

Ok, here’s a potential work around, but it is not an ideal fix - use FilePlayer instead:

```auto
  if(!player.isPlaying() && !inputing && index < lovequestions.length) {
        player.close();
        player.unpatch(out);
        player = new FilePlayer(minim.loadFileStream(language + "/love/questions/" + lovequestions[index]));
        delay(100);
        player.patch(out);
        player.play();
        index++;
        println("Index: " + index);
  }

```
