adangert / JoustMania

Raspberry Pi Jousting at its finest
http://joustmania.com
Other
124 stars 35 forks source link

No Music - alsaAudioError: Device or resource busy [default] #336

Open poke50uk opened 2 months ago

poke50uk commented 2 months ago

I've set up a fresh Pi5 with Raspberry Pi OS just for this project today. The Pi is connected via HDMI to a TV which outputs audio fine when asked.

I'm still running with the TV connected, and cannot get the game music to work at all. The VO SFX also don't trigger, unless I switch to using a Bluetooth speaker and back (it's intermittent). So it sometimes gives me VO fine when I mess with it, but doesn't matter what I do, which includes manually closing JoustMania, restarting asla audio, and restarting JoustMania, I still get the same error and no music.

Don't want to mess with the Pi at the mo, so did a lazy photo rather than a screenshot to share while I type this up on my desktop.

20240911_122109

Note that this is for a kids birthday party this Saturday (because we couldn't get SportFriends to work any more! ) so it'll be great to get at least some work around asap. FYI pads and gameplay work fine, but is really hard without music.

adangert commented 2 months ago

Hi! You should get a USB to aux converter and try that, it's how joustmania is officially supported for audio on the pi5: https://a.co/d/1S6CbKM

Then rerun sudo ./setup.sh

poke50uk commented 2 months ago

Yes, that's arriving tomorrow - but I'll be using the TV as output over HDMI. Are you saying that what ever specific method that's being used requires an aux to be present regardless of hardware or the actual output being used? Because that sounds like a very strange limitation.

poke50uk commented 2 months ago

BTW - I did also try adding a secondary audio output of a Bluetooth speaker - as we may end up using a Bluetooth speaker we have for this party. Foresee any issues with being able to get the audio out to that on Saturday if this USB Aux hack works?

adangert commented 2 months ago

Yeah it's a bit of a limitation, but that's somewhat due to some of the more difficult aspects of the joustmania audio stack speeding up/slowing down music; I've seen it have some crackling sound on different interfaces, so for right now it's just targeting specific hardware.

I've just opened an issue to try and get it working on HDMI output in the future!

adangert commented 2 months ago

BTW - I did also try adding a secondary audio output of a Bluetooth speaker - as we may end up using a Bluetooth speaker we have for this party. Foresee any issues with being able to get the audio out to that on Saturday if this USB Aux hack works?

I know it sounds wonky, but the best bet, and the way we've been able to get Bluetooth audio to work right now is with an aux -> Bluetooth adapter, that is plugged into the usb->aux adapter

https://a.co/d/3Voexy9

I'll also open an issue to try to resolve this for the future!

poke50uk commented 2 months ago

Fortunately I already have one of those somewhere due to having a old car stereo I modded at some point. I'll keep it in mind. My Bluetooth speakers also have an aux in, just have to make sure I have the cable around somewhere too I guess for now.

poke50uk commented 2 months ago

Can confirm that the aux allows music and sfx to work. Audio is very quiet out the aux when I select my output to be via HDMI in PiOS, and nothign was heard out the TV. Switching to Aux as a output in PiOS makes the audio levels music louder.

egburr commented 2 months ago

I had this exact problem. I finally solved it when I found some references to setting up /etc/asound.conf with the correct values. But what got me working was finding in JoustMania/conf/asound.conf the exact configuration I needed. Once I copied that to /etc/asound.conf and restarted joust, I have music!

Raspberry Pi 5 Argon ONE V3 M.2 NVME PCIE Case Argon BLSTR DAC with Ground Loop Isolator

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 [HiFiBerry DAC+ HiFi pcm512x-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

(Card 2, Device 0)

Strangely, the JoustMania/conf/asound.conf already had the right card number configured, which surprised me. "card 2" and "hw:2,0" so I didn't even have to modify it when copying it to /etc/asound.conf.

egburr commented 2 months ago

To make searching easier, here is a text version of the original post's error message photo.

Traceback (most recent call last):
  File "/usr/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/egburr/JoustMania/piaudio.py", line 140, in audio_loop
    device = alsaaudio.PCM(channels=wf.getnchannels(), rate=wf.getframerate(), \
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
alsaaudio.ALSAAudioError: Device or resource busy [default]