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

[Bug] Audio pop cause by lack of emulator DC offset #115

Closed
1 task done
RichardULZ opened this issue May 3, 2019 · 6 comments
Closed
1 task done

[Bug] Audio pop cause by lack of emulator DC offset #115

RichardULZ opened this issue May 3, 2019 · 6 comments

Comments

@RichardULZ
Copy link
Contributor

Note: for support questions, please use one of the following channels.
Reddit: /r/gbstudio
Discord: Join Chat

  • I'm submitting a ...
    • bug report

People have complained about a loud pop on GameBoy start.

I think this happens because the GB pulse waves are only set High or Low, and thus, the default sound is constantly -1, with pulse waves between -1 and +1.

This means a -1 audio signal is blasted into your computer at all times when running, any other program sounds will halve in volume and have other possible artifacts. RIP Headphone users that have to deal with a loud pop on game start and end.

Ideal Solution
A master DC offset/gain option in the emulator would be a solution. Halving the volume and adding a +0.5 or +1 offset so the default level is 0.

So instead of audio between -1 and +1, we remap that to 0 and +1.

  • environment:
    • Version: 1.0.0
    • Platform: [all]
@thomas-alrek
Copy link
Contributor

Ah, this explains why all my other system sounds suddenly sounded like a Dalek while the emulator was active

@chrismaltby
Copy link
Owner

The emulator that I'm using is my fork of http://taisel.github.io/GameBoy-Online/ which seems to have the same sound issues https://github.com/taisel/GameBoy-Online if someone figures this out it would be nice to submit a pull request back to that project. My version changed the UI quite a lot but the audio part is mostly untouched (other than a bit of code to initialise audio on first input as browsers required this days)

@chrismaltby
Copy link
Owner

Think I've fixed this now as of 5a80a4f by following the instructions in this article http://alemangui.github.io/blog//2015/12/26/ramp-to-value.html and ramping the gain up and down when switching to and from the emulator window. I've submitted a pull request to GameBoy-Online with the same change also. @RichardULZ could you confirm if this version fixes the issue for you?

@RichardULZ
Copy link
Contributor Author

@chrismaltby It's better, no more pop, but the underlying issue is still there.
Anyone with for example, music/video in the background, will still have a drop in quality from this signal blasting.

@chrismaltby
Copy link
Owner

Hmm, I'm not hearing any background issues on macOS. I've tried modifying the audio buffer manually halving the volume and adding 0.5 like you initially suggested. Changed in df86512. Does that help at all?

@RichardULZ
Copy link
Contributor Author

@chrismaltby Perfect!
The audio meter stays quiet until you play any music, and moves with the music as you'd expect (used to stay full), and external sound from youtube or such will not distort anymore!

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