Oboe C++ Library
repository·main·Indexed 26 days ago
https://github.com/google/oboeA C++ library for high-performance audio development on Android that provides a unified API abstracting over OpenSL ES and AAudio. It supports API level 16 and onwards, featuring automatic API selection, latency management, and built-in workarounds for Android audio issues. The documentation includes guides for getting started, API references, and sample applications such as FXLab, OboeTester, DrumThumper, and LiveEffect.
What's inside Oboe
- parselib is a C++ static library designed for parsing and loading audio data from streams. It is intended to be used within Android native code. It currently supports the Microsoft WAV format.
Overview of Android FXLab
mainAndroid FXLab is a sample application that demonstrates real-time audio effects processing with low latency using the Oboe API. The application uses a native C++ implementation for audio effects processing and Kotlin for the user interface. It supports a linear pipeline of real-time effects that can be re-ordered, enabled/disabled, and parameterized in real-time.Overview of Oboe
mainOboe is a C++ library designed for building high-performance audio applications on Android. It provides a simplified, unified API that works across multiple Android API levels, starting from API level 16 (Jelly Bean).Overview of the PowerPlay Sample application
mainPowerPlay is an energy-efficient audio player sample application designed to demonstrate Oboe's Performance Modes. It showcases how to implement low-latency, power-saving, and hardware PCM offload playback modes using a C++ engine (PowerPlayMultiPlayer) and a Jetpack Compose UI.Overview of Oboe sample applications
mainThe Oboe repository includes several sample applications demonstrating different audio capabilities:
- MinimalOboe (Kotlin/Compose): Creates an Oboe stream to play white noise; handles stream restarts on disconnection.
- hello-oboe (Java): Creates an output stream that plays a sine wave on screen tap.
- RhythmGame (Java): A rhythm game involving pattern copying (includes an associated codelab).
- MegaDrone (Java): A 100-oscillator synthesizer demonstrating low latency and CPU performance.
- DrumThumper (Kotlin): A drum pad that plays sounds from loaded WAV files.
- LiveEffect (Java): Demonstrates duplex capability by looping audio from an input stream to an output stream.
- SoundBoard (Kotlin): A 25 to 40 note dynamic synthesizer demonstrating signal combining; restarts stream on display rotation.
- OboeDJ (Kotlin/Compose): A high-performance DJ app with two independent playback decks and real-time scratching.
- PowerPlay (Kotlin/Compose): Demonstrates power-efficient features like PCM Offload and automation via ADB.
Overview of the OboeDJ Sample Application
mainOboeDJ is a high-performance, low-latency DJ sample application built using the Oboe library. It demonstrates advanced audio manipulation capabilities including dual-deck playback, real-time scratching, and BPM synchronization. The application uses a C++DJEnginefor audio processing and a Jetpack Compose UI for control.Overview of the DrumThumper sample app
mainDrumThumper is an Oboe playback sample application designed as a "Drum Pad" app. It demonstrates best practices for low-latency audio playback on Android using the Oboe API.
Key capabilities demonstrated include:
- Playing multiple audio sources mixed into a single Oboe stream.
- Managing the lifecycle of an Oboe audio stream in relation to the Android application lifecycle.
- Handling playback errors and output device connection/disconnection.
- Using the Oboe resampler to resample source audio to the device playback rate to avoid runtime overhead.
- Controlling relative levels (gain) and stereo placement of audio sources.
- Supporting both mono and stereo sources.
- Loading 16-bit PCM WAV data from Android assets.
Overview of iolib for audio playback
mainiolib is a C++ static library designed for Android native code. It provides classes for streaming audio playback and mixing from multiple sources, demonstrating best practices for using Oboe. While currently focused on playback, the library is designed to eventually support audio capture as well.Key features of Oboe
mainOboe offers several advantages for Android audio development:
- Wide Compatibility: Supports API level 16 and onwards, covering approximately 99% of Android devices.
- Automatic API Selection: Automatically chooses between OpenSL ES (for API 16+) and AAudio (for API 27+) to ensure the best possible performance on the specific device.
- Latency Management: Includes automatic latency tuning.
- Modern C++: Built with modern C++ for clean and elegant code.
- Stability: Includes built-in workarounds for known Android audio issues.
Access Oboe documentation and guides
mainOboe provides several resources for developers to get started and master the library:
- Getting Started: Use the Getting Started with Oboe guide for initial setup.
- Full Guide: For in-depth usage, refer to the Full Guide to Oboe.
- API Reference: Detailed technical documentation for all classes and methods is available at https://google.github.io/oboe/.
- FAQs: Common questions and troubleshooting can be found in the FAQs.
- Real-world Examples: See Apps using Oboe to see how the library is implemented in production applications.
Use Oboe Tester to test audio features and measure latency
mainOboeTester is an application designed to test the features of the Oboe, AAudio, and OpenSL ES audio APIs. It is specifically useful for measuring device audio latency and detecting audio glitches.Signal chain architecture for Soundboard
mainThe Soundboard sample uses specific signal chains depending on the channel count:
- Mono streams:
SynthSound->Mixer - Stereo streams:
SynthSound->Mixer->MonoToStereo
Each
SynthSoundis composed of a series of 5 Oscillators.- Mono streams: