N64's funky audio sampling rates

Discuss topics related to development here.
Post Reply
User avatar
Nintendo Maniac 64
Posts: 185
Joined: Fri Oct 04, 2013 11:37 pm

N64's funky audio sampling rates

Post by Nintendo Maniac 64 » Tue Apr 08, 2014 2:35 am

tl;dr - Outside of stand-alone music playback, N64 audio sampling rates are a pain


Most of the sound and music the N64 outputted ran at things like 32006Hz and/or 22047Hz. AFAIK no PC sound card in existence can handle those sampling rates directly, and since Cen64 is cycle-accurate we cannot just slightly slow down and speed up these sampling rates to 32KHz and/or 22.05KHz like can be done to achieve high-quality music playback of stand-alone N64 audio. Therefore resampling must be done at some point.

The question is, where in the audio pipeline should this be done?

Considering the funky sampling rates, it would be useful to have as much sampling head-room as possible - 32006Hz would come out cleaner resampled to 192KHz than it would to 48KHz. An analogy would be that you'd get a considerably cleaner result if you upscaled a 324x243 image to 1920x1440 rather than if you upscaled it to 480x360.

However, at least in the Windows world, if you aren't using ASIO or WASAPI, then your audio is going to be resampled anyway to whatever the sampling rate is set to for the output audio device's "Default format" which happens to default to 44.1KHz 16bit.

One way is to not do any resampling in Cen64 at all and just let the OS handle it. But if quality preservation of sound is key, then this would fly face into that; like I mentioned, at least in the Windows world, it defaults to 44.1KHz which wouldn't be the greatest for 32006Hz audio. However this method would provide the best compatibility, and arguably good quality for anyone willing to manually set via the Windows control panel to resample to something higher.

The alternative, again at least in the Windows world, you could avoid the OS's resampler by using ASIO or WASAPI, but then if the sound card in question doesn't support 192KHz then the audio wouldn't play. And then ASIO isn't even open source and therefore wouldn't even be able to be included with Cen64, and that's the only way to by-pass OS resampling with Creative and Asus sound cards without manually setting via the Windows control panel the desired sampling rate.

One could argue for a compromise solution with WASAPI + 96KHz, since even integrated sound cards that are 8 years old support that sampling rate. However, if there are more than a couple HDTV's like mine where only up to 48KHz is supported over HDMI input, then a person plugging their PC into an HDTV directly will be out of luck (outside of the above-mentioned Creative/Asus resampling).


...or maybe I'm just over-thinking this entire thing?


(Sort-of off-topic: you know what would be cool in the future? A foobar2000 plugin based on Cen64's currently non-existent sound core)
CEN64 Forum's resident straight-male kuutsundere
(just "tsundere" makes people think of "Shana clones" *shivers*)

CPU+iGPU: Pentium G3258 @ 4.6GHz/1.281v
dGPU: Radeon HD5870 1GB
RAM: Vengeance 1600 4x4GB
OS: Windows 7

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest