0

Here is a small test code that I had running on my RPi 3B+, that plays a sequence of notes, which worked with no issues:

from music21 import midi, stream, converter s = stream.Stream() for i in range(3): # Create a Note (MIDI note 60 is Middle C) note = Note(60+i) # Append the note to the stream s.append(note) sp = midi.realtime.StreamPlayer(s) sp.play() 

Running the same code on my RPi 5, I get the following:

Traceback (most recent call last): File "/home/musicgame/game/midi_test/play_midi.py", line 16, in <module> sp = midi.realtime.StreamPlayer(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/musicgame/game_env/lib/python3.11/site-packages/music21/midi/realtime.py", line 93, in __init__ pygame.mixer.init(mixerFreq, mixerBitSize, mixerChannels, mixerBuffer) pygame.error: ALSA: Couldn't open audio device: Unknown error 524 

I am currently working remotely on the RPi, and I needed to test this to make sure it works. There are currently no HDMI devices connected to the Pi, and no USB to jack device connected (if that helps).

Any ideas on how to resolve the issue?

2
  • Which OS on each device? Which version of pygame on each device? Commented Jan 4, 2024 at 15:58
  • @CoderMike both on bookworm, both pygame 2.5.2. Commented Jan 4, 2024 at 16:05

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.