Skip to content

Instantly share code, notes, and snippets.

@dubcl
Created May 15, 2026 23:30
Show Gist options
  • Select an option

  • Save dubcl/7780f3b37cff4e83071e7674d24876dd to your computer and use it in GitHub Desktop.

Select an option

Save dubcl/7780f3b37cff4e83071e7674d24876dd to your computer and use it in GitHub Desktop.
GroovyArcade / GroovyMAME Audio Issue

GroovyArcade / GroovyMAME Audio Issue Documentation

Summary

After replacing the USB audio device in a GroovyArcade system, several games running on GroovyMAME stopped producing audio, while others continued working normally.

The issue initially appeared to be related to:

  • ALSA
  • SDL audio backend
  • GroovyMAME timing
  • USB audio compatibility
  • syncaudio / syncrefresh
  • low latency audio

However, the root cause was eventually identified as stale per-game audio mappings stored in MAME configuration files.


Environment

  • OS: GroovyArcade (old installation)
  • Emulator: GroovyMAME 0.279
  • Audio backend: ALSA via SDL
  • Audio device:
    • Old: USB PnP Sound Device, USB Audio
    • New: AB13X USB Audio, USB Audio
  • Arcade cabinet with mono speaker setup

Initial Symptoms

  • Some games had audio
  • Some games had no audio
  • aplay worked correctly
  • ALSA device detected correctly
  • GroovyMAME logs showed:
    • Audio: Driver is alsa
  • No explicit audio errors appeared in logs
  • /proc/asound/card0/pcm0p/sub0/status remained:
    • closed

This indicated that playback was never opened for affected games.


Investigation Performed

Verified ALSA playback

aplay -D default /usr/share/sounds/alsa/Front_Center.wav

Result:

  • Audio worked correctly

Reviewed MAME audio configuration

Relevant settings:

sound                     sdl
audiodriver               alsa
samplerate                48000
syncaudio                 1
audio_latency             2

No obvious issues detected.


Investigated .asoundrc

The system used a custom mono downmix configuration for the arcade cabinet:

pcm.dmix_mono {
  type dmix
  ipc_key 1024
  slave {
    pcm "hw:0,0"
    channels 2
  }
}

pcm.mono {
  type route
  slave.pcm "dmix_mono"
  ttable {
    0.0 1
    1.0 1
    0.1 1
    1.1 1
  }
}

pcm.!default {
  type plug
  slave.pcm "mono"
}

Although somewhat fragile for low-latency GroovyMAME setups, this was NOT the main cause of the issue.


Root Cause

The real problem was found inside the per-game MAME .cfg files.

Working games contained:

<sound_map tag=":mono">
    <node_mapping node="o:AB13X USB Audio, USB Audio" db="0.000000" />
</sound_map>

Broken games contained either:

<sound_map tag=":mono" />

or mappings to the OLD device:

<node_mapping node="o:USB PnP Sound Device, USB Audio" db="0.000000" />

Why This Happens

MAME stores mixer/audio routing persistently per game.

When:

  • audio devices are changed
  • USB DACs are replaced
  • ALSA device names change

the stored node_mapping becomes invalid.

MAME does not automatically invalidate or regenerate these mappings.

As a result:

  • games may silently lose audio
  • no obvious ALSA errors appear
  • playback device is never opened

Key Discovery

The issue would likely NOT have occurred if the replacement USB audio device exposed the exact same device name as the previous one.

MAME stores audio routing using literal device strings such as:

node="o:USB PnP Sound Device, USB Audio"

Changing the device name invalidated the stored mappings.


Resolution

Replace stale device mappings

Mass replacement was performed:

find ~/.mame/cfg -type f -name "*.cfg" \
-exec sed -i 's|node="o:[^"]*"|node="o:AB13X USB Audio, USB Audio"|g' {} \;

Identify configs with missing mappings

find ~/.mame/cfg -type f -name "*.cfg" -exec sh -c '
grep -q "<sound_map" "$1" && ! grep -q "node_mapping" "$1" && echo "$1"
' _ {} \;

Identify empty self-closing sound maps

find ~/.mame/cfg -type f -name "*.cfg" \
-exec grep -l '<sound_map[^>]*/>' {} \;

These files required deletion or regeneration.


Recommended Improvements

Simplify ALSA mono downmix

The original .asoundrc worked but was overly complex for GroovyMAME.

A simpler route-based mono configuration is recommended instead of:

  • dmix
  • multiple ALSA plugin layers
  • software mixing chains

Final Conclusion

The issue was NOT caused by:

  • ALSA failure
  • SDL incompatibility
  • USB audio timing
  • GroovyMAME bugs
  • syncaudio settings

The actual cause was:

  • persistent per-game MAME audio routing
  • stale node_mapping entries
  • invalid audio device names after USB audio replacement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment