A/V synchronization

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
James
Posts: 429
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL
Contact:

Re: A/V synchronization

Post by James » Sun Jan 22, 2017 7:57 am

What are you using to record the output?
get nemulator
http://nemulator.com

User avatar
rainwarrior
Posts: 7836
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: A/V synchronization

Post by rainwarrior » Sun Jan 22, 2017 12:01 pm

The Windows WASAPI loopback from the speakers output. This:

https://msdn.microsoft.com/en-us/librar ... s.85).aspx

gdkchan
Posts: 14
Joined: Tue Jun 21, 2016 2:43 pm

Re: A/V synchronization

Post by gdkchan » Mon Jan 23, 2017 6:20 am

Thanks for the help James! I just tested your example today, and the sound seems to be smooth most of the time, but I can hear some clicking after a few seconds. I just recorded the output of the program and this picture shows some changes on the shape of the wave:

Image

I noticed that when this happens the green line goes down too.

Edit:

Just exported this particular part as a Wave file.
Attachments
square.zip
(112.34 KiB) Downloaded 101 times

User avatar
James
Posts: 429
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL
Contact:

Re: A/V synchronization

Post by James » Mon Jan 23, 2017 6:51 am

gdkchan wrote:Thanks for the help James! I just tested your example today, and the sound seems to be smooth most of the time, but I can hear some clicking after a few seconds. I just recorded the output of the program and this picture shows some changes on the shape of the wave:

Image

I noticed that when this happens the green line goes down too.

Edit:

Just exported this particular part as a Wave file.
Clicking is indicative of a buffer underrun. Verify that your fps is at 60Hz and then try reducing the callback frequency by try changing wanted.samples to 1024.

What OS is this running under?
get nemulator
http://nemulator.com

gdkchan
Posts: 14
Joined: Tue Jun 21, 2016 2:43 pm

Re: A/V synchronization

Post by gdkchan » Mon Jan 23, 2017 7:00 am

James wrote:Clicking is indicative of a buffer underrun. Verify that your fps is at 60Hz and then try reducing the callback frequency by try changing wanted.samples to 1024.
My display is configured to output @ 60Hz, and the application shows an average of 60fps (seems to fluctuate between 58 and 62). I'll try increasing the samples to 1024 and edit this post after I do.
James wrote:What OS is this running under?
Windows 10.

User avatar
koitsu
Posts: 4218
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: A/V synchronization

Post by koitsu » Mon Jan 23, 2017 11:41 am

The only "issue" with audio_sync.exe I can reproduce is when clicking the application window and/or dragging it around. Sometimes it doesn't re-synchronise, resulting in never-ending desynchronisation (clicking/stuttering), and the green gradually either decreases (i.e. keeps decreasing indefinitely) or increases and then decreases again indefinitely, etc.. and when I say never-ending, I do mean it -- I've left it running for a few minutes before. Framerate tends to vary a lot as well (in general though, not during the above), usually somewhere between 59 and 61. This is on Windows 7 SP1 x64.

If A/V evidence of this is needed, can provide, but won't be for a few days.

User avatar
James
Posts: 429
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL
Contact:

Re: A/V synchronization

Post by James » Mon Jan 23, 2017 11:54 am

koitsu wrote:The only "issue" with audio_sync.exe I can reproduce is when clicking the application window and/or dragging it around. Sometimes it doesn't re-synchronise, resulting in never-ending desynchronisation (clicking/stuttering), and the green gradually either decreases (i.e. keeps decreasing indefinitely) or increases and then decreases again indefinitely, etc.. and when I say never-ending, I do mean it -- I've left it running for a few minutes before. Framerate tends to vary a lot as well (in general though, not during the above), usually somewhere between 59 and 61. This is on Windows 7 SP1 x64.

If A/V evidence of this is needed, can provide, but won't be for a few days.
Thanks for testing. This behavior is not expected per se, but not entirely surprising. nemulator contains code to detect this scenario and fix it. I stripped it out in an attempt to simplify the POC code; I'll add it back in.
get nemulator
http://nemulator.com

Post Reply