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

Signal Offset in Freeboy causing Clicks and Clipping #6556

Open
RiedleroD opened this issue Oct 31, 2022 · 4 comments
Open

Signal Offset in Freeboy causing Clicks and Clipping #6556

RiedleroD opened this issue Oct 31, 2022 · 4 comments
Labels

Comments

@RiedleroD
Copy link

RiedleroD commented Oct 31, 2022

Bug Summary

A signal offset is causing clicking on note start/end and sometimes even Clipping, when too many notes are playing at once. If you set bass to something greater than 0, the offset gets filtered out after the first few sample, causing the clicks to only appear at note start.

I believe this has to do with how gameboy audio worked - it was strictly subtractive instead of having a signal center. This also causes clicking when turning a gameboy on or off, which is what I assume LMMS is doing every time a note starts and ends. Treble and Bass filtering isn't possible on gameboy hardware, so I assume that's post processing being done by LMMS.

Steps to reproduce

play some notes inside freeboy with all channels disabled

Expected behavior

No sound output

Actual behavior

Clicking on note start, caused by the offset

Woraround

By playing the exact same notes on a second freeboy instance with the same bass setting with all instruments disabled and the signal inverted via the stereo matrix effect, the clicking and offset are mostly cancelled out.

Affected LMMS versions

At least master and 1.2.2

@RiedleroD RiedleroD added the bug label Oct 31, 2022
@RiedleroD
Copy link
Author

Here's a demonstration project for this bug: https://lmms.io/lsp/?action=show&file=20372

@musikBear
Copy link

The click is because you have channel-3 active without anything drawed in the window.
Draw a pattern and retry.

@Monospace-V
Copy link
Contributor

Monospace-V commented Nov 1, 2022

image
@musikBear Nah, it's happening without also. I found this was happening with everything disabled while looking into the freeboy, and thought it was intentional- with the vague plan of using it for something. Channel 3 is disabled.
I didn't notice it when any instruments were turned on. I guess I never tried this.
It occurs to me that in some cases not making this backward compatible could change the sound, given how easy it is to trigger.
What did the original gameboy do?

@RiedleroD
Copy link
Author

RiedleroD commented Nov 1, 2022

I already wrote what the original gameboy did. I wasn't completely right, but close enough I think.

It seems the gameboy digital to analog converters convert values from 0 to 15 to -1 to 1. This means that a digital signal of 0 produces an analog one of -1. It additionally has a highpass filter (capacitor) to remove DC offset after the initial click. Not sure if all models have this, as it's listed in "obscure behaviour" with mention of the DMG.

There's also a line saying "In general, all units in the channels are always running.", implying that channels that aren't in use are still running at volume 0. This means if they do have a DC offset, it doesn't cause clicking on note start/end on the hardware, but when the gameboy is actually turned on or off.

Source: https://gbdev.gg8.se/wiki/articles/Gameboy_sound_hardware

However, I want to note that LMMS shouldn't go for "true to the original", but for sound output that's intuitive and sounds good. There's trackers for people who want to make music true to the original. Freeboy even has channel polyphony, so it's already not even close to the hardware.

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

No branches or pull requests

3 participants