MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

Big Karnak
Part-time Lurker
Reged: 05/22/13
Posts: 1011
Loc: Mount St. Lurkling
Send PM


Audio Latency
#327078 - 06/17/14 08:15 AM


This description is from a MAME settings guide:

Quote:


Audio Latency: This setting tells MAME how accurately it must play sound in accordance to what's taking place on the screen. By raising the number, you are telling MAME to take it's time generating the sound and that it doesn't necessarily have to sync up with the picture if syncing would slow the game down. This is another setting you can play with if you would prefer not to sacrifice the quality of the sound to achieve a full frame rate. But raising this setting increases the likelihood of you seeing an action occur on the screen and hearing it a split moment later.



So I was curious as to why MAME's default setting for Audio Latency is set to "2"?

Maybe I'm confused by the description. But my understanding is the following:

High Audio Latency vs. Low Audio Latency

High Audio Latency:
  • Higher quality sound
  • Increases chance of audio being out of synch with picture
  • Decreases chance of achieving full frame rate

Low Audio Latency:

  • Lower quality sound
  • Increases chance audio and picture being synchronized
  • Increases chance of achieving full frame rate


Is my understanding accurate?



SmitdoggAdministrator
Reged: 09/18/03
Posts: 16877
Send PM


Re: Audio Latency new [Re: Big Karnak]
#327081 - 06/17/14 09:17 AM


When it was added like that most setups would hiccup if you set it to 1. Its default setting has probably since been forgotten about.



big10p
Arcadian
Reged: 03/13/14
Posts: 141
Loc: UK
Send PM


Re: Audio Latency new [Re: Smitdogg]
#327083 - 06/17/14 01:03 PM


I think 0 is lowest setting.



Mamesick
Troll Lamer
Reged: 09/21/03
Posts: 1649
Loc: Italy
Send PM


Re: Audio Latency new [Re: big10p]
#327087 - 06/17/14 01:21 PM


> I think 0 is lowest setting.

From source code:

Code:

	{ OSDOPTION_AUDIO_LATENCY "(1-5)",        "2",   OPTION_INTEGER,    "set audio latency (increase to reduce glitches, decrease for responsiveness)" },




big10p
Arcadian
Reged: 03/13/14
Posts: 141
Loc: UK
Send PM


Re: Audio Latency new [Re: Mamesick]
#327088 - 06/17/14 01:34 PM


> > I think 0 is lowest setting.
>
> From source code:
> { OSDOPTION_AUDIO_LATENCY "(1-5)", "2", OPTION_INTEGER, "set audio latency (increase
> to reduce glitches, decrease for responsiveness)" },

I was just going by the info on MAMEworld:
http://www.mameworld.info/easyemu/mameguide/mameguide-options.html

-audio_latency is at the bottom.



Mamesick
Troll Lamer
Reged: 09/21/03
Posts: 1649
Loc: Italy
Send PM


Re: Audio Latency new [Re: big10p]
#327089 - 06/17/14 01:38 PM


It should be corrected, then. I believe 0 is invalid parameter, but never tried what happens using it.



Big Karnak
Part-time Lurker
Reged: 05/22/13
Posts: 1011
Loc: Mount St. Lurkling
Send PM


Re: Audio Latency new [Re: Mamesick]
#327091 - 06/17/14 03:01 PM



Quote:


When it was added like that most setups would hiccup if you set it to 1.



That's correct. In MAMEUI, MAME Plus! UI, MAME Plus! eXTended, and some other UI derivatives... if you set the Audio Latency to "1", all or most of the emulators' settings would get reset back to their defaults. It appears to be a bug in the UI. But in my favorite derivative MAMEUIFX, this bug does not happen. Maybe the author, Mamesick, can inform the devs and the various derivative maintainers what he did to fix this bug.


Quote:


I think 0 is lowest setting.



"0 "is not an option in the various UI derivatives. "1" is the lowest option available in those UI derivatives when configured within the UI. I'm not sure what would happen if one would manually configure the INI file with a Audio Latency of "0".


