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

[Android][Native] Continues sound when using NativeAudioManager? #1

Open
TheMaxCoder opened this issue Apr 3, 2018 · 4 comments
Open
Assignees

Comments

@TheMaxCoder
Copy link

Hi thanks for the great sample, but when using NativeAudioManager on Android it plays an annoying tone continuously in the background and doesn't play any sounds from the pad. You have to kill the app to stop the tone.

However SoundPoolAudioManager plays perfectly fine.

Thanks

@JonathanMercandalli
Copy link
Contributor

Hi, thanks for using this project ^^. Yes I know, the NativeAudioManager is a little bit flacky. The WAV format extraction to raw data (decoder) is a simple fread and I plug that into the google oboe native audio loop without a lot of testing...

Yes for now it's better to use the SoundPoolAudioManager implementation that is using high level java/kotlin SoundPool if you want a sample that play sound (😄). (but the hidden goal of this repo is to have Android and iOS using native audio loop targeting the same basic c/cpp code, so I will love to have the NativeAudioManager working)

Thanks

@Mercandj Mercandj changed the title Android: Continues sound when using NativeAudioManager? [Android][Native] Continues sound when using NativeAudioManager? Apr 3, 2018
@Mercandj Mercandj self-assigned this Apr 3, 2018
@TheMaxCoder
Copy link
Author

SoundPool API is kinda buggy actually and I was looking for a native alternative to SoundPool and I think oboe is the way to go.

From your experience, Let's take your project (pads) for example if you don't want to use SoundPool, what other option you would go for? for short sounds continuously just like pads.

I'm still a beginner to oboe and I really hope you would get NativeAudioManager working :)

Great project by the way!

@JonathanMercandalli
Copy link
Contributor

Yep, to play audio on Android I know some technos:

  • Native - OpenSL ES (could be another solution to play sounds, tracks or "short sounds")
  • Native - AAudio (== OpenSL. Api 26 min, even 27 min)
  • Native - Oboe ( == OpenSL + AAudio. New player from Google 💪)
  • Native - AudioTrack could be an alternative (but I never implemented and audio loop with that)
  • SoundPool
  • MediaPlayer (-> track player, not "short sounds")
  • ExoPlayer (-> track player, not "short sounds")

For this project, indeed, you're right, "oboe is now the way to go" to play sound in order to have great perfs. Moreover sounds are embedded in the app, so I can chose the format and WAV is relatively straightforward. (However, one day, I will maybe want to play MP3 or other light/compressed format and I will need to code a decoder... with MediaCodec or OpenSL... By the way @TheMaxCoder, do you know other ways/the best way to decode sound to raw data on Android?)

I'm still a beginner too to oboe but I will try to have the "cleaner" code possible (and a working implementation ^^)

Thks again =)

@TheMaxCoder
Copy link
Author

Thanks a lot for your input, it's a great help :) I'm gunna try and play around with these and see what works best for me.

I'm sorry if my question seems completely noob but What would I need to do if I want to play some ogg files using oboe? Do I need to write my own decoder or something? can you guide me in the right direction?

and about your question "do you know other ways/the best way to decode sound to raw data on Android?"

Unfortunately, I don't have any experience regarding decoding the sounds in Android so I can't say anything :(

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

No branches or pull requests

3 participants