Menu
  • HOME
  • TAGS

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

android,codec,pcm,audiorecord,audiotrack

Ok guys, finally I resolved for myself the problem encoding/decoding audio. It's been a annoying task during the last week. The main problem of my code was the encoding was well done but the decoding wasn't so I was working around it and modify these class with the help of...

Why would I get NPE in this state

android,audiorecord

This looks like a concurrency problem. It seems that after the check myRecorder != null, the variable is actually set to null in a different thread, which is possible because as you probably know threads run in parallel. I'd recommend you lock on the object and execute your loop. Then,...

Audio recording using AudioRecord

android,audio-recording,audiorecord

Here, this is my code, which work for me: public class MainActivity extends Activity { AudioRecord record = null; AudioTrack track = null; boolean isRecording; int sampleRate = 44100; Button startRecord, stopRecord, playRecord = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setVolumeControlStream(AudioManager.MODE_IN_COMMUNICATION); startRecord = (Button) findViewById(R.id.start_recording); stopRecord =...

Android AudioRecord send over RTP/UDP

android,audio-recording,rtp,audiorecord

I solved this problem using RtpSocket and RtpPacket classes from SipDroid. Example for the usage is also in the RtpStreamSender and RtpStreamReceiver classes....

Out of memory exception converting raw file to wav in AudioRecorder

android,audiorecord

I have got the solution of this. I created a wave file added default headers before starting the recording and after the recording is finished i am adding the payload to the header.

Meaning of values from Audiorecord.read()

android,audio-recording,audiorecord

The data depends on the parameters you sent to the constructor. AudioRecord (int audioSource, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes) sampleRateInHz is the number of samples per second. channel config is either MONO or STEREO meaning 1 or 2 channels. format is PCM8 or PCM16 meaning 8 bits...

Android AudioRecord cannot find working configuration

android,case-sensitive,android-permissions,audiorecord

After a lot of hours, I finally figured out the problem. If you use the autocomplete feature of Android Studio and type <uses-permission android:name="RECORD_AUDIO" /> followed by enter, Android Studio will fill in <uses-permission android:name="ANDROID.PERMISSION.RECORD_AUDIO" /> This, however does not work, since case apparently matters. No warnings, nothing. After I...

AudioTrack/AudioRecord behaviour depends on the device?

android,audio-streaming,audiorecord,android-audiorecord,audiotrack

Ok solved, it's all about the sample rate and the buffer size.

Automatic Gain Control(AGC) for external mic

android,mediarecorder,android-mediarecorder,audiorecord,android-audiorecord

It's quite likely that the real problem is that his microphone is overdriving the input jack - if that is the case, software can't fix the problem as what the A/D converter sees is already hopelessly distorted. Your client may need to add an attenuator (resistive voltage divider) to the...

AudioRecord Out of Memory Exception

android,exception,memory,out,audiorecord

The solution was destroying (and releasing) the AudioRecord object on every pause and just recreating it on each start.

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

java,android,sampling,audiorecord

You could check if 44100 is supported by your device. Android does not provide an explicit method to check it but there is a work-around with AudioRecord class' getMinBufferSize function. public void getValidSampleRates() { for (int rate : new int[] {8000, 11025, 16000, 22050, 44100}) { // add the rates...

Android record sound of our own app

java,android,audio,audio-recording,audiorecord

Although i did not find answer of my question, but now i am using technique for recording aspects which i want to share with all of you. Above function which i try to use is totally wrong option when you are trying to save music created by your app at...

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

android,audiorecord,android-audiorecord

Sadly, only one app at a time can access the microphone (just like the camera). Also, there is no standard way to inform another app that you want access to the microphone (so that they release the resources and let you access it). You could however send a broadcast to...

AudioRecord.read() method blocks indefinitely on Android 4.3+

android,audiorecord

Your problem may be caused by not releasing the audiorecord after each use. To solve your problem, you may follow those steps: Restart you phone and do not run anything when it start Add code to release your audiorecord somewhere that you want to stop, e.g. onPause(). audiorecord.stop(); audiorecord.release(); Run...

HandlerThread and Handler: how to use AudioRecord.setRecordPositionUpdateListener?

android,multithreading,handler,audiorecord,android-handlerthread

To associate Handler with a certain thread, you should create it by passing corresponding Looper in its constructor. So, if you already have a HandlerThread it can be done in the following way: Looper looper = myHandlerThread.getLooper(); Handler handler = new Handler(looper); And that's it, just use this handler in...