Android Question Multi-track Audio Playback - B4A

ryounger

New Member
Licensed User
Longtime User
I have an app I developed for iOS in Swift 3.1 and it uses the AVAudioEngine from iOS. I can easily synchronize and playback 20 or more stereo tracks with or without effects. I can also record a track while playing these other tracks, and it is all synchronized perfectly. The day has come where I need to try and port my app to Android. I have loved B4A since 1.0, but it does not seem like anyone has addressed this. I have looked at (God forbid) using Android Studio and Java to accomplish this, but it is fairly illusive as to how to do it with the native Android SDK too. I believe I have read every thread in the forum related to audio, and have not seen where anyone has accomplished this in B4A. Can AudioTrack be used to play multiple stereo tracks in sync? Also, I need to be able to mute/unmute any track with a button click. Does anyone have an answer for this?
 

stevel05

Expert
Licensed User
Longtime User
Unfortunately Android support for audio manipulation has not improved much over the years. A quick search of Android Developers site shows that there are a couple of new tools available, but appear to required the use of the NDK (https://developer.android.com/ndk/guides/audio/index.html).

As far as I know there are no high level libraries that will do this, and certainly none wrapped for B4a. There are a couple of threads on the forum relating to this (https://www.b4x.com/android/forum/pages/results/?query=Audio+Mix+&product=b4a&page=1).

You can certainly mix the tracks using Audiotrack and looks like Audio streamer will do it too. (https://www.b4x.com/android/forum/threads/mixing-audiostream.51114/#post-319933). But you will need to look into the technicalities of mixing audio.
 
Upvote 0
Top