audiorecord

what will happen when the number of data which is sampled through audio exceed the “bufferSizeInBytes” which is set in AudioRecord constructor?

坚强是说给别人听的谎言 提交于 2019-12-12 15:54:03
问题 public AudioRecord (int audioSource, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes) This is the Public Constructor of AudioRecord , you can find the last parameter called bufferSizeInBytes , and it means "the total size (in bytes) of the buffer where audio data is written to during the recording." in android docs. I thought this is a buffer for storing all data which is sampled from audio hardware. i have a question : If the number of data which is sampled

Issue encoding and decoding an audio recording to G711 ( PCMU - uLaw) format

吃可爱长大的小学妹 提交于 2019-12-12 08:36:00
问题 There isn't too much info about apply this codec when we need to streaming audio. Without apply the codec, my code work like a charm establishing a communication between 2 devices but I need encode/decode in that format because I will need streaming with the server and not between two devices (I am testing this code using 2 devices). I am looking for the chance if anyone of your could see where is the key of my problem. I've tried different configurations of the input parameters. Maybe, the

AudioRecord buffer filled with zeros

北城以北 提交于 2019-12-12 05:25:41
问题 Why is the audioData short[] buffer I create in the code below filled with 0 upon each samplesIn += mRecordInstance.read(audioData, samplesIn, bufferSize - samplesIn); ? The size of the buffer ( audioData.length ) is NOT ZERO which means that the buffer is NOT EMPTY, it's just filled with zeros. I've tried changing the FREQUENCY to 8000 -> no change. I'm implementing the Echoprint library - please refer to this for more information on this should you require it. Proof from LogCat that the

Lame encoded mp3 audio slowed down - Android

社会主义新天地 提交于 2019-12-11 08:34:27
问题 I have been following this tutorial on using LAME mp3 on Android with jni. Recording seems to be working and I am getting an output as mp3 but upon playback the audio has been slowed down and pitched down. I've tried to put all pertinent code below. Any guidance on why this is happening? Thanks in advance for your help. Edit: OK so just to check I imported the raw data into Audacity and that plays back fine so this must be an issue at the encoding stage. Java class: public class Record

android, AudioRecord.read() --> bufferoverflow, how to handle the buffer?

元气小坏坏 提交于 2019-12-11 07:06:27
问题 for a university project my prof. wants me to write an android application, would be my first one. I have some Java experience but I am new to Android programming, so please be gentle with me. First I create an Activity where I have only two buttons, one for starting an AsyncTask and one for stopping it, I mean I just set the boolean "isRecording" to false, everything else is handled in the AsyncTask, which is attached as source code. The thing is running quite okay, but after a while I can

Recording with AudioRecord on Android speeds up the audio?

戏子无情 提交于 2019-12-09 07:18:05
问题 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;

Android: startRecording() called on an uninitialized AudioRecord when SAMPLERATE set to 44100

限于喜欢 提交于 2019-12-08 20:37:47
问题 I get an error, when I set the sampling rate to 44100 for the AudioRecord object. When it's 22050 it works fine. 02-16 10:45:45.099 24021-24021/com.vlad.jackcomms E/AudioRecord﹕ frameCount 1024 < minFrameCount 1792 02-16 10:45:45.099 24021-24021/com.vlad.jackcomms E/AudioRecord-JNI﹕ Error creating AudioRecord instance: initialization check failed. 02-16 10:45:45.099 24021-24021/com.vlad.jackcomms E/android.media.AudioRecord﹕ Error code -20 when initializing native AudioRecord object. 02-16 10

need to understad how AudioRecord and AudioTrack work for raw PCM capture and playback

被刻印的时光 ゝ 提交于 2019-12-08 11:56:41
问题 I use the following code in a Thread to capture raw audio samples from the microphone and play it back through the speaker. public void run(){ short[] lin = new short[SIZE_OF_RECORD_ARRAY]; int num = 0; // am = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE); // -> MOVED THESE TO init() // am.setMode(AudioManager.MODE_IN_COMMUNICATION); record.startRecording(); track.play(); while (passThroughMode) { // while (!isInterrupted()) { num = record.read(lin, 0, SIZE_OF_RECORD_ARRAY);

AudioRecord - Invalid audio buffer size

我是研究僧i 提交于 2019-12-08 06:50:04
问题 I have a problem with below lines when using AudioFormat.ENCODING_PCM_8BIT as AudioFormat. When using AudioFormat.ENCODING_PCM_16BIT these work fine. bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_8BIT); audio = new AudioRecord(MediaRecorder.AudioSource.CAMCORDER, sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_8BIT, bufferSize); logcat: 03-26 10:03:49.643: E/AndroidRuntime(19949): FATAL EXCEPTION: main 03-26 10:03

How to create tuner that runs continuously?

♀尐吖头ヾ 提交于 2019-12-08 05:34:13
问题 I am creating a tuner for Android (similar to a guitar tuner) and I am wondering how to allow the tuner to run continuously (for a couple minutes or so). I don't want it to be a service that runs in the background, just while the user is in my app. I have successfully used the AudioRecord class and am obtaining data that seems correct. I am in the process of filtering this data and finding the fundamental frequency of the input signal, but need help figuring out how to allow my tuner to run