ITotalJustice / notorious_beeg

gba emulator written in c++23
https://notorious-beeg.netlify.app/
GNU General Public License v3.0
41 stars 4 forks source link

square channels are too loud #25

Closed ITotalJustice closed 2 years ago

ITotalJustice commented 2 years ago

for square channels, if the duty=0, then i output a -volume, if duty=1 then i output a +volume. this however makes the channels too loud, most notable in emerald intro.

the same happens if i apply this to the noise channel. when the bit=0, output -volume, otherwise +volume. this makes the channel too loud.

i am not really sure what to do here because having the dmg channels only output 4bit samples between 0-15 seems wrong when i want to output signed sound. however if i always treat it as duty=0, vol=0, then it sounds identical to gba hw (in terms of loudness).

maybe output -+vol is the correct thing to do, but i am missing an important step in between.

i guess one possible issue is that sound cannot go from say, -15 to +15 instantly, it's gradual, being a constant signal meaning theres no sharp edges. so maybe i need to emulate the gradual change in volume?