-
Notifications
You must be signed in to change notification settings - Fork 91
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 Audio Best Practices (Google I/O 17) #66
Comments
Also, in Android 8.0+ there is AAudio and MMAP which provides lower latency possibilities. As I understand it, the Oboe library handles this and the legacy path (FastMixer) appropriately to the device used... See https://www.youtube.com/watch?v=Pjgfje52Yv0 for more inspiration... |
I'm trying my hand at getting Oboe integrated, but I don't have a ton of expertise with C/C++ interop in Android. All published Oboe examples use Cmake, whereas currently pd-for-android uses the older method of ndk-build. I've gotten as far as including the Oboe library into the project, and with a few changes to the Application.mk ... One common error among them is:
I'm not familiar enough with C / C++ to understand what might have caused this, though I have my hunches. Removing the Android.mk rule to build the new Oboe bindings fixes these issues. My new addition to the Android.mk file is as follows:
And the z_jni_oboe.cpp class mirrors the z_jni_opensl.c file with the exception of including a few Oboe objects. Any guidance from someone who may be more familiar with C/C++, or Android's native interop would be helpful and appreciated. Would the task of migrating pd-for-android to Cmake be less painful than trying to include the Oboe library via ndk-build in the long run? |
The following code should work:
If not, could you share |
I don't know where to share this information. So sharing it here. App Bundle may break your patchesPlease be aware when you chose to use app bundles to distribute your app that uses pd-for-android. Normally there is no problem. But if you have custom externals, pd patches may fail to load them when you use app bundles! The reason is, native libraries are not installed but remain as part of the generated apk itself. This is a feature introduced in Marsmallow. Apk keeps native libs in uncompressed form and the installed apps maps them saving space. Generally this is not an issue, but in order for pd to load externals we shall provide search path. This is typically We could reproduce this problem with an Android Pie device using app bundle consistently. However on Android Oreo, the same app bundle copies native libs and this wasn't an issue there. This means, though your patch works fine on some devices, it may fail to load on others! Take a look at: google/bundletool#39 WorkaroundPrevent having uncompressed native libs feature.
|
Recently at Google I/O 17, Android Audio team put forth some recommendations to improve audio performance: https://youtu.be/C0BPXZIvG-Q?t=10m13s
I am wondering if
pd-for-android
can take advantage of these recommendations and how. I have summarized the best practices here.Obtain low latency audio paths
Check for
audio.pro
hardware flag, which means that the device is capable of less than 20ms latencyRecording
VOICE_RECOGNITION
preset to by pass system effectsPCM16
format which avoids any format shiftingPlayback
AudioManager
API by usingPROPERTY_OUTPUT_SAMPLE_RATE
AudioManager
API by usingPROPERTY_OUTPUT_FRAMES_PER_BUFFER
Meet audio deadlines
Additional recommendations for the callback implementation to avoid glitches
getExclusiveCores()
The text was updated successfully, but these errors were encountered: