Open rsn8887 opened 3 months ago
This sounds like a hardware problem. A few of us have RPI4's & there are no such issues.
Thanks for replying.
I am trying to find out what it could be, but I am at a loss.
One time yesterday after audio was dropping out, the system settings audio option only showed some kind of ALSA device which was never there before. After a re-boot, it showed the usual HDMI options. How can this be? Why would the displayed options change?
One thing I did was force HDMI video out to 1920x1080@60 Hz, instead of auto, but it didn't help with the HDMI audio issues.
I am using preview videos in the system view in the CKAO books theme, and menu background music is also enabled (video preview music is disabled). The menu background music makes it easy to spot this issue, but it also happens if I disable background music and only use menu navigation sounds.
After some more testing, it seems as if the audio goes silent mostly when I switch systems and a new system or game preview is starting to play, but not always. It is as if the audio drops out whenever a lot is happening in the menu (switching systems pictures fast, new preview video starting to play).
Sometimes the audio only drops out for a split second then comes back, sometimes it just has a very short pop or scratch in the menu background music, and it seems to happen during transitions between different previews in the menu.
Then after browsing the menu some more, HDMI audio goes completely silent, a little bit later.
It doesn't go silent ever if I do nothing in the menu, the problem appears only if I actually browse the menu via dpad up/down, and especially when I browse fast. It feels as if the CPU is getting bogged down causing audio to drop out and eventually go silent completely? I don't really know.
I am not 100% sure, but it seems the issue happens more often if I use a Bluetooth paired controller instead of wired controller via USB. It happens in both cases eventually after browsing the menu for a minute or so.
Is there maybe some audio buffer bug that happens when the system is loading preview videos from the micro SD card at the same time as loading/playing background music or other sound data? But why would it go completely silent and not come back on its own?
Here's some more info from ssh'ing into Batocera:
Model: Raspberry_Pi_4_Model_B_Rev_1_2 System: Linux 6.1.73-v8 Architecture: aarch64 Board: bcm2711 CPU Cores: / CPU Threads: 4 CPU Max Frequency: 1500 MHz Temperature: 47°C Available Memory: 2272/3793 MB Display Resolution: 1920x1080 Display Refresh Rate: 60.000Hz
OS version: 39f 2024/02/28 12:22
I checked that my /media/BATOCERA/cmdline.txt and config.txt are the same as https://github.com/batocera-linux/batocera.linux/tree/f6977726e931eed101ffd32cfacb4fb260baeb8b/board/batocera/broadcom/bcm2711/boot
(which makes sense since they are read-only and I never manually tried to change them)
Stock GUI theme is ok?
This is the output of pw-top after audio goes silent:
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
S 28 0 0 --- --- --- --- 0 Dummy-Driver
S 29 0 0 --- --- --- --- 0 Freewheel-Driver
S 38 0 0 --- --- --- --- 0 Midi-Bridge
S 48 0 0 --- --- --- --- 0 alsa_output.platform-bcm2835_audio.stereo-fallback
R 32 1024 48000 527.9us 505.0us 0.02 0.02 1 S32P 2 48000 alsa_output.platform-fef05700.hdmi.hdmi-stereo
R 55 4096 44100 70.8us 392.4us 0.00 0.02 0 S16LE 2 44100 + alsa_playback.emulationstation
R 65 1764 44100 93.5us 378.6us 0.00 0.02 0 F32LE 2 44100 + alsa_playback.emulationstation
The err number goes up from 0 to 1 while I change my selection in the ES menu, and from then on, audio in ES is silent. As long as err stays at 0, everything is fine.
How can I prevent that? And why doesn't it resolve itself afterwards?
Also I noticed that every time I switch system, when the new system preview video is starting to play, the old alsa_playback entry after "+" is removed and a new alsa_playback entry is created in pw-top with a "+" sign. When I browse the menu, this happens very quickly.
Stock GUI theme is ok?
Yes, but the stock GUI theme doesn't show system videos when switching systems for me, so I think it might be much less taxing on the system?!
The ckao-books theme, where the problem occurs for me, seems to use more computing power, at least with system videos enabled. I would be fine with a little crackle or stutter in the audio, as long as it doesn't go silent completely.
You should look at an overclock depending on your cooling if you want to have a smoother experience with busy themes.
Here's an example video of what happens in pw-top when I browse systems with system videos enabled in ckao-book (it happens immediately at the beginning of this movie when it jumps from err=0 to err=1, because I was a bit slow to hit record):
And here's a representative example what it looks like on my screen when I browse systems. This is the activity that causes HDMI audio to go silent. But this is not the exact moment when audio drops out, just a representative example of what I do that eventually causes it:
You should look at an overclock depending on your cooling if you want to have a smoother experience with busy themes.
Thanks, I might try that at some point since I already have a fan.
But right now, I don't really need a smoother experience, I think my experience is already super smooth in my opinion (definitely smooth enough for menu browsing and playing games).
I would just like my audio to stay on consistently and not go completely silent forever (basically crash), requiring me to manually switch to headphones port and back to HDMI in system settings to make it come back.
Once the audio goes silent in the menu (err=1 in pw-top), it stays silent also in all games.
I updated the title to make the issue clear.
I just tried overclocking to 1750 MHz. Now menu navigation is super smooth visually, even smoother than before. But the audio problem remains exactly the same.
Is there some bug with Emulationstation? There appears no need for a new ALSA line to pop up in pw-top whenever I switch systems in the menu and a new video starts playing. The preview videos shouldn't need any sound at all since I disabled the preview video sound. It seems the err in pw-top appears in the thread related to the preview video, and then it is "promoted" to the main audio process causing everything to go silent. It definitely feels like a bug.
CKAO-book is not particularly busy, compared to other themes people are using on their Raspberry Pi 4's.
It seems this might be related to a known problem, because the err number in pw-top is discussed briefly on the wiki, but in the context of games, not ES, and there's no real solution that would apply for ES: https://wiki.batocera.org/audio_issues#my_audio_is_consistently_cutting_out_irrelevant_of_what_my_system_is_doing
I tested the CKAO-Book , at stock 1500MHz, no issues.
Are you sure your version of CKAO-Book included the system video files. I think you need the system video pack here in addition to ckao-book to reproduce: https://github.com/CkauNui/ckau-book-addons-Colorful-Video
After installation of the system videos, you should have 420 video files in /themes/ckau-book-addons/_inc/anim/video.
Then your ES will play the system videos like in my video, which leads to the audio problem (even when video sounds are disabled).
I updated the original issue to include the need of the video add-on pack to reproduce.
I just tested again, and I had to go up through the system list for about 1 minute, playing about 80 system videos, then HDMI audio become silent.
Second test: going up through the systems at about 1 system per second, after 30 systems and corresponding videos, the HDMI audio became silent.
I wish somebody else could reproduce this. My Rpi4 was new in shrink wrap, so I don't think my hardware is broken.
Try 2.2GB of video files! Still cannot duplicate. Audio doesn't skip a beat.
Ok well thanks for checking. I will try to debug my hardware then.
Ok I updated to latest Butterfly beta and the audio is much better. Audio crackles occasionally in ES and sometimes goes away for a second if I switch systems fast, but now it comes back by itself! The err reported in pw-top also behaves different: it increases from 0 to 1 when the sound drops out, like before. But then after approximately one second err increases to 2 and the sound comes back. When the sound again drops out and later comes back, err keeps increasing from 2 to 3, to 4 and so on.
This is much better, because I don't have to manually switch to headphones and back to HDMI anymore to force the audio to come back.
The process name in pw-top is also different. Instead of alsa_output.platform-fef05700.hdmi.hdmi-stereo
it is now alsa_output._sys_devices_platform_soc_fef05700.hdmi_sound_card2.hdmi-stereo
The audio device name in ES System Settings is also different. Now it is called BUILT-INAUDIO DIGITAL STEREO (HDMI)
what is in batocera.conf for audio.device
?
After updating to Butterfly and setting the audio output in System Settings it is currently:
audio.device=alsa_output._sys_devices_platform_soc_fef00700.hdmi_sound_card1.hdmi-stereo
(I switched HDMI ports in my testing, but it made no difference)
Entering batocera-audio list
gives this for me on v40 butterfly:
auto auto
alsa_output._sys_devices_platform_soc_fe00b840.mailbox_bcm2835_audio_sound_card0.stereo-fallback Built-in Audio Stereo
alsa_output._sys_devices_platform_soc_fef00700.hdmi_sound_card1.hdmi-stereo Built-in Audio Digital Stereo (HDMI)
[root@BATOCERA /userdata/system]# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 2: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
[root@BATOCERA /userdata/system]# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 2: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
[root@BATOCERA /userdata/system]# aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
oss
Open Sound System
pipewire
PipeWire Sound Server
upmix
Plugin for channel upmix (4,6,8)
vdownmix
Plugin for channel downmix (stereo) with a simple spacialization
default
Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=Headphones
bcm2835 Headphones, bcm2835 Headphones
Default Audio Device
sysdefault:CARD=vc4hdmi0
vc4-hdmi-0, MAI PCM i2s-hifi-0
Default Audio Device
hdmi:CARD=vc4hdmi0,DEV=0
vc4-hdmi-0, MAI PCM i2s-hifi-0
HDMI Audio Output
sysdefault:CARD=vc4hdmi1
vc4-hdmi-1, MAI PCM i2s-hifi-0
Default Audio Device
hdmi:CARD=vc4hdmi1,DEV=0
vc4-hdmi-1, MAI PCM i2s-hifi-0
HDMI Audio Output
Maybe my problem is that my user data is on the same MicroSD card as the OS?
Maybe my problem is that my user data is on the same MicroSD card as the OS?
Very normal. Try a new / faster SDcard.
Hi, same problem. rpi 4, stock theme, batocera 39 stable. After a while of browsing through the interface, launching games, and then exiting, it seems that ALSA crashes. So i change/switch profile audio only, then it works. After a while, another crash. After the crash, I also notice that the audio device switches from "hdmi..outpout..." to "alsa_playback....".
Hi, same problem. rpi 4, stock theme, batocera 39 stable. After a while of browsing through the interface, launching games, and then exiting, it seems that ALSA crashes. So i change/switch profile audio only, then it works. After a while, another crash. After the crash, I also notice that the audio device switches from "hdmi..outpout..." to "alsa_playback....".
It is good to hear that I am not the only one with these problems.
I have since updated to a Raspberry Pi 5 and it doesn't exhibit this problem. Only the Raspberry Pi 4 seems to have this issue, at least from my experience so far.
I don’t have the “silent audio” issue (so i don’t think alsa is crashing in my config) - what I am experiencing in v39 is on boot, audio comes through internal speakers and i have to go into settings and do a toggle (much like you do) and the sound comes out through HDMI again. reboot, rinse and repeat.
I do not think it’s hardware related as I have a few Batocera instances where this behavior does not happen. This happened to me very early on in v35 and the issue has been dormant until today so I’m not surprised it’s hard to reproduce.
I’m going to put two system directories side-by-side and flip flop between them to see if I can isolate the difference.
Just thought I’d put another data point out there - it may or may not be related to this issue.
EDIT: ok good news is I’m able to reproduce the issue in v40-dev flip flopping back and forth between two system directories. I did a diff and it’s not clear what the difference is yet. Since my issue is not related to “silent audio” I will file a separate issue and make mention of this one.
hey just thought I’d share the workaround Im using for my audio toggle issue - I don’t know if it is related but it case it helps someone out…
In my specific scenario, a user-defined batocera-service changed the audio driver version mid-stream (3.0 -> 3.0.5) so the audio sub-system just needed a reboot to use what is the correct version (3.0.5) already specified in batocera.conf
about 30 seconds after the service is done initializing.
sleep 30
batocera-audio set `batocera-audio get`
you can read all the gory details how I figured this out here if it helps
Hi, same problem. rpi 4, stock theme, batocera 39 stable. After a while of browsing through the interface, launching games, and then exiting, it seems that ALSA crashes. So i change/switch profile audio only, then it works. After a while, another crash. After the crash, I also notice that the audio device switches from "hdmi..outpout..." to "alsa_playback....".
It is good to hear that I am not the only one with these problems.
I'm also having this issue and I have no idea how to fix it lol
I've put months into this build and this one issue is really cramping and putting a damper on the whole build.
Did you ever find a fix?
hey just thought I’d share the workaround Im using for my audio toggle issue - I don’t know if it is related but it case it helps someone out…
In my specific scenario, a user-defined batocera-service changed the audio driver version mid-stream (3.0 -> 3.0.5) so the audio sub-system just needed a reboot to use what is the correct version (3.0.5) already specified in
batocera.conf
about 30 seconds after the service is done initializing.sleep 30 batocera-audio set `batocera-audio get`
you can read all the gory details how I figured this out here if it helps
Hi there! Do you have that script? Or where do I put it if I create it myself? I'm hoping it fixes my problem, same as OP.
Update: I have tested 4 TVs and 3 out of the 4 exhibit this exact issue. One TV works perfectly. So that's good. The good news is, it CAN work correctly... just keep swapping TVs until you find one that works. 😆😁 Good enough workaround for me.
glad you found an acceptable workaround :)
Do you have that script? Or where do I put it if I create it myself? I'm hoping it fixes my problem, same as OP.
this is just a fancier version of the above:
#!/bin/sh
log=/userdata/system/logs/restartBatoceraAudio.log
seconds=0 # "now"
# https://stackoverflow.com/a/3063887/9983389
if [ ! -z "$1" ]; then
seconds=$1
fi
echo -n "restartBatoceraAudio: sleeping $seconds: " >> $log
date >> $log
sleep $seconds
driver=`batocera-audio get`
batocera-audio set $driver >> $log 2>&1
echo -n "restartBatoceraAudio: restarted audio ($driver): " >> $log
date >> $log
Script aside, it is more important to go onto the command line and verify that the output:
batocera-audio get
is in your list of available drivers:
batocera-audio list
if it’s not, then what you have in batocera.conf
needs to be updated.
if it is and restarting audio doesn’t work, then I guess you will have to fallback on your monitor swap workaround 😄
Batocera build version
39 stable
Your architecture
Raspberry Pi 4
Your Graphic Processor Unit(s) (GPU)
Raspberry Pi 4
Issue description
If I move through the system or game selection for a minute or so, HDMI sound output stops. It is then silent both in menu and in games.
The only way to get HDMI audio back is by selecting System Settings->Hardware->Audio and selecting the headphone out, going back, then going forward again and re-selecting the HDMI audio out.
Detailed reproduction steps
Install the CKAO-Book theme AND the system video add-on pack from here: https://github.com/CkauNui/ckau-book-addons-Colorful-Video
Select HDMI audio out.
Enable video preview sounds or background music.
Navigate through the system selection for a while, selecting various systems for ten seconds or so.
Notice audio stops completely.
Go to System Settings, switch audio from HDMI to headphone out, go back, then switch audio to HDMI again, and exit the menu.
Observe HDMI works again.
Move between different system or game selections for ten or so seconds and observe audio going completely silent again.
Details of any attempts to fix this yourself
I tried all the possible HDMI audio settings as well as HDMI audio profile combinations, the problem remains.
Details of any modifications you have made to Batocera.
None.
Logs and data
I have no logs.