Quote:


It should be corrected, then.



Okay, so what is the consensus on this issue... is it recommended we set the Audio Latency to the lowest setting or the highest setting? It should be set to the lowest setting, right? (whether that be "0" or "1").

Ya see... I'm backing up all my configuration files for all the various MAME derivatives I have. And I want to know what is recommended I do when choosing the setting of the Audio Latency.

My PC is a P4, 3.0 GHz, Win XP 32-bit.



big10p
Arcadian
Reged: 03/13/14
Posts: 141
Loc: UK
Send PM


Re: Audio Latency new [Re: Big Karnak]
#327092 - 06/17/14 03:27 PM


It all depends on the power of the system you're running it on. If your PC (or whatever) is good enough to run most/all games with audio latency of 1, without it causing a slowdown, then stick with that. Slower machines will probably need a higher latency setting, to avoid slowdown. That's what the audio latency setting is for.

I tried it set to 0 out of interest, but couldn't tell a difference from a setting of 1. The source code probably just clamps any setting given to the range 1 to 5.



Mamesick
Troll Lamer
Reged: 09/21/03
Posts: 1649
Loc: Italy
Send PM


Re: Audio Latency new [Re: Big Karnak]
#327093 - 06/17/14 04:59 PM


> When it was added like that most setups would hiccup if you set it to 1.
> That's correct. In MAMEUI, MAME Plus! UI, MAME Plus! eXTended, and some other UI
> derivatives... if you set the Audio Latency to "1", all or most of the emulators'
> settings would get reset back to their defaults. It appears to be a bug in the UI.
> But in my favorite derivative MAMEUIFX, this bug does not happen. Maybe the author,
> Mamesick, can inform the devs and the various derivative maintainers what he did to
> fix this bug.

Seriously? I don't remember anything about fixing this issue in my FX. Would you explain better? In MAMEUI what happens if you set Audio Latency to 1? It's interesting...



Sune
Connected
Reged: 09/21/03
Posts: 5648
Loc: Lagoa Santa, Brasil
Send PM


Re: Audio Latency new [Re: Big Karnak]
#327097 - 06/17/14 08:14 PM


> Okay, so what is the consensus on this issue... is it recommended we set the Audio
> Latency to the lowest setting or the highest setting? It should be set to the lowest
> setting, right? (whether that be "0" or "1").

Technically you'll want as low latency as possible, set it to 1 if that works for you.

But I'm not sure how much of an audible difference there will be, I mean, if you'll be able to actually perceive that the sound is less delayed. That's what the setting does, "quality" in this context does not mean that it will "sound better"!

It's more likely that you will hear skipping and drop-outs with latency set to 1 before you'll be able to perceive "less latency".

Many different factors come into play here, not just mame.ini settings or the sound emulation of the particular game you're running and how CPU heavy it is, but also your sound card driver buffer size (normally not user-configurable) and current sample rate (user-configurable), whatever Windows is doing in the background, whether MAME is allowed to take "exclusive" control of your sound hardware etc etc.

If drop-outs occur with latency set to 1, you can try setting sleep to 0 under "Core performance options" and under "Windows performance options" set priority to 1 or even 2.
Vsync, triplebuffer and the other refresh rate related options probably also have an impact, not just in mame.ini but refresh/sync related video card settings in your GPU driver control panel as well.

S



krick
Get Fuzzy
Reged: 02/09/04
Posts: 4235
Send PM


Re: Audio Latency new [Re: Sune]
#327113 - 06/18/14 05:11 AM


Possibly of interest in the latest version of GroovyMAME...


Quote:


- Audio latency now admits fractional values (e.g.: -audio_latency 1.5): this makes it possible to find the optimal system specific glitch-safe audio latency value with finer granularity.




More info...

http://forum.arcadecontrols.com/index.php/topic,130944.0..html



GroovyMAME support forum on BYOAC



