Looping back audio implementation? - android

does someone know what is the best way to implement the audio loop-back functionality in an android app?
I need to start recording sound and play that recorded sound through the headphones at the same time.
I was thinking of storing the recorded data in an buffer, and passing that buffer to mediaPlayer object within the while loop. What do you guys think, would it be feasible or is there a better approach to this(some lib,etc.)?

I would suggest you take a look at Exoplayer since it provides you ways to implement your custom data source by implementing DataSource class. So you can implement the DataSource to use a stream to play the audio. The documentation is a little vague on how to override it but if you are willing to invest a bit of time to look into exoplayer code you will easily figure it out. Though not exactly your scenarion here is one of the POCs to show how custom source can be implemented CustomDataSource

Related

When should JetCreator or SoundPool be used?

I'm trying to make an app and I would liek to try to implement the optimal solution for multiple, simutaneously playing, programmatically selected sound effects.
I really appreciate the help.
Cheers
Well it depends:
Mediaplayer:
Not good for simultaneous playing (you need multiple MP objects), the response time and especially the prepare() methode take a lot of time.
Therefore synchronizing is quite impossible.
SoundPool:
Good for small MP3.files (size limt ~1mb, ~30sec)
Easy to implement
A lot faster than Mediaplayer. Mostly used for "sounds" and not a for complete "piece of music"
Jet Player/JET Creator
Used for MIDI files, quite difficult to install (you need python, wx python in order to use JET creator ...).
Very fast response, good for simultaneous playing of several tracks!
Any further questions? do not hesitate to ask!
best regards

Playing game sounds

I need to play sound effects in my game such as jump, failed, shot etc.
So for this purpose I have selected SoundPool class. But there were some times when it lagged.
So I wonder what is correct way to use this class. I have tried to use play method in new thread, it seems work better but I don't know if I am correct.
Please advice how to use object of this class correctly for better performance.
Best way to implement Sound / Music into your game is by using Service component. Read this answer here for an example.

How to make voice recognition check against a local database in android?

Do you remember in old cellphones you could make a speech shortcut to call a person.
I am trying to make an app in android with that function. The user records a word or sound it wants to control the application with and the voice-recognizer will only check if the sound it hears equals the sound previously recorded.
Does anyone know how to make this or know of a guide? I've been searching for months without finding a satisfying solution.
Thanks
You need to convert both reference sounds and recorded sound to features. For that you need to split sound on frames and extract FFT or directly mel-cepstrum. You can use any MFCC library out there for that.
After you get features, you can compare them with DTW algorithm. You can find some details here
http://en.wikipedia.org/wiki/Dynamic_time_warping
The DTW will return you the threshold which you can use to select the right person to call to.
Similar quesitons is
Simplest algorithm of measuring how similar of two short audio

Android Play sounds in a sequence

I am currently trying to create an android app that plays a different sequence of sounds based on user input. Is there a simple way to play a sequence of sounds I have looked at mediaplayer and soundpool but it does not look like they where designed for sequential.
Thank you RandyFreak that is probably the better way. But I actually Ended up doing it a little differently.
I created a list of fileDescriptors pointing to sounds and added an oncomplete listener to mediaplayer. And every time the media player completed it's current sound it would play the first sound in the list and remove it from the list.
I came across this issue a few months ago.
How I overcame this was I created a different mediaplayer for each sound and played them in the order that I needed.
That would be the simplest method.
I hope this helps
RF

Android AudioRecorder with UI

I want to create an audio recorder I have tried the code I get from http://developer.android.com/guide/topics/media/audio-capture.html and it works fine; it records and it plays back what I have said. But right now I want to create an audio recorder with a UI like in recognizerIntent which Google has provided so that you can see or monitor that your voice has been recorded(sorry I can't find a right term but I'm hoping you can understand what I am trying to say). Do you know any tutorial or links that can help me?thanks for you help!
I think you mean that you want some feedback that your voice is being picked up? If so, perhaps this project, Audalyzer might be a good place to start looking?
Libraries within the package offer you a dB reading, a one and two-dimensional wave form, and an FFT plot.
(source: googlecode.com)
There is a simpler WaveformControl you may find easier to understand and modify for your needs.

Categories

Resources