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

Audio sounds muffled when using LWJGL3 backend #6784

Open
5 tasks
hujasonx opened this issue Jan 29, 2022 · 5 comments · May be fixed by #7365
Open
5 tasks

Audio sounds muffled when using LWJGL3 backend #6784

hujasonx opened this issue Jan 29, 2022 · 5 comments · May be fixed by #7365
Labels
audio bug LWJGL3 need more info needs more info. Likely to be closed when no reaction given.

Comments

@hujasonx
Copy link

Please ensure you have given all the following requested information in your report.

Issue details

Played sound effects sound very strange / muffled when using LWJGL3 backend.

Reproduction steps/code

The bug can be reproduced on a nearly empty project:

public class MyGdxGame extends ApplicationAdapter {
	Sound testSound;
	
	@Override
	public void create () {
		testSound = Gdx.audio.newSound(Gdx.files.internal("pistol2.wav"));
		testSound.play(1);
	}
	
	@Override
	public void dispose () {
		testSound.dispose();
	}
}

In the above test, pistol2.wav is downloaded from https://freesound.org/people/michorvath/sounds/427592/ but I'm pretty sure it doesn't matter what file you use to repro.

Version of libGDX and/or relevant dependencies

1.10.1-SNAPSHOT

Please select the affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • macOS

Other

The sound file I am playing is mono 16bit pcm Wav data at 44100hz. It also works fine on the lwjgl2 backend. I'd describe the audio distortion as as if it's being passed through a telephone or some sort of band pass filter.

To folks debugging: I wonder if this bug may have context / be related: #6526 - (also by chance the only other bug I have filed to this project - I tend to do a lot of audio stuff I guess)

@Frosty-J
Copy link
Contributor

That's peculiar. I've been facing issues with poor sound quality in libGDX. But seeing as you linked that issue, I tried 1.10.1-SNAPSHOT, which has now fixed this issue for me on Linux. Some spectrogram comparisons with white noise:

@crykn crykn added audio bug LWJGL3 need more info needs more info. Likely to be closed when no reaction given. labels Feb 11, 2022
@hujasonx
Copy link
Author

hujasonx commented Mar 5, 2022

Hi there, i see there is a "need more info" label, can you elaborate?

If it helps, I am on windows 11, though I don't see why this issue wouldnt also occur on windows 10.

@crykn crykn removed the need more info needs more info. Likely to be closed when no reaction given. label Mar 5, 2022
@crykn
Copy link
Member

crykn commented Mar 19, 2022

Hm, it's quite strange that the issue only happens with LWJGL 3 and not 2. The respective files are basically the same: com/badlogic/gdx/backends/lwjgl/audio/Wav.java, com/badlogic/gdx/backends/lwjgl3/audio/Wav.java

@Frosty-J
Copy link
Contributor

Frosty-J commented Mar 19, 2022

I don't believe it has anything to do with the audio decoding part, rather the actual playback part, but in that case I don't know why it would affect OP, as LWJGL3's audio issue has been fixed for me presumably in the linked issue. I've now tested SNAPSHOT on Windows 10 and got the same results as on Linux (no problems - audio perfection). Possibly hardware-dependent?

@crykn crykn added the need more info needs more info. Likely to be closed when no reaction given. label Mar 21, 2022
@Frosty-J
Copy link
Contributor

Frosty-J commented Feb 23, 2024

Okay, this is still a problem across both Windows and Linux (on different hardware), Sound and Music, etc. The issue is very apparent with the Vine boom sound when directly compared - quieter, and still not bassy enough even if amplified to normal levels.

I've narrowed it down to only monaural sounds being affected, so an easy workaround if you don't need panning is to encode all sounds in stereo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio bug LWJGL3 need more info needs more info. Likely to be closed when no reaction given.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants