audiorecord

AudioRecord records intermittent sound in Android L Developer Preview

喜你入骨 提交于 2019-12-03 12:39:33
I'm recording sound with AudioRecord in PCM16LE format, 8000Hz, 1channel. It records ok in Android versions 2.3.3-4.4.4, but records strange intermittent sound in Android L(5.0) Developer Preview (on nexus 5, nexus 7 and emulator). Here is the sample of recorded sound (the first half - recording, the second half - playback): https://www.dropbox.com/s/3wcgufua5pphwtt/android_l_sound_record_error.m4a?dl=0 I tried to play recorded sound using different sample rate (4000, 16000) and as 8bit but sound keeps to be intermittent. What the problem could be with this sound? I'm using this

AudioFlinger could not create record track, status: -1 , Need help to ifx

痞子三分冷 提交于 2019-12-03 11:14:51
public class AudioRecorderActivity extends Activity { private static final int RECORDER_SAMPLERATE = 8000; private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_IN_MONO; private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT; private AudioRecord recorder = null; private static final String TAG = "AudioRecorderActivity"; short[][] buffers = new short[256][160]; int ix = 0; private boolean stopped = false; private void startRecording() { android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO); try { int N = AudioRecord

Recording with AudioRecord on Android speeds up the audio?

廉价感情. 提交于 2019-12-03 08:32:07
I am using AudioRecord to record raw audio for processing. The audio records entirely without any noise but when the raw PCM data generated is played back, it plays as if it has been speeded up a lot (upto about twice as much). I am viewing and playing the PCM data in Audacity. I am using actual phone (Samsung Galaxy S5670) for testing. The recording is done at 44100 Hz, 16 bit. Any idea what might cause this? Following is the recording code: public class TestApp extends Activity { File file; OutputStream os; BufferedOutputStream bos; AudioRecord recorder; int iAudioBufferSize; boolean

Android AudioRecord fails to initialize

 ̄綄美尐妖づ 提交于 2019-12-02 03:20:29
问题 I've been having an issue with using AudioRecord for Android. I've read as much as I can find online about it, but I cannot seem to get a good initialization. I have tried the Android 2.2 emulator, 1.5 emulator and my phone, an HTC Incredible running Froyo. The emulators and my phone fail initialization. I've tried sampling rates of 8000, 11025, and 44100, formats of CHANNEL_IN_MONO/STEREO and CHANNEL_CONFIGURATION_MONO/STEREO, 8bit and 16bit encoding (8 bit makes the getMinBufferSize fail),

Android AudioRecord fails to initialize

空扰寡人 提交于 2019-12-01 23:26:21
I've been having an issue with using AudioRecord for Android. I've read as much as I can find online about it, but I cannot seem to get a good initialization. I have tried the Android 2.2 emulator, 1.5 emulator and my phone, an HTC Incredible running Froyo. The emulators and my phone fail initialization. I've tried sampling rates of 8000, 11025, and 44100, formats of CHANNEL_IN_MONO/STEREO and CHANNEL_CONFIGURATION_MONO/STEREO, 8bit and 16bit encoding (8 bit makes the getMinBufferSize fail), and AudioSource of MIC and DEFAULT. All result in the variable test becoming 0 after running a get

Unable to access microphone when another app is using it in Android

我与影子孤独终老i 提交于 2019-11-30 19:17:26
I'm using code from the following URL in order to get sound data from the microphone with AudioRecord: http://www.dreamincode.net/forums/topic/303235-visualizing-sound-from-the-microphone/ The problem I'm seeing is that if another app is also using the microphone, I'm getting an error (status -3) from AudioRecord. Everything works as expected if I kill the other app which is using the microphone. Is there an elegant solution to allow my app to access the microphone even if another app is already using it? Thank you. Sadly, only one app at a time can access the microphone (just like the camera)

Unable to access microphone when another app is using it in Android

ぐ巨炮叔叔 提交于 2019-11-30 16:57:16
问题 I'm using code from the following URL in order to get sound data from the microphone with AudioRecord: http://www.dreamincode.net/forums/topic/303235-visualizing-sound-from-the-microphone/ The problem I'm seeing is that if another app is also using the microphone, I'm getting an error (status -3) from AudioRecord. Everything works as expected if I kill the other app which is using the microphone. Is there an elegant solution to allow my app to access the microphone even if another app is

Android audio FFT to display fundamental frequency

南楼画角 提交于 2019-11-30 14:19:11
问题 I have been working on an Android project for awhile that displays the fundamental frequency of an input signal (to act as a tuner). I have successfully implemented the AudioRecord class and am getting data from it. However, I am having a hard time performing an FFT on this data to get the fundamental frequency of the input signal. I have been looking at the post here, and am using FFT in Java and Complex class to go with it. I have successfully used the FFT function found in FFT in Java, but

AudioRecord and AudioTrack latency

老子叫甜甜 提交于 2019-11-30 13:53:06
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 play it modified mPlayer.write(mBuffer, 0, mBufferSize); //Log.v("MY AMP","ARA"); } And the

Android : recording audio using audiorecord class play as fast forwarded

[亡魂溺海] 提交于 2019-11-30 10:32:31
I am trying to record a audio & stores into a sdcard as well as send to server. When I am trying to play recorded voice its playing,but not as I have recorded. If I record voice for 10mins it ll play for 4min i.e someone has pressed fast forward button with some noisy sound. I am not getting where I am going wrong. Can anybody say me how to solve this problem (should play how much i have recorded i.e 10min recorded then should play only 10mins). Here is the code.. sorry for posting bulk code.. public class Audio_Call extends Activity { private static final int RECORDER_BPP = 16; private static