minim large audio files work on Windows not on Raspberry Pi.

edited September 2017 in Raspberry PI

I am developing a system to light up pumpkins in conjunction with music playing . The program opens about 6 MP3 files using the minim library for processing, they need to all play independently, they cannot be pre-mixed. When running on Windows the program works perfectly. When running on the Raspberry Pi, however, it will only work if I limit the program to 2 or three audio tracks, or small audio tracks. They are all the same MP3 format and exported from the same program at the same bitrate, i even tested using .wav and it had the same issue. And it doesn't seem to matter which to I use just as long as I don't force it to try and load all of them, the last files I try to open are always the ones that fail on the Raspberry Pi. I get this error message but I am 99.9999% sure it has nothing to do with the format as all of the files play fine individually.

==== JavaSound Minim Error ====
==== Unable to return a SourceDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian

I have stripped down the code to the bare minimum to receive this error message.

import ddf.minim.*;
import ddf.minim.effects.*;
Minim minim;
AudioPlayer player1;
AudioPlayer player2;
AudioPlayer player3;
AudioPlayer player4;
AudioPlayer player5;
void setup()
{
  minim = new Minim(this);
  player1 = minim.loadFile("singer_control_track0_0.mp3", 2048);
  player2 = minim.loadFile("singer_control_track0_1.mp3", 2048);
  player3 = minim.loadFile("singer_control_track0_2.mp3", 2048);
  player4 = minim.loadFile("singer_control_track0_3.mp3", 2048);
  player5 = minim.loadFile("song0.mp3", 2048);
 }

void draw()
{
  background(0);
}

It seems like it's using close to 512 megabytes of swap space. I've increased the size of the swap file on raspbian, as well as increasing the maximum memory usage inside the processing settings. I've tried using MP3 files at a drastically lower bitrate. it does not look like my swap or ram are full. Any help would be greatly appreciated! Thank you.

Tagged:

Answers

  • Answer ✓

    @jonboy12 This looks like an issue with the minim library. Could you add an issue here? (Feel free to tag me, @gohai, so that I can follow along.)

  • Sure, thank you I will add that sometime today.
    I bypassed this problem by creating a processing script that converts those audio files into a custom csv file with the data I need to run my lights. Even so, I think they should probably know about the problem in case somebody else runs into it.

  • For future reference, here is the issue on GitHub: https://github.com/ddf/Minim/issues/65

  • Woops, forgot to link to the GitHub issue. Thank you.

  • On the minim GitHub ddf said that it is a limitation with how audio player is implemented. It requests a direct connection to a low-level output line and some java sound implementations don't have many (see above link for full non butchered answer). He said I can get around this by loading all the mp3 files into a file player all connected to a single audio output and then playing. see link (http://code.compartmental.net/minim/fileplayer_class_fileplayer.html) I don't use mp3s for this anymore, but this may help someone else out with this issue.

Sign In or Register to comment.