The pitch is plausibly correct on the triangle channel but there's a small amount of crackle whilst playing single notes.
Setup SNDTEST2.NES as follows

That is, timer period is 31 which according to f = fCPU/(32*(tval + 1)) implies the frequency should be 1757.6Hz
And the output waveform is currently

with spectrum

Peak there is at 1762 which is pretty damn close to the 1757.6 above but the noise isn't great.
Compare to the waveform and spectrum from Mesen


Where the peak is at 1746 but the spectrum drops off notably after that. Maybe I'm missing something with my filter? I only do one low pass filter instead of the two high pass filters that nesdev wiki suggests the DAC chip on a NES does
The pitch is plausibly correct on the triangle channel but there's a small amount of crackle whilst playing single notes.
Setup SNDTEST2.NES as follows

That is, timer period is 31 which according to f = fCPU/(32*(tval + 1)) implies the frequency should be 1757.6Hz
And the output waveform is currently


with spectrum
Peak there is at 1762 which is pretty damn close to the 1757.6 above but the noise isn't great.
Compare to the waveform and spectrum from Mesen


Where the peak is at 1746 but the spectrum drops off notably after that. Maybe I'm missing something with my filter? I only do one low pass filter instead of the two high pass filters that nesdev wiki suggests the DAC chip on a NES does