Mercandj / sampler

Android / iOS audio sampler pad (techno: oboe, cmake, kotlin, swift...)
7 stars 2 forks source link

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

Open TheMaxCoder opened 6 years ago

TheMaxCoder commented 6 years ago

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 commented 6 years ago

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

TheMaxCoder commented 6 years ago

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 commented 6 years ago

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

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 commented 6 years ago

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 :(