Coder Social home page Coder Social logo

bzw073 / androidaudiofastpathsample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from over17/androidaudiofastpathsample

0.0 1.0 0.0 46 KB

Simple project to demonstrate use of OpenSL low-latency audio on Android

License: Apache License 2.0

Makefile 0.77% C 95.66% Java 3.57%

androidaudiofastpathsample's Introduction

AndroidAudioFastPathSample

This project is a modified native-audio sample from Android NDK r10e, written by Glenn Kasten and copyrighted under The Android Open Source Project.

The initial sample nicely shows the possibilities of using OpenSL for audio input and output in Android, though it is quite old and does not utilize the audio Fast Path introduced in Jelly Bean.

I adopted the sample so that it utilizes the low-latency audio path:

  • removed effects (reverb)
  • set the sampling frequency to the native value reported by the device
  • the buffer size should also match the one reported by the device, but it does not really seem to affect whether the audio subsystem selects fast mixer or not, so this is hardcoded. In a real-world app, you will need to have at least 2 buffers which match the device native value, and probably a thread that fills the buffers with the necessary audio data. Here we just submit the whole audio buffer to the buffer queue, for the matter of simplicity.
  • left only the generated "sabretooth" clip and a sound clip in the assets
  • the UI now contains only three buttons - the generated clip, the assets clip, and display the device native values - sampling frequency and buffer size

To rebuild the code

  1. Build the native library by running ndk-build
  2. Build the APK in Eclipse, Android Studio or tool of your choice
  3. Enjoy

License

Copyright (C) 2010 The Android Open Source Project

Modifications Copyright (C) 2016 Yury Habets

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

See also

For more details about the low-latency audio on Android introduced in Jelly Bean and fast mixer please refer to the official docs:

https://source.android.com/devices/audio/latency_design.html

Great presentation of the features and requirements:

Google I/O 2013 - High Performance Audio: https://www.youtube.com/watch?v=d3kfEeMZ65c

androidaudiofastpathsample's People

Contributors

over17 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.