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

Ch3 vibrato sounds OK in mGBA, but it's broken on hardware #22

Open
copyrat90 opened this issue Jun 25, 2023 · 3 comments
Open

Ch3 vibrato sounds OK in mGBA, but it's broken on hardware #22

copyrat90 opened this issue Jun 25, 2023 · 3 comments

Comments

@copyrat90
Copy link

copyrat90 commented Jun 25, 2023

Issue

Ch3 vibrato sounds OK in mGBA, but it's broken on hardware.
The waveform is a simple Triangle, which looks like this:
image

Source files

basic - ch3 vibrato.s3m
basic - ch3 vibrato.gba

Playback

mGBA Playback (OK)

mGBA_playback.mp4

Hardware Playback (Broken)

WARNING!! HEAVILY BROKEN NOISE SOUND!!
https://github.com/AntonioND/gbt-player/assets/34793045/daed84fd-3deb-4ee5-a8ee-72b64f185cbe

I tried this on 3 different GBAs, but they all have this broken noises.

@GValiente
Copy link

VisualBoyAdvance and NanoBoyAdvance sound playback is closer to real hardware, if it helps.

@copyrat90
Copy link
Author

VisualBoyAdvance and NanoBoyAdvance sound playback is closer to real hardware, if it helps.

I just tried NanoBoyAdvance, and it has the same clicking issue.
Testing the audio with NanoBoyAdvance would be a good option, thanks for pointing it out.

@AntonioND
Copy link
Owner

AntonioND commented Jul 16, 2023

I guess this explains it: https://gbdev.io/pandocs/Audio_details.html#mixer

Avoiding audio pops

Enabling or disabling a DAC (see below), adding or removing it using NR51, or changing the volume in NR50, will cause an audio pop. (All of these actions cause a change in DC offset, which is smoothed out by the HPFs over time, but still creates a pop.)

To avoid this, a sound driver should avoid turning the DACs off; this can be done by writing $08 to NRx2 (silences the channel but keeps the DAC on) then $80 to NRx4 to retrigger the channel and reload NRx2.

The HPF is more aggressive on GBA than on GBC, which itself is more aggressive than on DMG. (The more “aggressive” a HPF, the faster it pulls the signal towards “analog 0”; this tends to also distort waveforms.)

I always remove channels with NR51 (well, the GBA-equivalent register) before changing the volume, frequency, etc.

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

3 participants