gbt-player icon indicating copy to clipboard operation
gbt-player copied to clipboard

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

Open copyrat90 opened this issue 1 year ago • 3 comments

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)

https://github.com/AntonioND/gbt-player/assets/34793045/b357ca66-d29d-41b1-be1c-f6a1bf57c4e5

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.

copyrat90 avatar Jun 25 '23 02:06 copyrat90

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

GValiente avatar Jun 26 '23 06:06 GValiente

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.

copyrat90 avatar Jun 28 '23 00:06 copyrat90

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.

AntonioND avatar Jul 16 '23 17:07 AntonioND