Raspberry Pi 4

For information, Recalbox IS NOT compatible with Raspberry Pi 4 yet.
Pour information, Recalbox N'EST PAS encore compatible avec le Raspberry Pi 4.

The Recalbox Team.

no sound for splash videos - change omxplayer audio device to Alsa (Recalbox 6.0)



  • Hi,

    I use a USB Audio device attached to my Pi 3b+ and it works fine for Emulationstation and emulators. However, I'm not getting sound from the Splash intros.

    I googled around on the issue and found that something similar was the case for retropie and they suggested to change omxplayer output to ALSA.

    I found the file S02Splash in the recalbox folder structure and wanted to change:

    omx_opt="--adev both --no-keys --layer=10000 --aspect-mode=fill"

    To:

    omx_opt="--adev alsa --no-keys --layer=10000 --aspect-mode=fill"

    However, I'm not using the correct syntax as on reboot the videos will now be skipped instead.

    I also tried "--adev alsa:hw:0,0" and "--adev alsa:hw:1,0" but its still not the right syntax...

    Does anyone know how to set the correct value here?

    Thanks and best
    Gregor


  • Staff
    Moderator
    Creator
    Team

    @teufelskrapfen check your hardware with aplay -l and test use -o alsa:hw:1,0 to get sound on the second card first device



  • @ian57 Thanks for your answer.

    It seems "aplay" is not present on my build but I just got a little further with my testing:

    I stopped emulationstation and started a video via an SSH connection:

    omxplayer --adev alsa:hw:0,0 /recalbox/system/resources/splash/recalboxintro.mp4

    Now the video plays fine on my Pi with sound … I also tried --adev alsa:hw:1,0 and then there was no sound … so hw:0,0 seems to be the correct device...

    If I add --adev alsa:hw:0,0 to S02Splash, the pi will boot with no splash intros. To confirm that my config file is not broken I changed the option back to --adev both and rebooted, then the splash intros will show up again without sound.


  • Staff
    Moderator
    Creator
    Team

    @teufelskrapfen yes my bad, I forgot!!! we added some code to swith internal device and usb when present to put the USB audio as first device. So alsa:hw:0,0 is the right device when booted. Can you add --adev alsa:hw:1,0 to S02Splash and reboot
    If no sound, I think the video is played too early alsa is not ready yet. You'll need to move S02Splash to S13Splash for example... but the video will be played later



  • @ian57 Thanks I tried --adev alsa:hw:1,0 and got no sound, but the video was playing.

    I moved S02Splash to S13Splash with --adve alsa:hw:0,0 and it kind of works:

    The video plays now with sound after some some delay, but back in emulationstation the menu music would not work anymore.

    I also tried S03Splash, S08Splash, … and so on but the outcome would not improve. Either the intro splash would not play or it would play but then there was no Emulationstation music.


  • Staff
    Moderator
    Creator
    Team

    @teufelskrapfen after ES is started, can you go the sound config menu and select another audio device, exit, return in the sound config menu and select you usb device again.



  • @ian57 yes that works... as soon as I select a different audio device, the music plays again.

    Also (without doing the above) when I start a game and return to Emulationstation, the music will play again as well.


  • Staff
    Moderator
    Creator
    Team

    @teufelskrapfen ok, I think the problem comes from the delayed playing... the video is not finished when /etc/init.d/S26recalboxsystem is runned aand configure the sound for ES. As omxplayer uses the sound output, I think that the function rb_volume_configure ; rb_audio_configure do not finish succesfully... I think a workaround is to put audio configuration later for example in S99Custom



  • @ian57 Thanks I made backups of the files, then tried to copy / move the functions to S99Custom but didn't get it to work. Do you have a suggestion what parts of the script need to be copied/moved or what parts need to be present in S99Custom?

    I restored my backups and also temporarily renamed S26recalboxsystem to S99recalboxsystem, but this also didnt work.

    I was thinking of a workaround: maybe I can add a line to S13Splash that after the video has finished, the the output will be toggled to i.e. HDMI and immediately back to USB Audio.


  • Staff
    Moderator
    Creator
    Team

    create the file /recalbox/share/system/custom.sh and put the following in it. try to run it through SSH before, to see if it works :

    #!/bin/bash
    
    systemsetting="recalbox_settings"
    config_script=/recalbox/scripts/recalbox-config.sh
    
    rb_volume_configure() {
        settingsVolume="`$systemsetting -command load -key audio.volume`"
        if [ "$settingsVolume" != "" ];then
    	recallog "setting audio volume to $settingsVolume"
            eval $config_script "volume" "$settingsVolume" 2>&1 | recallog
        fi
    }
    
    rb_audio_configure() {
        recallog "Restoring ALSA mixers configuration"
        alsactl -f /recalbox/share/system/configs/asound.state restore
        settingsAudio="`$systemsetting -command load -key audio.device`"
        if [[ "$settingsAudio" == "" ]];then
            settingsAudio="auto"
        fi
        recallog "setting audio to $settingsAudio"
        eval $config_script "audio" "$settingsAudio" 2>&1 | recallog
    }
    
    ( rb_volume_configure ; rb_audio_configure ) &  # 1.0
    


  • @ian57 Thanks and sorry for my late answer.

    For the script to run I had to change

    systemsetting="recalbox_settings"

    to

    systemsetting="python /usr/lib/python2.7/site-packages/configgen/settings/recalboxSettings.pyc"

    I put S02Splash to S13Splash and added --adev alsa:hw:0,0

    But I would only get sound from the splash intro but no music in Emulationstation.


  • Staff
    Moderator
    Creator
    Team

    @teufelskrapfen ok that's strange, did you test the S99custom alone to see if it is working. I made this thing in blind..; so perhaps I missed something.



  • @ian57 sorry havent got around testing it again but will try with S99custom this evening.

    So I would:

    • rename to S13Splash and add "--adev alsa:hw:0,0"
    • copy/paste your text into S99custom
    • do I need remove anything from S26recalboxsystem ?


  • OK so I copy-pasted the text below into S99custom, but its the same behavior as before (splash screen has sound, emulationstation no sound). Do you know the command to trigger the output-device change? I.e. from USB Audio to HDMI … would like to try something

    #!/bin/bash

    test -e "/recalbox/share/system/custom.sh" && /recalbox/share/system/custom.sh $1

    systemsetting="python /usr/lib/python2.7/site-packages/configgen/settings/recalboxSettings.pyc"
    config_script=/recalbox/scripts/recalbox-config.sh

    rb_volume_configure() {
    settingsVolume="$systemsetting -command load -key audio.volume"
    if [ "$settingsVolume" != "" ];then
    recallog "setting audio volume to $settingsVolume"
    eval $config_script "volume" "$settingsVolume" 2>&1 | recallog
    fi
    }

    rb_audio_configure() {
    recallog "Restoring ALSA mixers configuration"
    alsactl -f /recalbox/share/system/configs/asound.state restore
    settingsAudio="$systemsetting -command load -key audio.device"
    if [[ "$settingsAudio" == "" ]];then
    settingsAudio="auto"
    fi
    recallog "setting audio to $settingsAudio"
    eval $config_script "audio" "$settingsAudio" 2>&1 | recallog
    }

    ( rb_volume_configure ; rb_audio_configure ) & # 1.0



  • @teufelskrapfen

    Hi,

    I had the same issue with my system and your post gave me an idea.
    In the latsest version of recalbox (6.1), I did this:

    • go to /etc/init.d
    • enter command: mount -o remount,rw /
    • open file splash03
    • change line 88 as follows:

    omx_opt="--adev both --no-keys --layer=10000 --aspect-mode=fill"
    omx_opt="--adev local --no-keys --layer=10000 --aspect-mode=fill"

    • save

    Actually, "adev" must be followed by one these options: hdmi/local/both.

    Hope it might help.



Want to support us ?

144
Online

62422
Users

18672
Topics

140224
Posts

Looks like your connection to Recalbox Forum was lost, please wait while we try to reconnect.