android-audiorecord

Android AudioRecord to File then use AudioTrack for Playback

最后都变了- 提交于 2020-01-30 02:38:50
问题 Basically, I use AudioRecord to record a sound file to sdcard directory. It records for 5 seconds and then playback using AudioTrack. Well, for me, the recorded file doesn't exist. Maybe it didn't record successfully. Anything I did wrong in recording? what about the playback portion? public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); int minBufferSize = AudioTrack.getMinBufferSize(44100, AudioFormat.CHANNEL_CONFIGURATION_MONO,

AudioRecord and AudioTrack latency

我的梦境 提交于 2020-01-10 19:36:07
问题 I'm trying to develop an aplication like iRig for android, so the first step is to capture the mic input and play it at the same time. I have it, but the problem is that i get some latency that makes this unusable, and if I start processing the buffer i'm afraid it will get totally unusable. I use audiorecord and audiotrack like this: new Thread(new Runnable() { public void run() { while(mRunning){ mRecorder.read(mBuffer, 0, mBufferSize); //Todo: Apply filters here into the buffer and then

Android AudioRecord with CHANNEL_IN_STEREO read raw Audio buffer resulted in mixed Left and Right audio

我们两清 提交于 2020-01-09 03:58:04
问题 I am trying to record an audio with CHANNEL_IN_STEREO configuration in which i am telling audio recorded to record audio in two channel. But after storing buffer array from recorder Audio left channel and right channel is resulting as mix. I cannot separate Audio Left channel and Right channel. Below is code written for same : import androidx.appcompat.app.AppCompatActivity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android

AudioRecord sometimes skips audio data

偶尔善良 提交于 2020-01-02 10:28:28
问题 I use AudioRecord for recording audio in wav files. I perform read() operation in a loop on secondary thread and the data is passed into a queue in another sec. thread for writing in a file. The issue is the following: When I choose to save the audioData in the external SD card, the audio contains some millisc of skips/distortions (only sometimes). Other users has this issue when saving on internal SD card too This is how I instantiate the AudioRecord object: initBufferSize =

How to detect when there is some speech near MIC in Android

心已入冬 提交于 2020-01-02 08:21:30
问题 Question Statement: I want to start recording when there is some Voice/Noise in vicinity of Phones MIC and stop when user stops speaking. Just Like Talking Tom etc. Is there any third party library or some native code to do this? Thanks 回答1: Just add this code to your application and you will detect when user start to speak and when he stops. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get the minimum buffer size

How to detect when there is some speech near MIC in Android

主宰稳场 提交于 2020-01-02 08:21:23
问题 Question Statement: I want to start recording when there is some Voice/Noise in vicinity of Phones MIC and stop when user stops speaking. Just Like Talking Tom etc. Is there any third party library or some native code to do this? Thanks 回答1: Just add this code to your application and you will detect when user start to speak and when he stops. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get the minimum buffer size

How to detect when there is some speech near MIC in Android

ぐ巨炮叔叔 提交于 2020-01-02 08:21:02
问题 Question Statement: I want to start recording when there is some Voice/Noise in vicinity of Phones MIC and stop when user stops speaking. Just Like Talking Tom etc. Is there any third party library or some native code to do this? Thanks 回答1: Just add this code to your application and you will detect when user start to speak and when he stops. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get the minimum buffer size

Audio Recording in Stereo giving same data in Left and Right channels

回眸只為那壹抹淺笑 提交于 2019-12-30 05:24:37
问题 I am trying to record and process audio data based on differences in what gets recorded in the left and right channel. For this I am using Audio Record class, with MIC as input and STEREO mode. recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); My issue is that I get exactly the same data in both the channels. (alternate samples are separated to get individual channel inputs). Please help. I am not

Sample Rate in Android Audio Record class and MediaRecord class

为君一笑 提交于 2019-12-25 16:46:14
问题 i want to know what is the difference between setting audio sample rate in Android AudioRecord class and Media record class? In audio record class we set sample rate while creating an object of the class like recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, SampleRateInHz, RECORDER_CHANNELS,RECORDER_AUDIO_ENCODING, bufferSize); while in MediaRecorder class we set explicitly through a function call. i.e. mrec.setAudioSamplingRate(samplingRate); I tried both but effect of sample rate

Audio/FFT Library Design

梦想的初衷 提交于 2019-12-25 07:14:33
问题 I have a library which records real time audio and computes real time FFT data for the audio. The client must call a start method to start the recording, and a stop method to end the recording. My design question is concerning the best way to get this data back to the client. I have considered the following approaches: Have a method called getData(int size) that the client will call periodically after they have started the recording. It will return up to size audio samples, or as much data as