Big Karnak
Part-time Lurker
Reged: 05/22/13
Posts: 1011
Loc: Mount St. Lurkling
Send PM


Re: Audio Latency new [Re: Mamesick]
#327114 - 06/18/14 05:36 AM



Quote:


Seriously? Would you explain better? In MAMEUI what happens if you set Audio Latency to 1? It's interesting...



All of MAMEUI settings get reset/cleared back to their defaults. ALL of the settings. Meaning, let's say for example, if you happen to have the "Enable Cheats" option checked, it will uncheck because MAMEUI's default setting for that option is unchecked.


Quote:


I don't remember anything about fixing this issue in my FX.



I've noticed that this isn't the first time that you have unintentionally fixed issues without even realizing you've done so. Maybe you're just that good.



Big Karnak
Part-time Lurker
Reged: 05/22/13
Posts: 1011
Loc: Mount St. Lurkling
Send PM


Re: Audio Latency new [Re: Sune]
#327115 - 06/18/14 06:01 AM


Oh geez, maybe the Audio Latency should be kept at "2" after I just read the following from this thread: http://forum.arcadecontrols.com/index.ph...8el3#msg1342036

Quote:


Well the purpose is to run the emulator with zero "Sound: buffer over- / underflows", which is reported on exit after an emulation session when you run MAME/MESS with the "-v" parameter.

Note that each time a sound buffer overflow occurs that the audio samples generated in that frame are skipped into oblivion = audio lost. You can check this by looking at the code in src/osd/windows/sound.c, and search for "// if we're going to overlap the play position, just skip this chunk".

I'm a perfectionist (and I know you are too ), so my test case is *not* only whether or not I can hear a skip, but also whether or not the emulation has actually skipped on audio. Which it does in the case of buffer overruns.

In my experience there a lot of drivers where in an average 5 or 10 minute gaming session the number of buffer overruns will increase when setting the audio latency setting to 1, but the number of overruns will be ~zero when having a setting of 2. When this is the case, being able to set a value somewhere in between might be desirable.

I guess your best test case is to run a game or system you know very well, run MESS/MAME with the "-v" parameter and have audio latency set to 1 and do a gaming session of a few minutes, report the number of buffer overruns (= how many frames of audio have been lost). I would be surprised if that number will be zero... Then do the testcase with audio_latency setting of 2 and see how much -lower- the number of buffer overruns have been. It's probably close to zero. (It might also be worthwhile to do the same for a game / system that taxes your system more than average.)

-If- the above is the case, then I guess you would also benefit of having a higher granularity for the audio latency setting.





R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9716
Loc: ECV-197 The Orville
Send PM


Re: Audio Latency new [Re: krick]
#327124 - 06/18/14 05:33 PM


> Possibly of interest in the latest version of GroovyMAME...
>
> - Audio latency now admits fractional values (e.g.: -audio_latency 1.5): this makes
> it possible to find the optimal system specific glitch-safe audio latency value with
> finer granularity.

Not a fan of that particular approach, but we can certainly have finer-grained latency.

Also, Windows SDLMAME builds can be made to use WASAPI. Thought I should point that out given how that thread ends.



krick
Get Fuzzy
Reged: 02/09/04
Posts: 4235
Send PM


Re: Audio Latency new [Re: R. Belmont]
#327134 - 06/19/14 05:04 AM


> > Possibly of interest in the latest version of GroovyMAME...
> >
> > - Audio latency now admits fractional values (e.g.: -audio_latency 1.5): this makes
> > it possible to find the optimal system specific glitch-safe audio latency value
> with
> > finer granularity.
>
> Not a fan of that particular approach, but we can certainly have finer-grained
> latency.

I thought they should have kept the value an integer but increased the range from 1 to 50, then divide by 10 internally when using it to set the buffer size.

If you were to implement finer-grained functionality in MAME, how would you recommend it be done? No snarkiness intended, I'm genuinely curious.



GroovyMAME support forum on BYOAC


Pages: 1

MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
1 registered and 283 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 4879