apu quick question

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
apu quick question
by on (#179)
is correct to output 1 sample at every 1.79*60/44.1 CPU clock cycles, or is my logic wrong?

CPU_CLOCK * 60 / SAMPLE_RATE

TKS

by on (#180)
1789772 -- pAPU cycles per second
44100 -- Samples per second (assuming 44KHz output)

therefore: ~40.58 pAPU cycles per sample (CPU_CLOCK / SAMPLE_RATE)

by on (#181)
Sounds right - this is exactly what my sound core does.

by on (#182)
Yeah, but slightly different, this way [NTSC PPU clock cycles]:

LINE_CYCLES = 341 PPU cc's
CYCLES_PER_FRAME = 341*262 = 89342
CYCLES_PER_SECOND = 89342*60 = 5360520
SAMPLE_RATE = 44100Hz

then = CYCLES_PER_SECOND / SAMPLE_RATE
then = 5360520 / 44100 = ~121.55 cycles/sample (or ~40.51 CPU cc/sample)

by on (#187)
This is probably due to the fact the ppu doesn't render at EXACTLY 60 frames per second.

Prolly more accurate to go with the cpu timing, since this is how the apu is clocked.

My question is what about the dead cycle on every odd frame brad was talking about. Does this mean that it's not really 341 * 262 * ~60, but really

(341 * 262 * ~30) + (340 * 262 * ~30) cycles per second?

:|

by on (#188)
The CPU runs at 1.78977272727MHz, with a small amount of variance. The PPU runs at (341*262-1/2)/3 = 29780.5 CPU cycles per frame.
The actual framerate works out to be about 60.0988Hz for NTSC.

As for laughy's question, the cycle difference every other frame only applies to the FIRST scanline, not all 262 of them.

As for PAL, CPU speed is 1.662607MHz, and the PPU runs at (341*312*50)/3.2 = 33247.5 CPU cycles per frame (a test rig made by Kevin Horton showed that the PAL PPU does *not* have the cycle difference every other frame). This works out to 50.00698Hz for PAL.
:)
by on (#192)
Oops:

(341 * 261 * ~30) + (340 * ~30) + (341 * 262 * ~30)

Quietust's equation is mo betta =]

However MINE doesn't require a floating point UNIT!!!

FASTER!

:)