Question about generating a hardware audio click track with

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
Posts: 2
Joined: Sat Nov 09, 2019 1:30 am

Question about generating a hardware audio click track with

Post by MonilGomes » Sat Nov 09, 2019 1:35 am

Hello, I have been working on making a hardware mixer for my nes taking the CPU pin 1, pin 2 and famicom pin 9 and making a line out. one of the features is to separate the signals for effects and creating sync tracks for my other equipment (analogue sync to lsdj). I have gotten pretty close but still have issues with it generating unwanted clicks. I am trying to look for some way to sync the oscillator with the timing of the music my 1 tick blip doesn't capture 2 oscillation instead of one.

i wanted to know if 1 hertz = 1 tick for .nsf (i use famitracker for my chiptunes)? or how i can sync any channels oscillator?

[Removed abuse of size and color to mask URLs. Action taken against user. --MOD]
Last edited by MonilGomes on Sun Nov 10, 2019 7:34 pm, edited 2 times in total.

Posts: 9660
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Question about generating a hardware audio click track w

Post by lidnariq » Sat Nov 09, 2019 12:23 pm

150bpm = 60Hz
more details: ... 49#p239149

Note that for mastering purposes, the US NES is clocked off a signal that's just a tiny bit faster (≈60.1 Hz) so you'll need to compensate for that.

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

Re: Question about generating a hardware audio click track w

Post by rainwarrior » Sat Nov 09, 2019 1:20 pm

If we're talking about NSF through an emulator (or maybe PowerPak) the PLAY rate is an arbitrary division of 1MHz. The actual rate will depend on a setting contained within the NSF file itself. Common values:
  • 1000000 / 16666 = 60.002
  • 1000000 / 16639 = 60.099
  • 1000000 / 19997 = 50.007
Some emulators or hardware players will ignore the speed setting inside the NSF and give a fixed rate instead, which in turn might be a more hardware authentic 60.1 or a flat 60 depending on what the program's author did.

Reference: Wiki:NSF

Posts: 22049
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)

Re: Question about generating a hardware audio click track w

Post by tepples » Sat Nov 09, 2019 10:04 pm

If you need help compensating for this slight difference in field rate, let me know.
Otherwise, what sort of oscillator are you talking about?

Lots of numbers follow

The pixel rate is defined as 945/176 MHz, or about 5.36932 MHz, to within the master clock crystal's tolerance (3 ppm or 0.0003% per NTSC standard). With display on, the PPU generates (341*262-.5) pixels per field, for a 945/176*1000000/(341*262-.5) = 60.0988 Hz field rate, or 3605.93 fields per minute.

The Pently audio driver for NES assumes 3,606 NMIs per minute in NTSC mode, and its NSF shell writes out a 16639 μs play period. So if your score says 150 BPM, you'll get clicks at 150/3606*945/176*1000000/(341*262-.5)*60 = 149.997 BPM if timed based on NMI or 150/3606*1000000/16639*60 = 149.999 if timed based on NSF.

You mentioned LSDJ. For comparison, Game Boy and Game Boy Advance run at 2^22 Hz pixel rate or 2^22/(456*154) = 59.7275 Hz field rate, or about 3,584 ticks per minute. I don't know whether LSDJ compensates.

Post Reply