Android :: How To Capture Audio Data From Mic Into A Buffer?
Sep 24, 2009
I am working on a packet switched network. I want to capture the audio data from mic into a buffer at a desired sample rate.How can I capture the audio data from mic into a buffer instead of a file? Also how can I control the audio capture rate as per the desired sample rate?
View 2 Replies
Jun 17, 2009
This may be impossible but is there any way that I can get a smaller buffer size for AudioTrack than what is provided by getMinBufferSize method?
This is how I am instantiating AudioTrack right now: SR = 44100; bufSize = AudioTrack.getMinBufferSize(SR, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT); audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, SR, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufSize, AudioTrack.MODE_STREAM);
With sample rate of 44100, getMinBufferSize always returns 4800. If I try to make the buffer size smaller than 4800 then I get the following error message: E/AudioTrack( 318): Invalid buffer size: minFrameCount 1200, frameCount 600 E/AudioTrack-JNI( 318): Error initializing AudioTrack E/AudioTrack-Java( 318): [ android.media.AudioTrack ] Error code -20 when initializing AudioTrack. D/AndroidRuntime( 318): Shutting down VM W/dalvikvm( 318): threadid=3: thread exiting with uncaught exception (group=0x4000fe70) E/AndroidRuntime( 318): Uncaught handler: thread main exiting due to uncaught exception I/CheckinService( 59): From server: Intent { action=android.server.checkin.FOTA_CANCEL } E/AndroidRuntime( 318): java.lang.RuntimeException: Unable to start activity Does anyone has any ideas how to over come this problem?
View 2 Replies
View Related
Mar 4, 2010
I am currently trying to create an Android application that loops Audio from the mic to the earpiece, I can do that perfectly but when I do it over and over again in my application I eventually get an Out Of Memory Error.
Here is the code I use to create the Audio Loop:
CODE:.................
And here is the error I get:
CODE:........................
So the Error specifically focuses on this line in the code
CODE:.................
And it happens after I try to do the Loop several times, so say I start the application and after 10 times starting the loop I get the error.
So I think the buffer is simply becomiing full or something?? Is that correct? If so how would I keep clearing out the buffer?
View 1 Replies
View Related
Nov 14, 2009
The following works fine on a G1 but gives an error on the Samsung Galaxy. I was hoping cross-platform support would be better than this. See error below.
private final static int RATE = 44100; private final static int CHANNEL_MODE = AudioFormat.CHANNEL_CONFIGURATION_MONO; private final static int ENCODING = AudioFormat.ENCODING_PCM_16BIT; private AudioRecord recorder_; public boolean open() { int bufferSize = 4 * AudioRecord.getMinBufferSize(RATE, CHANNEL_MODE, ENCODING); recorder_ = new AudioRecord(AudioSource.MIC, RATE, CHANNEL_MODE, ENCODING, bufferSize);
last line gives the following on the Samsung Galaxy phone: 11-14 19:04:07.507: ERROR/AndroidRuntime(7617): java.lang.IllegalArgumentException: Invalid audio buffer size.
View 5 Replies
View Related
Jan 16, 2010
I'm writing an App that needs to continuously record audio in memory and email the last 30 seconds of audio when required. Much of the mediarecorder API is designed to store linear audio in files. Could anybody point me towards a way to continuously record audio in memory, using a circular buffer using the SDK?
View 2 Replies
View Related
Oct 9, 2009
My application cannot handle the JNIE overhead, as I need to make 2 JNIE calls to the native C/C++ code for every 20msec. So I am trying to use the native media libraries and the realted C/C++ files provided by Android in the folder "//external/srec/audio/test" of the donut build. Ex. AudioHardwareRecord, AudioInRecord etc.. I am implementing all the calls in the native layer.
I am using the sampling rate as 8000 and want to read 160 samples (320 bytes) at a time.
I used the following values to create the AudioRecord..
CODE:..........
It says "success" after creating this interface but I am getting the error "Bad Value" if I am doing the InitCheck.
And it is crashing once I start reading the samples or if I try to retrieve the configured sampling rate.
Has anybody tried to access this native code?
View 4 Replies
View Related
Dec 29, 2009
Don't know if anyone over here cares, but zefie over on SamsungMomentForum.com released a custom kernel with a bunch of fixes. Including a partial audio buffer fix, and a bunch of tweaks and optimizations. Also, persistent root so you can run a bunch of those programs on the market that require it. No WiFi tethering yet, but it is being worked on. Not sure if this includes the battery notification fix because I had already installed CL14 the other day and it's been working for me ever since. This was not difficult to install, once you have the software and drivers required, the update takes less than 30 seconds.
Here's a link:
Time for the first custom "ROM" (well kernel)
View 19 Replies
View Related
Jun 3, 2009
As a first step toward a speech recognition project, we wrote a simple voice recording application based on the information in this thread:
http://groups.google.com/group/android-developers/browse_thread/threa...
It is working; however, the audio is extremely poor too static for our needs. As a comparison, we did a similar audio file captured with audacity on a PC and it was much better. Has anyone been able to record high quality audio with the android dev phone? According to the documentation of MediaRecorder, there is only one audio encoder "AMR (Narrowband) audio codec" and three output formats--3gpp, mpeg, and raw AMR:
http://developer.android.com/reference/android/media/MediaRecorder.html
According to wikipedia, AMR encoding is only 8hz. Is there a better option available perhaps a lower-level API compared to MediaRecorder? We are testing on Windows XP, with a Logitec USB microphone, eclipse ganymede, and we are using all the defaults for an android 1.5 app (no emulator command-line options. We defined the SD card in AVD manager).
View 2 Replies
View Related
Aug 4, 2009
Have some tryed to pas databuffer on android by jni?
View 6 Replies
View Related
Nov 6, 2009
I want to capture audio and along with the audio I also want to show the live signal strength of the audio on the screen.
Is there ant api that give me information regarding the the loudness level (or at least some information indicating whether the user is silent or speaking something) of the audio or should I implement my own signal processing using the captured buffers and determine the level.
View 2 Replies
View Related
Sep 23, 2009
I am working on a VOIP based application. I need to capture the audio from mic at 8000 hz sampling rate, get the 20msec packets, encode and send the packets over the network.
Can somebody tell me how to configure the mic for the desired sampling rate?
View 3 Replies
View Related
Mar 16, 2010
I have experienced some trouble using VBOs, since the method glBufferData crashes when I try to copy data to the vertex buffer. Below is the smallest snippet of code that I found to generate the crash:
int numVert = 32; GL11 gl11 = (GL11)gl; testArray = new int[numVert * 3]; testBuffer = IntBuffer.wrap(testArray); gl11.glGenBuffers(1, testID, 0); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, testID[0]); final int siz = testBuffer.capacity() * Integer.SIZE; gl11.glBufferData(GL11.GL_ARRAY_BUFFER, siz, testBuffer, GL11.GL_STATIC_DRAW); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
testArray, testBuffer and testID are members of the class containing this code, declared as follows:
int[] testArray; IntBuffer testBuffer; int[] testID = {0};
I tried this code in several OpenGL applications which don't show any problem otherwise. The crash occurs specifically at the glBufferData() method call. If numVert is set to zero, then the crash doesn't occur.
View 4 Replies
View Related
Apr 1, 2010
I'm using this kind of code for my TCP/IP connection:
sock = new Socket(host, port);
sock.setKeepAlive(true);
din = new DataInputStream(sock.getInputStream());
dout = new DataOutputStream(sock.getOutputStream());
Then, in separate thread I'm checking din.available() bytes to see if there are some incoming packets to read. The problem is, that if a packet bigger than 2048 bytes arrives, the din.available() returns 2048 anyway. Just like there was a 2048 internal buffer. I can't read those 2048 bytes when I know it's not the full packet my application is waiting for. If I don't read it however - it'll all stuck at 2048 bytes and never receive more. Can I enlarge the buffer size of DataInputStream somehow? Socket receive buffer is 16384 as returned by sock.getReceiveBufferSize() so it's not the socket limiting me to 2048 bytes. If there is no way to increase the DataInputStream buffer size - I guess the only way is to declare my own buffer and read everything from DataInputStream to that buffer?
View 4 Replies
View Related
Jun 2, 2009
As a first step toward a speech recognition project, we wrote a simple voice recording application based on the information in this thread: http://groups.google.com/group/android-developers/browse_thread/threa...
It is working; however, the audio is extremely poor -- too staticy for our needs code...
As a comparison, here is a similar audio file captured with audacity on a PC: http://juzzam.org:9090/myAudioFile_onPC.mp3
Has anyone been able to record high quality audio with the emulator? If not, is it any better on the android dev phone?
According to the documentation of MediaRecorder, there is only one audio encoder "AMR (Narrowband) audio codec" and three output formats--3gpp, mpeg, and raw AMR: http://developer.android.com/reference/android/media/MediaRecorder.html
Here is the Activity source: http://juzzam.org:9090/RecordMicrophone.java.txt
We are testing on Windows XP, with a Logitec USB microphone, eclipse ganymede, and we are using all the defaults for an android 1.5 app (no emulator command-line options.. we defined the sdcard in the avd manager).
View 2 Replies
View Related
Mar 20, 2009
Does anybody knows how can i capture data packets transmitted/ received by Dev Phone (real hardware)? this is very important in development stage.In emulator it's very easy, just start wireshark.I need to do the same in real hardware. Anybody knows?
View 2 Replies
View Related
Nov 4, 2008
One of the winners of the Google app contest was Jigsaw by Mikhail Ksenzov, an app to capture and process whiteboard data. The app isn't in the market, and I can't find anything via Google about it's status. Is it still beta, or what?
View 1 Replies
View Related
Jun 11, 2010
Currently I want to develop one Activity to allow the user to see the screens/activites of all running tasks , then the user can select one of them to switch it to foreground. As I known, HTC Sence seems already to have this implementation for Home screen, to display the thumbnail of all Home panels in one screen. Does anybody know how to access screen stack in Android?
View 1 Replies
View Related
Feb 21, 2013
I am a developer with an existing android app. Users have asked for a wifi only mode to avoid roaming charges when traveling. I believe I have set it all up successfully but want to be able to validate that theory..
What I am trying to figure out is if there is an app or other way to trap the data coming out of the app via the cell network (lots of background web service calls). Since I do not own all of the web services, I cannot trap from the server side.
I basically want to turn on a trace like you would do in SQL, and look at what is being transmitted on the phone when wifi is off but cell is on. I don't need the actual packets, just that a call was made to one of my https services. If a call is made in wifi only mode, then I know I didn't get everything.
View 1 Replies
View Related
Dec 9, 2009
I am streaming an MP3 audio and instead making this MP3 audio to play, I want it to be converted to PCM format and pass this PCM audio to AudioTrack(as it takes PCM data as input.) instead of passing my MP3 stream to MediaPlayer. Can anyone please help me to convert the MP3 to PCM stream?
View 3 Replies
View Related
Apr 10, 2009
I want to develop an app that lets one intercept raw audio data sent for playback (possibly by a different app), and apply audio enhancements over this raw data.Does Cupcake allow such filtering of audio data? If so, which API should I use? I understand this may not be possible at an application level for security reasons.I'm trying to see if this is possible with native code linking to public or private API of Android.
View 3 Replies
View Related
Jun 27, 2009
First of all, sorry for my bad english. I'm new into Android application development, just experimenting with the emulator and the SDK. I have searched with some keywords on the developer group, but i didn't find what i need. I'm searching for classes which with i can do simple audio DSP on locally stored audio files. e.g. i like to do crossfade/overlap on MP3 files, and an overall automatic gain control/ equalization on the realtime mix . As i see i can use the AudioTrack class to send raw PCM data to the audio hardware, so i could implement the DSP in java, but i don't see any way to use the internal decoders to grab decoded PCM frames from encoded audio files (like MP3, OGG, AAC). I thought about using Java decoder implementations like JLayer to do the decoding but that's a very CPU intensive approach which is not good for e.g. a media player application which runs in the background. Is there any classes for using the platforms builtin decoders, or should i "port" some available decoders with NDK to my application?
View 5 Replies
View Related
Apr 5, 2010
I am trying to write a streaming application.I have my own decoder and I am playing PCM audio using AudioTrack. At any point in time I want to know how much data is buffered with the device. I want to use this so that if the data with the device go below a level, I want to go into a buffering mode where I will buffer 2-3 seconds of data before continuing playback again. Can someone please tell me how to do this?
View 5 Replies
View Related
May 4, 2010
I've been trying to understand how to get data about all the audio files in the device using MediaAudio but unfortunately the documentation is far from clear. Also, thereīs almost nothing about it on the forum right now and I couldnīt find good resources over the internet.
Iīve seen pretty quick and objective examples on how to access the main information from the containers but I couldnīt find in any place how I could get the names of the tracks (MediaStore.Audio.AudioColumns doesnīt have an specific constant for it) and the most important, how I could retrieve the path for the media (audio file in this case) Iīve found using the info on MusicStore.Audio.
am I missing something here? It seems it should be so easy but I canīt find the info! Also if I change any data on the container, will this data be also changed in the real file as well?
You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
View 4 Replies
View Related
Jul 7, 2010
Just taken delivery of a UK edition Samsung Galaxy S. Connecting it to my car audio via bluetooth no problems but it drops the 3G/H network connection as soon as it connects to the car. Disconnect the Bluetooth and I get the data connection back. Is this deliberate or a bug? It means I can't receive emails etc whilst in my car unless I turn off Bluetooth.
View 1 Replies
View Related
Jul 13, 2010
We are supposed to cache textual and audio data in our application until device is booted or maximum of two days, whichever happens earlier. To get a perspective on data to be cached, note that we are to store about 200 text headers containing around 10 fields, each of length 30 bytes and about 20 sound files each about a minute long.We are getting the textual data by parsing XMLs and then we keep them in ArrayLists. The sound files are directly written inside the app storage using File I/O (and not on SDcard or Apps Cache directory).This application is to be run on devices running Android 1.5 or later.I understand, and please correct me if I am wrong, that we can cache the files either on SDcard or inside the application or inside applications Cache directory.
View 2 Replies
View Related
Feb 25, 2010
Short version: What is the best way to get data encoded in an MP3 (and ideally in an AAC/Ogg/WMA) into a Java array or ByteBuffer that I can then manipulate?I'm putting together a program that has slowing down and speeding up sound files as one of its features. This works fine for WAV files,which are a header plus the exact binary data that needs to be sent to the speaker, and now I need to implement it for MP3 (ideally, this would also support AAC, Ogg, and WMA, but since those are less popular formats this is not required). Android does not expose an interface to decode the MP3 without playing it, so I need to create that
interface.
View 1 Replies
View Related
Aug 5, 2010
I am trying to send an audio file converted to a byte array with SMS using SMSManager.sendDataMessage.But, I am unable to send it to other phone. Can any suggest how can I do it?
View 1 Replies
View Related
Feb 11, 2009
I have the following problem: I'd like to see the system log of two days ago and I cannot. I see only 3 last hours. How can I configure the system log size, location, severity?
View 6 Replies
View Related
Mar 21, 2009
Is it possible to generate an EGL Config with an alpha buffer on the G1? When I request a non-zero number of bits for the alpha buffer I can get a R5G5B5A1 or R8G8B8A8 visual, but neither of them renders correctly to the screen. I assume that's because the G1 only supports R5G6B5 visuals. It does surprise me that I can even get those visuals though. It's fairly obvious looking at the 32bpp visual artifacts that the frame buffer is indeed laid out with 32bpp, but display hardware is treating it as 16bpp, resulting in the left and right halves of my scene rendering in alternate scan lines, with distorted colors. So does anyone know if there is any way to get an alpha buffer on the G1? I've tried using FBO's but they don't seem to be implemented either. Or I'm using them incorrectly. If I call glGenFrameBuffersOES on a GL11ExtensionPack reference I get an UnsupportedOperationException. I am getting my GL11ExtensionPack reference by casting the return value from my EGLContext.getGL() call.
View 2 Replies
View Related
May 24, 2009
Since Google groups doesn't let you add posts to threads more than 60 days old, and I want to leave a solution to the problem I encountered a while back, I'm posting this message with the same title in hopes that anyone running into the problem I had will find this message as well. I was having trouble getting my G1 to render an RGBA_8888 OpenGL context to the screen. Everything was twice the size it should be because the 8888 pixels were being interpreted as two 565 pixels. The colors were obviously wrong as well. I had missed a critical function call. You must configure the Surface that is being used by EGL using the SurfaceHolder method setFormat. The pixel format needs to be TRANSLUCENT, or more specifically you can use RGBA_8888.
View 2 Replies
View Related