Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ay-3-8910 aliasing issue #16

Open
nippur72 opened this issue May 10, 2020 · 1 comment
Open

ay-3-8910 aliasing issue #16

nippur72 opened this issue May 10, 2020 · 1 comment

Comments

@nippur72
Copy link

on the CPC, if you type SOUND 1,1,500,15 you hear an high pitched note but actually it should be inaudible (it's a 62 kHz tone). Same if tone is 1,2,3... (any low numbered value).

I think this is due to aliasing generating when downsampling from 62.5 kHz (chip frequency) to 44.1 kHz. The solution is apply a low pass filter to the 62.5 kHz signal before the decimation step.

Unfortunately I'm not good at filter at design, I guess a simple IIR filter should be ok, the only issue is that it has to be variable because you can vary both the chip and the final audio frequency.

@nippur72
Copy link
Author

nippur72 commented Jun 2, 2020

I applied a low pass filter and the effect is way much less noticeable (it depends on the design of the LP filter).

Basically you calculate the sample at chip frequency instead of audio frequency, and then apply the filter on the sample. At audio frequency you only pick the filtered sample.

Here is an experimental version in my emulator:
https://github.com/nippur72/lm80c-emu/blob/master/wasm/chips/ay38910.h#L472-L510

I am not satisfied yet because the filter needs to be calculated offline, making chip instantiation more complex. Perhaps there could be a sort of filter callback ?

Another downside is that it's more CPU intensive and the resulting audio is less rich in higher frequencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant