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

Crackling popping #5

Open
DunDun69 opened this issue Jul 2, 2020 · 10 comments
Open

Crackling popping #5

DunDun69 opened this issue Jul 2, 2020 · 10 comments

Comments

@DunDun69
Copy link

DunDun69 commented Jul 2, 2020

First, I would like to thank you for creating this library! The setup was smooth and documentation is great.

However, I'm experiencing constant crackling popping / noise in my game after switching to oboe. This becomes very noticeable when a sound effect starts or ends with a fade in/out effect while having another sound running on a loop in the background. The issue is not very noticeable when playing one sound from absolute silence.

I'm using a mix of mp3 and wav sounds on a OnePlus 5T Android version 9.0.11

Unfortunately I can't point out the source of the issue... I'm not even sure if this is an issue related to this library or oboe. My only suggestion is to upgrade oboe to the latest version? I've seen similar issues on their repo and maybe its fixed 🤷‍♂️
google/oboe#286
google/oboe#564

@barsoosayque
Copy link
Owner

Oh, thanks for the report.

Let's see: this shouldn't be a format problem, so you're right, it's either this library or oboe. There is one problematic spot in libgdx-oboe code base that I am aware of that can produce such crackling (and it's when you pause entire audio stream). So I hope that crackling was fixed in the upstream library and I just have to update it 😄 .

I have to setup android environment on my pc again, it might take awhile, hopefully I will be able to work on this issue later this week.

@barsoosayque barsoosayque self-assigned this Jul 13, 2020
@barsoosayque
Copy link
Owner

Can you try 0.2.3 version and see if it works or nah ?

@DunDun69
Copy link
Author

Unfortunately it didn't work 😞 But I've made a quick audio recording for my game with and without libgdx-oboe, maybe that helps identifying the issue...

With libgdx-oboe (0.2.3): https://www.mboxdrive.com/with-oboe.mp3
Without libgdx-oboe (default libgdx android audio backend): https://www.mboxdrive.com/without-oboe.mp3
Note: The sound quality is not great, but you should still hear more background cracking noise on the oboe version compared to default android audio.

Appreciate your time looking into this though! If you need any information that might help you, please let me know!

@barsoosayque
Copy link
Owner

If you need any information that might help you, please let me know!

Quick thought, a common reason for cracking sound in my experience was a buffer underrun (when there is not enough demuxed data to feed the oboe audio stream), which should be logged. So that would be great if you can show me catlog at the moment when you have such audio errors.

But I doubt that, because crackling on the recording you've provided doesn't sound like a buffer underrun to me. Though, I'd be glad to be wrong here.

@DunDun69
Copy link
Author

Here is my full logcat output for both Oboe and default android backend (SoundPool).
I ran through the same in game journey to try and avoid necessary logs and keep them as short as possible.

Logcat with Oboe: https://pastebin.com/jtPTHnmu
Logcat with SoundPool (default): https://pastebin.com/gN6HGsQi

@barsoosayque
Copy link
Owner

Can you post ffmpeg -i %your_file% ? Or, at least, confirm that you are using 44100 Hz audio (in Audacity or anything else) ?

@DunDun69
Copy link
Author

I receive the game audio files from a friend who is also working with me on the game, so I am not sure if they share anything in common (e.g. frequency, software used.. etc).

But here are the ffmpeg -i results for some of the audio files used (specifically in this test)

Input #0, mp3, from 'grenade-throw.mp3':
Duration: 00:00:00.47, start: 0.025057, bitrate: 158 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 158 kb/s
Metadata:
encoder : LAME3.99r

Input #0, mp3, from 'grenade-count-down.mp3':
Duration: 00:00:00.36, start: 0.034531, bitrate: 102 kb/s
Stream #0:0: Audio: mp3, 32000 Hz, mono, fltp, 102 kb/s
Metadata:
encoder : LAME3.99r

Input #0, mp3, from 'grenade-detonation.mp3':
Duration: 00:00:02.42, start: 0.023021, bitrate: 155 kb/s
Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 155 kb/s
Metadata:
encoder : LAME3.99r

Input #0, wav, from 'mall-background.wav':
Duration: 00:00:04.34, bitrate: 1024 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s

Also, I've asked a friend to test my game with libgdx-oboe and it seems to be working fine...
He's using a Samsun Galaxy Note 8 (Android 8). No idea whats causing this issue on my OnePlus 5T, but I don't think its the audio files if it works ok on another phone? 🤷‍♂️

@barsoosayque
Copy link
Owner

What Android are you running ? Because Oboe has different implementation based on the actual device API.

Also, can you try to normalize sample rate of your audio files to 44100 Hz ?
You can use ffmpeg -i grenade-count-down.mp3 -ar 44100 grenade-count-down.mp3 for example.

@DunDun69
Copy link
Author

What Android are you running ? Because Oboe has different implementation based on the actual device API.

I'm running Android 9.0.11 (not rooted)

Also, can you try to normalize sample rate of your audio files to 44100 Hz ?

I've just normalized the files I sent before (and few more) to 44100 Hz, made sure that only these files are played during the game, but it did not make a difference. The crackling noise can still be heard with the frequency normalized.

@barsoosayque
Copy link
Owner

Alright, so the last thing worth trying is to test out oboe example apps to see if it's oboe or it's something within this library. I assume you have the tools to build them, if not, feel free to ask for apks !

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

2 participants