OpenSL ES™ is a royalty-free, cross-platform, hardware-accelerated audio API tuned for embedded systems.
Questions tagged [opensl]
193 questions
42
votes
7 answers
Low-latency audio playback on Android
I'm currently attempting to minimize audio latency for a simple application:
I have a video on a PC, and I'm transmitting the video's audio through RTP to a mobile client. With a very similar buffering algorithm, I can achieve 90ms of latency on…

Sergio Morales
- 2,600
- 6
- 32
- 40
40
votes
5 answers
Tutorials for OpenSL ES for Android
I've been trying to look into using the OpenSL ES library that is available for doing native audio with android 2.3, but it appears that the header files and the 600 page pdf of the spec are the only available documentation.
Where should I be…

mjr
- 1,963
- 4
- 20
- 21
33
votes
1 answer
Is it possible to get a byte buffer directly from an audio asset in OpenSL ES (for Android)?
I would like to get a byte buffer from an audio asset using the OpenSL ES FileDescriptor object, so I can enqueue it repeatedly to a SimpleBufferQueue, instead of using SL interfaces to play/stop/seek the file.
There are three main reasons why I…

khiner
- 673
- 8
- 19
19
votes
1 answer
Redirecting audio / creating alternate sound paths in Android
Does anyone have experience (using OpenSL ES, ALSA, etc.) with redirecting audio or creating new sound paths in Android? The end goal is to create a virtual microphone to replace the external microphone, where one can play audio files as if they…

jpalm
- 2,297
- 1
- 21
- 27
13
votes
2 answers
Is it possible to get access to the speaker signal on Android?
Sending audio to the speaker for playback on Android is easy, but is it possible to get a copy of the actual final digital signal? Let's say I have 2 apps running "MyApp" and "SomeOtherApp". My app sends audio to the speaker, but so does…

user1884325
- 2,530
- 1
- 30
- 49
13
votes
2 answers
What should be reasons to use OpenSL ES instead of AudioTrack in Android?
Currently I'm using AudioTrack passing to it audio data from native layer to play.
It seems I can use OpenSL ES in the native layer instead of AudioTrack in Java. What are the supposed advantages OpenSL ES gives as opposed to AudioTrack?

Alexander Kulyakhtin
- 47,782
- 38
- 107
- 158
9
votes
0 answers
How to register callback function on Android NDK using OpenSL ES
In my Android project, I use OpenSL ES to play audio files. I would like to be able to process audio on the fly by extracting audio samples, process them and redirect them to the audio output.
Here is what I tried so far:
// create the engine and…

matteoh
- 2,810
- 2
- 29
- 54
8
votes
2 answers
Android weird AudioTrack crash
I'm an Android App developer and I'm in trouble with the following crash report (i got 5/6 of those per day):
native: pc 00000000000418e0 /system/lib/libc.so (tgkill+12)
native: pc 0000000000040d59 /system/lib/libc.so (pthread_kill+32)
…

Davide Berra
- 6,387
- 2
- 29
- 50
8
votes
3 answers
Streaming MP3 audio via socket communication using OpenSL ES on Android
I'm trying to stream an MP3 from an Android phone to another Android phone using WiFi via an access point. The problem is that OpenSL ES appears to only support PCM audio buffers as the source (unless using a URI). Rather than decoding a potentially…

honeal
- 1,459
- 1
- 18
- 19
7
votes
1 answer
Controlling the volume of forced-to-speaker audio
I'm playing an audio clip using OpenSL ES. In my code I have
audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.setSpeakerphoneOn(true);
to force audio through the speaker while the headset is plugged in. It works fine, but I…

Nitrooo
- 73
- 1
- 4
6
votes
3 answers
Android with Nexus 6 -- how to avoid decreased OpenSL audio thread priority relating to app focus?
I'm encountering a strange problem when trying to implement low-latency streaming audio playback on a Nexus 6 running Android 6.0.1 using OpenSL ES.
My initial attempt seemed to be suffering from starvation issues, so I added some basic timing…

Jack O'Reilly
- 434
- 2
- 14
6
votes
1 answer
Linking with updated library on Android
I have developed an application and a native library for Android. The native library uses openSL ES for audio processing.
In my Android.mk file I have the following statement:
LOCAL_LDLIBS := -lOpenSLES
So I'm guessing that this means that the…

user1884325
- 2,530
- 1
- 30
- 49
5
votes
2 answers
AAudio or OpenSL
I'm starting to implement my gaming audio part in C++, and I've seen there're 2 audio frameworks available AAudio (https://developer.android.com/ndk/guides/audio/aaudio/aaudio.html) and OpenSL…

Hug
- 589
- 2
- 6
- 16
5
votes
0 answers
OpenSL ES on Android with SL_ANDROID_STREAM_VOICE. Mic input is extremely low
I am using OpenSL ES and SL_ANDROID_STREAM_VOICE to route audio in native Android app to the ear (phone) speaker instead of the main speaker. The output to the ear speaker works fine, but now the audio input recording is extremely soft. Is there…

amanda cat
- 51
- 1
5
votes
1 answer
Precisely Sync Looped Audio with Animation in Android
Question:
Is there any way to use AudioTrack and setLoopPoints() to configure a loop with accuracy based on samples/frames per millisecond?
Edit: I understand that perfect accuracy can't be expected from the processing power that most android…

user3116594
- 51
- 4