RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Sound not working with HifiBerry Rapberry Pi 4 with OSMC

    Scheduled Pinned Locked Moved Help and Support
    audio problemsound cardosmcrp4
    11 Posts 2 Posters 662 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      Fantasens
      last edited by

      I installed RetroPie on my Raspberry Pi 4 with OSMC in which I installed a wHifiBerry DAC sound card following the following instructions https://forum.raspiaudio.com/t/audio-installation-guide/19. The card works fine with Kodi but I can't get it to work with RetroPie's.

      osmc@osmc:~$ aplay -l
      
      **** List of PLAYBACK Hardware Devices ****
      card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
        Subdevices: 0/1
        Subdevice #0: subdevice #0
      card 1: Controller [Wireless Controller], device 0: USB Audio [USB Audio]
        Subdevices: 1/1
        Subdevice #0: subdevice #0
      card 2: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
        Subdevices: 1/1
        Subdevice #0: subdevice #0
      
      
      osmc@osmc:~$ aplay -L
      
      null
          Discard all samples (playback) or generate zero samples (capture)
      btaudio
          Bluetooth Audio
      raspiaudio
      default
      sysdefault:CARD=sndrpihifiberry
          snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
          Default Audio Device
      dmix:CARD=sndrpihifiberry,DEV=0
          snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
          Direct sample mixing device
      dsnoop:CARD=sndrpihifiberry,DEV=0
          snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
          Direct sample snooping device
      hw:CARD=sndrpihifiberry,DEV=0
          snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
          Direct hardware device without any conversions
      plughw:CARD=sndrpihifiberry,DEV=0
          snd_rpi_hifiberry_dac, HifiBerry DAC HiFi pcm5102a-hifi-0
          Hardware device with all software conversions
      sysdefault:CARD=Controller
          Wireless Controller, USB Audio
          Default Audio Device
      front:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          Front speakers
      surround21:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          2.1 Surround output to Front and Subwoofer speakers
      surround40:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          4.0 Surround output to Front and Rear speakers
      surround41:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          4.1 Surround output to Front, Rear and Subwoofer speakers
      surround50:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          5.0 Surround output to Front, Center and Rear speakers
      surround51:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          5.1 Surround output to Front, Center, Rear and Subwoofer speakers
      surround71:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
      iec958:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          IEC958 (S/PDIF) Digital Audio Output
      dmix:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          Direct sample mixing device
      dsnoop:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          Direct sample snooping device
      hw:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          Direct hardware device without any conversions
      plughw:CARD=Controller,DEV=0
          Wireless Controller, USB Audio
          Hardware device with all software conversions
      sysdefault:CARD=vc4hdmi
          vc4-hdmi, MAI PCM i2s-hifi-0
          Default Audio Device
      hdmi:CARD=vc4hdmi,DEV=0
          vc4-hdmi, MAI PCM i2s-hifi-0
          HDMI Audio Output
      dmix:CARD=vc4hdmi,DEV=0
          vc4-hdmi, MAI PCM i2s-hifi-0
          Direct sample mixing device
      dsnoop:CARD=vc4hdmi,DEV=0
          vc4-hdmi, MAI PCM i2s-hifi-0
          Direct sample snooping device
      hw:CARD=vc4hdmi,DEV=0
          vc4-hdmi, MAI PCM i2s-hifi-0
          Direct hardware device without any conversions
      plughw:CARD=vc4hdmi,DEV=0
          vc4-hdmi, MAI PCM i2s-hifi-0
          Hardware device with all software conversions
      
      

      with the alsa mixer command I receive the following response with volume at 100 on master:

      Card: snd_rpi_hifiberry_dac                                                                                        F1:  Help               │
      │ Chip:                                                                                                              F2:  System information │
      │ View: F3:[Playback] F4: Capture  F5: All                                                                           F6:  Select sound card  │
      │ Item: Master 
      

      based on this result I made various settings taking Default as Audio Card and Master as Audio device in EmulationStation. I also made other attempts such as HDMI but without success. Does anyone have any idea what the problem is and how to fix it?
      Thank you

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        What exactly doesn't work ? You've only shown what your configuration is and what you've tried, but not the actual problem (i.e. no sound in ES/games/etc/ ?).

        Note that the configuration or Audio card/device in EmulationStation apply only to EmulationStation, they're not global. If alsamixer works, then you might investigate on how to make sndrpihifiberry the default audio card - right now it's set as sysdefault, but default is not set.

        F 1 Reply Last reply Reply Quote 0
        • F
          Fantasens @mitu
          last edited by

          @mitu Thank you for your answer.
          The actual problem is no sound in ES/games/.

          On EmulationStation I tried different Sound Settings configurations:

          Screenshot_5.png

          SYSTEM VOLUME: 100%
          AUDIO CARD: SYSDEFAULT
          AUDIO DEVICE: MASTER
          OMX PLYER AUDIO DEVICE: try it all
          ENABLE NAVIGATION SOUNDS : On
          ENABLE VIDEO AUDIO: On

          But there is no sound from EmulationStation and Games.

          The sound card is connected to an external audio amplifier and the strange thing is that if I run a game and turn off the TV after a few seconds I hear the music from the game. If I turn the TV back on I can't hear anything anymore.

          I don't know why the sndrpihifiberry is configured as sysdefault and not default, I followed these instructions for the configuration: https://www.hifiberry.com/build/guides/enabling-hifiberries-in-osmc/ and I installed the mixer software:

          wget -O - script.raspiaudio.com | bash
          

          as recommended by the manufacturer.

          Now I don't understand how to configure the sndrpihifiberry default sound card on Osmc and whether this could be the problem or whether I'm doing something wrong.

          My current config.txt is:

          [pi4]
          dtoverlay=rpivid-v4l2
          arm_64bit=1
          kernel=kernel.img
          
          [board-type=0x0e]
          dtoverlay=vc4-kms-v3d,cma-256
          
          [all]
          dtoverlay=vc4-kms-v3d,cma-512
          disable_overscan=1
          start_x=1
          disable_splash=1
          disable_fw_kms_setup=1
          hdmi_ignore_cec_init=1
          include config-user.txt
          dtoverlay=hifiberry-dac
          MPG2=0xXXXXXXXX
          
          [pi02]
          dtoverlay=vc4-kms-v3d,cma-256
          
          dtparam=audio=on
          
          

          Thanks in advance...

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            The configuration seems ok - in EmulationStation.

            Do you get any errors in the log or on the console ? Other programs are working ok - i.e. speaker-test or vlc / mpv ?

            F 1 Reply Last reply Reply Quote 0
            • F
              Fantasens @mitu
              last edited by

              @mitu
              in the log or on the console es_log.txt Once I launch a game I find this error:

              Jan 16 08:41:38 lvl2: 	Attempting to launch game...
              Jan 16 08:41:39 lvl2: 		/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ snes /home/osmc/RetroPie/roms/snes/Donke\ Kon\ Country\ \(U\)\ \(V1.2\)\ \[\!\].zip
              Jan 16 08:42:06 lvl2: 	Creating window...
              Jan 16 08:42:06 lvl2: 	Created window successfully.
              Jan 16 08:42:06 lvl2: 	GL vendor:   Broadcom
              Jan 16 08:42:06 lvl2: 	GL renderer: VC4 V3D 2.1
              Jan 16 08:42:06 lvl2: 	GL version:  2.1 Mesa 18.3.6
              Jan 16 08:42:06 lvl2: 	Checking available OpenGL extensions...
              Jan 16 08:42:06 lvl2: 	 ARB_texture_non_power_of_two: ok
              Jan 16 08:42:06 lvl2: 	Added known joystick Sony Interactive Entertainment Wireless Controller (instance ID: 48, device index: 0)
              Jan 16 08:42:07 lvl2: 	Added known joystick Sony Interactive Entertainment Wireless Controller (instance ID: 48, device index: 0)
              Jan 16 08:42:39 lvl2: 	 req sound [basic.launch]
              Jan 16 08:42:39 lvl2: 	   (missing)
              

              with speaker-test 1.1.8 I get:

              
              speaker-test 1.1.8
              
              Playback device is default
              Stream parameters are 48000Hz, S16_LE, 2 channels
              WAV file(s)
              Rate set to 48000Hz (requested 48000Hz)
              Buffer size range from 128 to 131072
              Period size range from 64 to 65536
              Using max buffer size 131072
              Periods = 4
              was set period_size = 32768
              was set buffer_size = 131072
               0 - Front Left
               1 - Front Right
              Time per period = 0.733552
               0 - Front Left
               1 - Front Right
              Time per period = 2.735505
               0 - Front Left
               1 - Front Right
              Time per period = 3.408234
               0 - Front Left
               1 - Front Right
              Time per period = 2.735147
               0 - Front Left
               1 - Front Right
              Time per period = 3.405919
              
              

              from the mixer interface I see the following Tab:

              mixer.png

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @Fantasens
                last edited by

                @Fantasens said in Sound not working with HifiBerry Rapberry Pi 4 with OSMC:

                in the log or on the console es_log.txt Once I launch a game I find this error:

                That's not an error, they're normal logging messages.

                with speaker-test 1.1.8 I get:

                OK, so no error, but do you hear the test patterns ?

                F 1 Reply Last reply Reply Quote 0
                • F
                  Fantasens @mitu
                  last edited by

                  @mitu said in Sound not working with HifiBerry Rapberry Pi 4 with OSMC:

                  with speaker-test 1.1.8

                  With speaker-test 1.1.8 I only hear the sound if I turn off the TV.

                  I believe sound comes out of the sound card only when TV is off.

                  SoundCard_Osmc.png

                  When the tv is turned on it seems that OSMC KODI only uses "vc4-Hdmi".
                  I tried to configure the sound card but with the TV turned On I can't hear anything anymore.

                  There must be a configuration problem but I can't figure out how to exclude HDMI audio when the TV is on and use soundard card.

                  1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator
                    last edited by mitu

                    Try making the HifiBerry the default card by adding to $HOME/.asoundrc:

                    pcm.!default {
                        type hw
                        card 1
                    }
                    
                    ctl.!default {
                        type hw           
                        card 1
                    }
                    

                    See if speaker-test outputs directly on the HifiBerry.

                    F 1 Reply Last reply Reply Quote 0
                    • F
                      Fantasens @mitu
                      last edited by

                      @mitu I tried but it doesn't work,
                      with the TV turned On the audio can only be heard with vc4-Hdmi settings with the TV turned off however it also works configured as snd_rpi_ hifiberry_dac.

                      I don't understand what causes it...

                      1 Reply Last reply Reply Quote 0
                      • F
                        Fantasens
                        last edited by

                        Hi, I carried out further investigations and discovered that if I disconnect the optical connection that goes from the TV to the amplifier the audio can be heard correctly even with this setting:

                        Fig4.png

                        In my configuration the TV is connected with an HDMI cable to the Raspberry and with an optical cable to the audio amplifier (to hear the TV audio on the amplifier when I am not using the Raspberry).

                        On the Raspberry the sound card output is connected to the amplifier (to hear audio on the amplifier) ​​.

                        Now when I use Kodi the audio comes out both from the TV and from the Raspberry sound card and I have to lower the TV audio to 0 so as not to hear the sound from both the TV speakers and the amplifier.

                        Now I noticed that when I launch retropie to hear the sound with TV turned on I have to disconnect the optical cable.

                        Is there no way to configure Retropie so that it behaves like Kodi by playing audio from both the TV and the Audio card?

                        mituM 1 Reply Last reply Reply Quote 0
                        • mituM
                          mitu Global Moderator @Fantasens
                          last edited by mitu

                          @Fantasens said in Sound not working with HifiBerry Rapberry Pi 4 with OSMC:

                          Is there no way to configure Retropie so that it behaves like Kodi by playing audio from both the TV and the Audio card?

                          'RetroPie' - or rather EmulationStation - uses ALSA. If you can configure ALSA so that it behaves like Kodi with the default card/output, then EmulationStation - and probably emulators - are going to work the way you want.

                          The only configuration for ALSA that RetroPie does is the one from the Audio menu, where you can choose between the audio outputs present on a Pi - Analog/HDMI. For more complex configuration you'll need to configure ALSA yourself.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.