Issue with loading new sound into existing ofSoundPlayer object (RPi)

I want to play a list of audio files, I create a single ofSoundPlayer object and load a file. When the file is done playing, I unload it and want to load a new file into the same object but oF is throwing me an error:

[ error ] ofOpenALSoundPlayer: loadSound(): couldn't create stereo buffers for "/home/pi/openFrameworks/apps/myApps/myPlayer/bin/content/zDistortion_Wave_04.wav": 40964 AL_INVALID_OPERATION

The file is definitely not the issue, the first file always plays fine the second gets this error, switching the files produces the same result.

Here a snippet of my setup:

ofSoundPlayer audio;

void ofApp::update(){

    if (playlistNumber>playlist.filePath.size()-1)
        playlistNumber = 0;
        cout << "Playlist reset"<< endl;
    if (!itemLoaded){
            cout << "Loading audio..."<< playlist.filePath[playlistNumber] << endl;
            itemLoaded = true;

void ofApp::draw(){

        if (audio.getIsPlaying())
            cout << "Playing audio..."<< playlistNumber << " of " << playlist.filePath.size() <<endl;
            audioImg.draw(0, 0);
            itemLoaded = false;

It then skips this file (I show some other non audio stuff from the playlist) and then it goes back to the first (successfully) played audio file and throws this error instead:

[ error ] ofOpenALSoundPlayer: loadSound(): couldn't create stereo buffers for "/home/pi/openFrameworks/apps/myApps/myPlayer/bin/content/Intro.mp3": 40961 AL_INVALID_NAME

Any ideas what is going wrong here? I’m really puzzled about this, especially the two different error messages for the seemingly same issue.

Edit: Seems the second error is resolved by unloading the sound in update, maybe I tried to play before unloading but the first error is still persistent which is now even weirder. I can load and unload the first file I loaded but not any other file.

Update now looks like this:

if (audio.isLoaded()) audio.unloadSound();
cout << "Loading audio..."<< playlist.filePath[playlistNumber] << endl;

Hi @Prof_Sparkles!! Any update about this issue? I have exactly this problem trying to play an Mp3 playlist locally in the Rpi.


I solved this issue loading the sound with streaming like this: sound.loadSound(fileName, true)

From the OF documentation:

If you set the optional 'bool stream' argument to true the file will be streamed from disk instead of being completely loaded into memory. It makes a lot of sense to stream files if you are dynamically loading large sound files into your program, which would normally cause the program to freeze for a short time as the whole sound is read into memory.

Right! I totally forgot about this. This is the same solution I used to solve my issue. Works perfectly.