Homepage Forums RetroPie Project Everything else related to the RetroPie Project USB Audio–5 second delay in advMAME-1.4

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #115088
    caver01
    Participant

    I just setup the latest retropie image (3.4) on my Pi2. I have a USB audio adapter from Adafruit (https://www.adafruit.com/products/1475). Mine is the “CM-Headphone Type”. The setup for this is pretty straightforward on Jessie–you merely add /etc/asound.conf and put in:

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

    That done, I get sound as expected using speakertest both white noise tests and wave tests. I also get audio in Emulation Station scrolling through roms. NES emulator for example works fine.

    Then, I loaded roms for AdvanceMAME and configured the default to launch 1.4. It works, but the audio is delayed about 5 seconds! It sounds great, but seriously, this is ridiculous latency leading me to think I have something configured wrong. Advmame .94 is better, but there is still latency. What’s going on here?

    On my PiPlay SD card, AdvanceMAME 1.2 works fine–no latency. I would consider other MAME builds, but I want to be able to run Vector games at my display’s full resolution (1280×1024) and I want to be able to have shader/scanline flexibility for the other games (so probably running at higher, doubled etc. resolutions). Does anyone have any thoughts or recommendations? HDMI audio is not possible with my display setup.

    #115834
    caver01
    Participant
    #118926
    Anonymous
    Inactive

    I am really curious how the link helped you fix the delay. I have the USB card as default (achieved in another way, by disabling the broadcom module in /boot/config.txt), yet I still have a 5 second delay in AdvMame.

    #118979
    caver01
    Participant

    blanka, I think you answered your own question. I was getting sound to work at first using another method too. In fact, I have used four or five different methods to get usb sound working in some capacity, but it wasn’t until I reversed my other attempts and followed the instructions in the link to create /etc/modprobe.d/alsa-base.conf that the delay went away.

    Right now, however, I have the broadcom audio enabled again going to the built-in 3.5mm jack and my USB dongle is unplugged. I discovered that the NORMALIZE audio setting in advancemame was the cause of crackling. Once I turned off normalization in the GUI, and permanently with this line in advmame.rc: “sound_normalize no” the crackling stops. I am testing whether or not I even need USB audio.

    Anyway, try the technique outlined in the link above and see if that works better.

    #120733
    Anonymous
    Inactive

    Hey, I’d like to reactivate this thread. I’ve been working on migrating an earlier 3.x setup to a Raspberry Pi 3 with the latest Jessie bits, and I pretty much have everything working, except I am hitting exactly this same 5-second delay thing in Advmame. This occurs even on the Pi 2 using the same SD card, so it’s not a Pi 3 specific problem.

    I notice that the delay occurs in both Advmame 1.2 and 1.4, and not so much in 0.9, as was described above. However, I got exactly nowhere in terms of curing it via any of the steps above. I can even blacklist snd-bcm2835 so that the built-in sound driver never loads and the _only_ ALSA sound adapter is the USB one, but I still get the big delay. However, I also noticed that it seems to somehow be related to emulator startup – sounds that occur right after boot (for example in the btime ROM) play at a lower pitch than they should. This gave me an idea, and I started playing around with the various latency and sound sync options in the .rc file, but I still didn’t get anywhere, until…

    If I use “debug_rawsound yes” option in the advmame .rc files, then yes, the problem seems to go away. However, as this disables the sound sync code altogether, I suspect that the sound will start to drift over time, so I wasn’t thrilled with this being the actual solution. Finally, I just changed the sound option to use SDL instead of ALSA, and that seemed to fix it as well.

    #120736
    caver01
    Participant

    Hmm. That’s pretty interesting. I don’t think I have mentioned this anywhere above, but the default value for sound_latency was something like 0.2, which is really strange and noticeably long. I don’t think you can set it to zero, but .05 is fine, and you can definitely hear the difference. I don’t understand how a 5th of a second audio lag could be acceptable as a default. It won’t fix the 5-second problem, but don’t ignore it.

    I wish I knew exactly what steps I took while troubleshooting my USB audio besides landing on the settings linked above. It’s possible that I have some residual ALSA file somewhere after trying so many different things. I am really disappointed in the way my USB card is supported. Commands to the channel name PCM don’t work at all.

    I had hoped to find a way to use an ALSA “clone” plugin so that I could leave the PCM channel (built-in Broadcom) enabled and setup my config to mimic everything to the USB hardware. I had a few aspects of this working at one point, but not every had sound. Perhaps some of them bypassed ALSA settings. In any case, I switched to the built-in jack for now. I may come back to USB, but it’s so frustrating.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Everything else related to the RetroPie Project’ is closed to new topics and replies.