Nes sampling rate

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

Post Reply
User avatar
ashkalov
Posts: 9
Joined: Thu May 14, 2020 3:58 am

Nes sampling rate

Post by ashkalov »

Good time of day.
I am writing my nes emulator. I am currently writing APU. This question arose. At what points do I need to make a sample selection to get 735 samples per frame. I know this is a stupid question, but the problem is that I can't associate the sample rate with the APU frequency.
Nostalgia is our little time machine
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Nes sampling rate

Post by lidnariq »

The NTSC NES's native sampling rate is 1.79MHz. (Four of the channels run at half that, but the triangle channel runs at the same speed as the CPU). Unfortunately, this isn't an integer multiple of any standard sound card rate, so you have to do some kind of resampling before emitting it. Using a fixed integer will produce subtle synchronization problems later on, but you can rewrite your audio abstraction at a later point once you have a better framework in place.

The PAL Famiclone sample rate is a tiny bit lower (1.77MHz), the PAL NES sample rate is a good bit lower (1.66MHz).
User avatar
ashkalov
Posts: 9
Joined: Thu May 14, 2020 3:58 am

Re: Nes sampling rate

Post by ashkalov »

Thank you very much!
Nostalgia is our little time machine
Post Reply