spjewkes / jrnz

A work-in-progress ZX Spectrum emulator
MIT License
1 stars 0 forks source link

Improve beeper to remove stuttering and possibly add some filtering #49

Open spjewkes opened 5 months ago

spjewkes commented 5 months ago

The current implementation is still stuttering a bit. I suspect it might be the way we count cycles. Some further work is needed to look into this (perhaps I can sample the output using audacity and compare with another version?).

In addition, I don't if we refine the output a little. It sounds a little harsh, I don't if there's a good way to apply some filtering to the output to improve the quality. Again we probably want to compare with another emulator here as it's difficult to judge the fidelity of the ZX Spectrum sound as it is so primitive.

spjewkes commented 4 months ago

I made a fix yesterday to try and improve this. I notice that I'm dividing the frequency of the sampling by the CPU frequency - which I think is okay. However, regardless of what constant I use here, you will not get instructions neatly fitting into this period. But my code was making that assumption and resetting the counter. What it should've done is subtract the constant when we breeched it.

I think it has made a slight difference to the output. Manic Miner at least sounds pretty okay. There are still issues with other songs.

spjewkes commented 4 months ago

One other thing I need to consider, is the instruction timing. There may be a bug in the timing values that I'm using at the moment. Also, there is memory contention issues to consider. Something my emulator completely ignores.