• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

Trying to get USB audio device working with RetroPie Zero mame4all

Scheduled Pinned Locked Moved Help and Support
retropiemame4allusb audio
3 Posts 2 Posters 343 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.
  • M
    Myndale
    last edited by Myndale 27 Aug 2023, 09:14

    Hi everyone,

    I've been struggling all weekend trying to get a USB audio device working with RetroPie on my Pi Zero, would really appreciate any help.

    • Pi Model: Raspberry Pi Zero A+
    • RetroPie Version: 4.8 (retropie-buster-4.8-rpi1_zero.img.gz)
    • Built From: Pre made SD Image on RetroPie website
    • USB Devices connected: USB audio device (see below)
    • Emulator: mame4all

    The device in question is a USB speaker with built-in audio card. I've removed the onboard audio device in config, so this is the only device that appears in response to "aplay -l". As far as I can tell it's working absolutely fine with emulationstation, I can navigate through the menu and hear the feedback notification clicks loud and clear. I've got the mixer set to PCM in sound settings, since that's all it supports, and I don't see any errors reported when I launch terminal apps (which I usually will see when config is incorrect).

    The problem is getting mame4all to use it. Every time I try to launch a game, either through emulationstation or manually on the command line, I get the following error:

    ALSA lib pcm.c:8521:(snd_pcm_set_params) Rate doesn't match (requested 44100Hz, get 48000Hz)
    

    If I go to mame.cfg and change the samplerate to something lower (e.g. 22000) then the "requested" number above will change to whatever I've set, but it won't go past 44100Hz. Anything I set higher than that, including 48000, reports in the error that it's still requesting 44100, it's as if something has fixed that value as the maximum upper limit. And this is true regardless of whether I edit the config file or launch it manually and pass it in as a command line option. I decided to test the device's playback rate with speaker-test:

    speaker-test -c 2 -r 48000 -D hw:0
    

    This works fine for 48000 but fails for all other sample rates. To make matters even more confusing (for me, at least), it will play back at any rate I choose if I set the device name to plughw:0 instead, but if I set the device to plughw in emulationstation then sound breaks there and it reports that it's an invalid CTL.

    To see if there was a problem with the device itself I tried using a different one that was USB to headphone/mic jacks. The only real difference I can see with this device is that the mixer type has to be set to SPEAKER. This device can, however, do a successful speaker-test at any sample rate I choose. And again, the device works fine in emulationstation. I was originally getting the same rate mismatch error for this device as I was getting for the first one, until I edited /usr/share/alsa/also.conf:

    defaults.pcm.dmix.rate 44100 # <-- was set by default to 48000

    This caused mame4all to run with the second device absolutely fine! Still no change with the first one though, I can only assume it's due to the different mixers in use?

    I've pretty-much hit a wall here. Worst case scenario is I'll buy some powered speakers or something to use with the second USB device, but I'd really like to get the first one working if at all possible.

    1 Reply Last reply Reply Quote 0
    • M
      mitu Global Moderator
      last edited by 28 Aug 2023, 07:09

      AFAIK the RPI mame4all fork has some hardcoded values w.r.t. ALSA devices and may not work with an 'unknown' audio card. Try using lr-mame2000 (the Libretro core), the romsets should be compatible.

      M 1 Reply Last reply 2 Sept 2023, 00:42 Reply Quote 0
      • M
        Myndale @mitu
        last edited by 2 Sept 2023, 00:42

        @mitu thanks for the response, unfortunately lr-mame2000 doesn't run any of my roms (it's a pretty old set, not sure if that's a problem or not). I've spent far too much time on this so I think I'll just get some USB-powered speakers and use the adapter device. Cheers!

        1 Reply Last reply Reply Quote 0
        1 out of 3
        • First post
          1/3
          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.

          This community forum collects and processes your personal information.
          consent.not_received