Please test nemulator's audio resampling

Discuss emulation of the Nintendo Entertainment System and Famicom.
User avatar
James
Posts: 434
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL

Please test nemulator's audio resampling

Post by James »

A recent thread discussed methods for synchronizing audio and video rates. nemulator dynamically resamples audio to match the video frame rate. I think this works well -- video stays locked to vsync so there is no tearing or stuttering, and the changes in audio frequency are not noticeable.

I've received good feedback from people who've tried it out, but I've never really solicited feedback from this group. Please give it a try and let me know what you think. A couple of notes:
- F9 toggles display of stats
- F4 toggles a graph of output frequency (green line) and output buffer position (red line; red area is the target that it's trying to keep the buffer position at)
- If you have a non-60Hz display, I'm especially interested in how well this works as I've been unable to test (make sure app.timer_sync is set to true in nemulator.ini)

Image

Thanks,
James
get nemulator
http://nemulator.com
Alegend45
Posts: 43
Joined: Thu Mar 29, 2012 6:10 pm

Re: Please test nemulator's audio resampling

Post by Alegend45 »

Yeah, I think you might want to take out the unlimited sprites option. Some games that I don't know of might rely on the limit.
User avatar
Dwedit
Posts: 5257
Joined: Fri Nov 19, 2004 7:35 pm

Re: Please test nemulator's audio resampling

Post by Dwedit »

Some games place a bunch of sprites in the same scanline to do sprite masking. Zelda 1 and Gremlins II are two games I can name of the top of my head that do this.

If you want to throw out the sprite limit, but still support this kind of sprite masking, you can detect it easily. Look for 8 early sprites (may or may not include sprite 0) with the same Y coordinate and same tile number, that's a sure sign that it's trying to mask those scanlines.

edit: Sorry, can't test the emulator, I'm on Windows XP.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Please test nemulator's audio resampling

Post by koitsu »

Can't test the emulator, but about the unlimited sprites feature:

Please make this a toggleable feature. There are lots of games that look better with the sprite limit disabled, but there are also lots of games which behave oddly/look awful unless sprite limit is enabled. Here's a list of games I've found which look/behave oddly when sprite limit is disabled:

* Castlevania 2 -- when Simon is standing a swamp the lower half of his body is visible
* Majou Densetsu 2 - Daimashikyou Galious -- when Populon enters a door, his entire body is visible as the sprite is moved downwards. Just see these two videos I made some time back: #1 #2.

I'm certain there are others, but those are the two I can name off the top of my head. So please, like I said, make this a toggleable feature (default should be sprite limit enabled, just like the real hardware).
User avatar
James
Posts: 434
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL

Re: Please test nemulator's audio resampling

Post by James »

koitsu wrote:Can't test the emulator, but about the unlimited sprites feature:

Please make this a toggleable feature.
It is. F7. Also configurable in nemulator.ini (globally or on a per-game basis).
get nemulator
http://nemulator.com
User avatar
Jarhmander
Formerly ~J-@D!~
Posts: 570
Joined: Sun Mar 12, 2006 12:36 am
Location: Rive nord de Montréal

Re: Please test nemulator's audio resampling

Post by Jarhmander »

I think Gimmick! also rely on sprite limit. I noticed this on Nesicide when I put a "breakpoint on sprite overflow", at the beginning of a level; that makes the effect of the hero popping out of the gate.
((λ (x) (x x)) (λ (x) (x x)))
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Re: Please test nemulator's audio resampling

Post by Shiru »

Super Spy Hunter won't spawn enemies properly without sprite limit emulation.
Grapeshot
Posts: 85
Joined: Thu Apr 14, 2011 9:27 pm

Re: Please test nemulator's audio resampling

Post by Grapeshot »

Works fine for me with 60 hz refresh rate, but with 50 hz I get pops whether the timer sync option is on or off. Looks like the sample rate can't adjust enough. This is important because a lot of laptops, mine included, drop the display refresh rate when running on battery. Here's your statistics and graph.

Image
natt
Posts: 76
Joined: Fri Oct 26, 2012 5:27 pm

Re: Please test nemulator's audio resampling

Post by natt »

I got the same results as Grapeshot; audio is not correct at 50hz refresh, no matter what. With timer sync, audio is correct at 75hz refresh, though.
User avatar
James
Posts: 434
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL

Re: Please test nemulator's audio resampling

Post by James »

natt wrote:audio is not correct at 50hz refresh
I suppose that's expected, as it doesn't make sense to slow down to 50Hz, though this is the first I've heard of LCDs with that refresh rate. Disabling vsync (nemulator.ini: app.vsync = false) should fix that. Maybe I should automatically disable vsync if the refresh rate is less than ~60Hz...
natt wrote:With timer sync, audio is correct at 75hz refresh, though.
ok, good. Is video smooth at this refresh rate, or do you see any stuttering when scrolling?

Thanks for testing, guys.
get nemulator
http://nemulator.com
natt
Posts: 76
Joined: Fri Oct 26, 2012 5:27 pm

Re: Please test nemulator's audio resampling

Post by natt »

Studdering. However, when checking that, I came across another problem: timer_sync doesn't seem to be working correctly.

With 60hz refresh rate, vsync=off, timer_sync=on gives a framerate of 50fps.

With 75hz refresh rate, vsync=anything, timer_sync=on gives a framerate of 50fps.

With 75hz refresh rate, vsync = on, timer_sync=off, things work correctly (60fps framerate), just with some video studdering as expected.


I wasn't aware refresh rates other than 60hz were so uncommon? My LCD can sync to anything in [50..75]hz.
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA

Re: Please test nemulator's audio resampling

Post by blargg »

Is there any trick to getting Nemulator to work on Linux with Wine?
User avatar
James
Posts: 434
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL

Re: Please test nemulator's audio resampling

Post by James »

natt wrote:Studdering. However, when checking that, I came across another problem: timer_sync doesn't seem to be working correctly.

With 60hz refresh rate, vsync=off, timer_sync=on gives a framerate of 50fps.

With 75hz refresh rate, vsync=anything, timer_sync=on gives a framerate of 50fps.

With 75hz refresh rate, vsync = on, timer_sync=off, things work correctly (60fps framerate), just with some video studdering as expected.


I wasn't aware refresh rates other than 60hz were so uncommon? My LCD can sync to anything in [50..75]hz.
are you using true/false for the settings or on/off? Should be true/false.

re: 50Hz refresh rates. I don't know how common it is/isn't, but all of the LCDs that I have or have access to only run at 60Hz.
get nemulator
http://nemulator.com
User avatar
James
Posts: 434
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL

Re: Please test nemulator's audio resampling

Post by James »

blargg wrote:Is there any trick to getting Nemulator to work on Linux with Wine?
hmmm... don't know. Does it even start?
get nemulator
http://nemulator.com
natt
Posts: 76
Joined: Fri Oct 26, 2012 5:27 pm

Re: Please test nemulator's audio resampling

Post by natt »

James wrote: are you using true/false for the settings or on/off? Should be true/false.

re: 50Hz refresh rates. I don't know how common it is/isn't, but all of the LCDs that I have or have access to only run at 60Hz.
I am using true\false. Sorry for the murky writing; I kind of jotted a bunch of stuff down. This should be much more explicit:

75hz monitor setting

vsync = false, timer_sync = true: 50FPS
vsync = false, timer_sync = false: high (>150) FPS on menu, 60FPS in game
vsync = true, timer_sync = false: 75FPS on menu, 60FPS in game
vsync = true, timer_sync = true: 50FPS

50hz monitor setting

vsync = false, timer_sync = true: 50FPS
vsync = false, timer_sync = false: high (>150) FPS on menu, 60FPS in game NOTE: while there is tearing and studdering, this does sound good
vsync = true, timer_sync = false: 50FPS
vsync = true, timer_sync = true: 50FPS