Audio pitch when emulating at different speeds

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Audio pitch when emulating at different speeds

Post by zeroone »

In FCEUX, the pitch changes when you adjust the emulation speed. Is it possible to re-sample the audio in way that retains the normal speed pitch when emulating at different speeds?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Audio pitch when emulating at different speeds

Post by tepples »

It depends on at what level you are emulating.

If you don't mind DMC (Gimmick and Batman: ROTJ) and $4011 banging (Skate or Die 2) going out of tune with the tone generators during an overclock, you can continue to clock the APU at the ordinary 315/176 MHz while overclocking the CPU. Otherwise, you'll have to use time stretching methods.
User avatar
zeroone
Posts: 939
Joined: Mon Dec 29, 2014 1:46 pm
Location: New York, NY
Contact:

Re: Audio pitch when emulating at different speeds

Post by zeroone »

tepples wrote:It depends on at what level you are emulating.

If you don't mind DMC (Gimmick and Batman: ROTJ) and $4011 banging (Skate or Die 2) going out of tune with the tone generators during an overclock, you can continue to clock the APU at the ordinary 315/176 MHz while overclocking the CPU. Otherwise, you'll have to use time stretching methods.
Maintaining the APU at the normal speed while changing the speed of the CPU is an interesting idea. I'll give that more thought.

Since the APU provide an extremely large number of samples per seconds that needs to be decimated anyway, is there some simple time stretching technique that can be used to retain the pitch?
User avatar
rainwarrior
Posts: 8735
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Audio pitch when emulating at different speeds

Post by rainwarrior »

I do not recommend time stretching. Techniques like that are very prone to aliasing and other unpleasant distortion (and usually computationally expensive).

FCEUX did just get an "overclocking" feature that was about adding extra scanlines (out of time), rather than changing the CPU frequency. I believe it skips the APU during the extra scanlines and might cancel the extra scanlines when $4011 is hit? I forget the details, but depending on what you're doing it might be a better alternative to a CPU frequency adjustment?

There was a thread about it here: viewtopic.php?f=3&t=12823
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Audio pitch when emulating at different speeds

Post by Dwedit »

If you don't like the sound pitch changing, use dendy mode instead?
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Sour
Posts: 891
Joined: Sun Feb 07, 2016 6:16 pm

Re: Audio pitch when emulating at different speeds

Post by Sour »

zeroone wrote:Maintaining the APU at the normal speed while changing the speed of the CPU is an interesting idea. I'll give that more thought
This is what Mesen does when overclocking (if the option to preserve sound pitch is enabled).
The APU keeps running at the same speed that it usually if the CPU was not overclocked.
For $4011 writes, overclocking is automatically disabled until the $4011 writes stop, so their pitch is preserved as well.
Post Reply