Android-Audio | level library for efficient playback | Audio Utils library
kandi X-RAY | Android-Audio Summary
kandi X-RAY | Android-Audio Summary
High-level library for efficient playback of sounds and music on Android.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Run the sound manager
- Starts a streaming sound
- Cancels the sound manager
- Load a sound resource
- Unloads a sound resource
Android-Audio Key Features
Android-Audio Examples and Code Snippets
Community Discussions
Trending Discussions on Android-Audio
QUESTION
I am trying to record audio and process it afterwards. As I understand there is no unified API I could use to access microphone across different platforms. I am aiming at WASM, UWP and Android.
My approach is to record audio with platform-specific code.
For UWP I can use MediaCapture class as described here: link. I have implemented this part and it's working just fine.
For Android it should be straight forward as well. I can use Android.Media.MediaRecorder as shown here: link. I am not sure how to get the recorded audio file afterwards.
As for WASM I am completely lost here. I suppose I could use some javascript library to record the sound or vmsg library as described here link. But I have no idea how to get the recorded data into C# code for further processing.
Is there some material I should read to better understand the topic. Do I overlook some important details? Or is there an easy way how to record audio in xamarin.android and wasm?
UPDATE: I have successfully implemented audio capture on Android using Android.Media.MediaRecorder and I can simply access the file after I am finished recording.
...ANSWER
Answered 2021-May-16 at 08:38I finally have the recording working on all three platforms (UWP, Android, WASM). The goal here is to obtain raw PCM audio data with a 48 kHz sample rate, 1 channel and 16 bits per sample.
UWP:
Global vars:
QUESTION
I'm working auto call recorder app, I'm able to record voice call on below android 6 using MediaRecorder.AudioSource.VOICE_CALL
,
From android 6 not able to record voice call using VOICE_CALL. I managed to record using MediaRecorder.AudioSource.MIC
but here incoming voice not getting recorded and I want to record voice call in normal mode not in speaker on mode. Please help me on this. (I had tried on Xiomi Redmi 4a(android 6),not working).
ANSWER
Answered 2017-Jul-26 at 07:42This could be a Permission related issue.
With the introduction of Android 6.0 Marshmallow, the app will not be granted any permission at installation time. Instead, the application has to ask the user for a permission one-by-one at run-time.
I hope you have included the code which explicitly asks for permissions on devices with Marshmallow and above.
QUESTION
I'm programming a music player app. After changing the theme color, I recreate MainAcitivity. When the recovery is finished, my player continues playing the last track played.
...ANSWER
Answered 2019-Aug-01 at 20:15Solved by setting start of Service onStart() Methode like ->
QUESTION
I am trying to visualize an file in android.I am using the following library to do it com.chibde:audiovisualizer:2.1.0
. But my app crashes saying
java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3 at android.media.audiofx.Visualizer
I have written this code by reading this blog https://mindorks.com/android/store/Equalizers-and-Visualizations/gautamchibde/android-audio-visualizer.
The following is my MainActivity.java
...ANSWER
Answered 2019-Jul-22 at 10:23Try doing this, it appeared that you were not supplying audio session ID to the visualizer.
QUESTION
My main goal is to be able to stream audio from one device to another device in the LAN. I plan doing this by reading the mp3-file into a byte[] (which I already got working) and send it as udp-packet to the 2nd device and play it there (I'm telling you this in case this is already the wrong approach). I'm currently stuck with playing my byte-Arrays. I read my file with the decoder(path, startMs, durationMs)
function from mp3. At the moment I am able to hear the audio but after every tick (which are the portions in which I read the file) I hear a nothing for some ms, which leads to a bad listening expierence. I thought this has to do with the Buffer-Size and tried playing around a bit with it, but this didn't really change something, as well as adding AudioTrack.WRITE_NON_BLOCKING
. I also thought about putting every for()-loop in a different thread, but this doesn't work at all (which makes sense). I also already tried reading the file first and putting my byte[] in an Arraylist as this might be an issue cause by slow-file-reading, but still the same experience. It might also help to know that Log.e("DEBUG", "Length " + data.length);
is only shown every tick, which means writing also only happens every tick (which proably is the issue). How can I get rid of these empty parts in my song?
Here is my code executed when you click the button:
...ANSWER
Answered 2019-Jan-20 at 17:24The root cause of this turned out to be: You were using the decode()
function in a way for which it wasn't specifically designed. Even though it appears decode()
will let you decode any portion of the .mp3 stream in a random-access way, in practice the first few ms of the returned audio are always silence, whether you're starting at the beginning of the song, or in the middle. This silence was causing the "gaps". Apparently the decode()
function was intended more for re-starting play at a random location, for instance due to a user "seek".
decode()
behaves that way because, in order to decode the Nth block of compressed data, the decoder needs both block N-1 and block N. The decompressed data that corresponds to block N will be good, but the data for block N-1 will have this "fade in" sound. This is a general feature of .mp3 decoders, and I know it happens for AAC as well. Meanwhile, decoding block N+1, N+2, N+3, etc., is no problem, because in each case, the decoder already has the previous block.
One solution is to change the decode()
function:
QUESTION
I'm trying to record audio and detect silence to stop recording and write file. Below is the code snippet already available here: Android audio capture silence detection
...ANSWER
Answered 2018-May-30 at 13:06In fact, values near 32000 or -32000 in buffer represents silence, and the values tends to zero when signal is detected. So I inverted the conditions inside searchThreshold function as below and I achieved what I was looking for.
QUESTION
I am using Superpowered for various real-time FX and they all work very straightforward. However the pitch shifting is a whole other story, I think in fact because it's based on the time-stretching algorithm that of course has to deal with output that changes in time which is a lot more complex than applying FX like EQ or reverb. However I'm only interested in change the pitch of my mic input.
I looked at the only example I could find on GitHub and I slightly adapted it to fit my work:
...ANSWER
Answered 2017-Oct-23 at 18:50Implement the part marked with TODO. That's the point where you need to provide input for the timeStretcher. Also take care of separating the output from the input. Output could be written before the input is consumed.
QUESTION
I'm very new to C++ and I'm working with the Superpowered FrequencyDomain example here: https://github.com/superpoweredSDK/Low-Latency-Android-Audio-iOS-Audio-Engine/blob/master/Examples_Android/FrequencyDomain/app/src/main/jni/FrequencyDomain.cpp
I want to continuously update a TextView with the loudest frequency being received from inside this while loop:
...ANSWER
Answered 2017-Mar-31 at 13:34Calling Java is not recommended from an audio processing thread, as it involves multiple blocking calls.
Env and thiz are thread specific, different from thread to thread. Getting them for the audio processing thread is a big no-no.
It's better to think the other way around:
- Update an array in the audio processing callback with the results you'd like to display.
- Create a JNI function to return with the values of the array to Java.
- Periodically call that JNI function from a Runnable (in Java).
QUESTION
I'm trying to understand the Superpowered SDK, but new to both Android and C++, as well as audio signals. I have Frequency Domain example from here: https://github.com/superpoweredSDK/Low-Latency-Android-Audio-iOS-Audio-Engine/tree/master/Examples_Android/FrequencyDomain
running on my Nexus 5X. In the FrequencyDomain.cpp file:
...ANSWER
Answered 2017-Mar-20 at 20:51Every value in magnitudeLeft and magnitudeRight is a float, which is 32-bits, 4 bytes.
memset takes a number of bytes parameter, so 20 bins * 4 bytes = 80 bytes. memset clears the first 20 bins this way.
Both magnitudeLeft and magnitudeRight represents the full frequency range with 1024 floats. Their size is always FFT size divided by two, so 2048 / 2 in the example.
Removing from the middle and the top looks something like:
memset(&magnitudeLeft[index_of_first_bin_to_remove], 0, number_of_bins * sizeof(float));
Note that the first parameter is not multiplied with sizeof(float), because the compiler knows that magnitudeLeft is a float, so it will automatically input the correct address.
QUESTION
I'm trying to figure out how to return an int to Java from a C++ function.
On the Java side, I have the following in a button. I put it in a button to ensure that the app was completely loaded before attempting to execute returnInt().
...ANSWER
Answered 2017-Jan-07 at 03:32You call returnInt()
before SuperpoweredExample()
. Therefore you are dereferencing a NULL pointer, example
.
Also you didn't return anything from the function declared as returning jint
You need:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Android-Audio
or
Copy the Java package to your project's source folder
or
Create a new library project from this repository and reference it in your project
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page