-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
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 latency
Recording
- use
VOICE_RECOGNITIONpreset to by pass system effects - use
PCM16format which avoids any format shifting
Playback
- use Fast Mixer thread
- use native sample rate from
AudioManagerAPI by usingPROPERTY_OUTPUT_SAMPLE_RATE - use optimal chunk size from
AudioManagerAPI by usingPROPERTY_OUTPUT_FRAMES_PER_BUFFER - feed DAC with the help of provided callback which executes on high priority thread
Meet audio deadlines
Additional recommendations for the callback implementation to avoid glitches
- avoid logging. use systrace instead.
- avoid memory allocation
- don't wait on other threads
- don't do file i/o. Instead, use another thread to do read file and transfer the data using circular buffer or non-blocking queue
- don't sleep
- prevent cpu core migration by setting thread affinity, or using
getExclusiveCores() - prevent cpu frequency scaling by adding a stabilizing load
- use Sustained Performance Mode
funkyfourier, sinewave440hz, igorski and karl-tech
Metadata
Metadata
Assignees
Labels
No labels