- --
Viewing Issue Advanced Details
[ Jump to Notes ]
| ID | Category [?] | Severity [?] | Reproducibility | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 09203 | Sound | Major | Always | Jul 10, 2025, 13:17 | 14 hours ago |
| Tester | hap | View Status | Public | Platform | MAME (Official Binary) |
| Assigned To | hap | Resolution | Fixed | OS | |
| Status [?] | Resolved | Driver | |||
| Version | 0.278 | Fixed in Version | 0.287GIT | Build | |
| Fixed in Git Commit | 967f363 | Github Pull Request # | |||
| Summary |
|
||||
| Description |
Sound module abuffer ( https://github.com/mamedev/mame/blob/master/src/osd/modules/sound/sound_module.cpp ) has desync issues. If a desync happens, for example after save/loadstate, or after resuming after pressing fast forward, the sound will crackle every 20ms, and it will have trouble restabilizing. It is deliberate, see: // If there are too many buffers, remove five samples per buffer // to slowly resync to reduce latency (4 seconds to // compensate one buffer, roughly) So, it will crackle for 4 seconds per buffer, which is already annoying. But even after that, it hovers over the number of buffers limit occasionally, and you'll still get sound crackling. abuffer is used in: File modules\sound\coreaudio_sound.cpp File modules\sound\pa_sound.cpp File modules\sound\pipewire_sound.cpp File modules\sound\pulse_sound.cpp File modules\sound\sdl_sound.cpp File modules\sound\wasapi_sound.cpp File modules\sound\xaudio2_sound.cpp |
||||
| Steps To Reproduce |
Run a game with clear simple sound, such as pacman. Briefly press INS (the fast forward key) to force a desync. Listen to sound crackling. Note: to force it to resync cleanly and get rid of the sound crackling, simply pause and unpause. |
||||
| Additional Information | |||||
| Github Commit | |||||
| Flags | Regression | ||||
| Regression Version | 0.278 | ||||
| Affected Sets / Systems | |||||
|
Attached Files
|
| ||||
|
| |||||
|
| |||||
Relationships
| There are no relationship linked to this issue. |
Notes
11
|
No.23457
Augusto Tester
Jul 10, 2025, 17:33
|
That issue happen here too. Ubuntu 24.04. MAME using pulseaudio. |
|---|---|
|
No.23460
Robbbert Moderator
Jul 11, 2025, 09:32
edited on: Jul 11, 2025, 09:33 |
Not happening here - sound is clean when INS released. Tried xaudio2 (my default), wasapi, and port audio - using the default settings with all effects off (Bypass). However, it does happen for some users, so i will confirm it. |
|
No.23461
hap Developer
Jul 11, 2025, 11:57
|
If you can't hear it, try this in osd/modules/sound/sound_module.cpp: } else if(m_used_buffers >= 5) { printf("x"); // If there are too many buffers, remove five samples per buffer // to slowly resync to reduce latency (4 seconds to // compensate one buffer, roughly) m_delta2 -= std::max<uint32_t>(samples / 200, 1); buf.m_cpos = std::max<uint32_t>(samples / 200, 1); } Press INS briefly, and check if it keeps printing x-es. Every "x" is an audible click. Perhaps not with your ears, but it is there. |
|
No.23462
danylopez123 Tester
Jul 11, 2025, 19:37
|
All i know from this weird audio sync is that launching a game results in some sort of delayed audio but to fix it, pause the game for a second then resume, that's when the audio it's in more in sync. However, doing the turbo will delay the audio again, to fix it again that's where i do the pause thing again. Used XAudio2 with 0.0 Latency |
|
No.23465
Robbbert Moderator
Jul 12, 2025, 09:12
edited on: Jul 12, 2025, 09:14 |
@hap, I tried adding the "x", and a bunch of x's showed after releasing INS, this being in pacman's attract mode which is silent. I then replaced "x" with "%d ",m_used_buffers and this shows 10 then slowly dropping to 5 and eventually stopped printing. So, the code appears to be working as designed. However there were no clicks, just silence. I also tried kof2002 during its attract sequence, no audible issue there either. |
|
No.23471
hap Developer
Jul 13, 2025, 21:48
|
Yeah, it keeps hovering at 5 buffers when that happens (which is 100ms latency), even when the sound module can handle lower latency than that. Imagine opening a wav file in an editor, and every 800 samples or so, you cut away a few samples. That will introduce a click at each of those points when playing it back. That's what MAME does right now. |
|
No.23481
ICEknight Tester
Jul 16, 2025, 18:28
|
@Robbbert "However there were no clicks, just silence." Try starting a game, that's where we're noticing the issues. |
|
No.23491
Augusto Tester
Jul 17, 2025, 22:34
|
I need add an information. In MAME versions from before 2010 was added an feature "AudioSync" ( Time Stretching ) changes the playback rate of the soundbuffer based on the emulation speed. Then the setting was removed from user, but enabled internally. Only works when using D3D. I not understand if new sound system continue using that feature. New sound system has own audio sync code. With the new sound system that "audiosync" code is now useless ? |
|
No.23582
hap Developer
Aug 11, 2025, 10:14
|
It's easier to hear on a squarewave, I uploaded some recordings. |
|
No.24238
hap Developer
20 hours ago
|
abuffer crackling was removed here: https://github.com/mamedev/mame/commit/967f3636c8190abb2519e5f4a7e02c494eb05381 Instead, it will reset the buffer after latency has reached a certain threshold. Although it works well in most cases such as fast forward, I'm not yet happy with it. It's not aware of the audio latency, and some events from MAME can increase the latency. For example loading a quick savestate (shift F7), or fiddling with the global speed slider (-cheat). |
|
No.24241
hap Developer
14 hours ago
|
I've had enough, after the last commit ( https://github.com/mamedev/mame/commit/a8934416a3aabfbb455e9524fbb1c233c93a99a0 ), abuffer max latency isn't 0.16s anymore for everyone, so the latency on quickload isn't that bad. I don't think that's a bug, more like an inevitability due to loading sound update timers from the state. |