Skip to main content

audiorecord is not working properly while using audiotrack in galaxy y



i have written a code which records voice using audiorecord and at the same times it plays that recorded sound using AudioTrack. the main portion of the code is following -







AudioRecord audioRecord = new AudioRecord(

MediaRecorder.AudioSource.MIC, 8000,

AudioFormat.CHANNEL_CONFIGURATION_MONO,

AudioFormat.ENCODING_PCM_16BIT, 16 * 1024);

audioRecord.startRecording();



AudioTrack audioPlayer = new AudioTrack(AudioManager.STREAM_VOICE_CALL, 8000,

AudioFormat.CHANNEL_CONFIGURATION_MONO,

AudioFormat.ENCODING_PCM_16BIT, 16 * 1024, AudioTrack.MODE_STREAM);

audioPlayer.play();



for (int i = 0; i < 500; i++) {

int n = audioRecord.read(recordBuffer, 0, 160);

audioPlayer.write(recordBuffer, 0, n);

}







...........





This code works perfectly in other device . but in galaxy y , its creating problem. in galaxy y its showing obtainbuffer timed out in audiotrack. i run this code successfully in other devices. and i also checkhed that if i write the recorded sound in any file in place of using audiotrack then its working. even while using 44100 hz its working. but while using the exact above code there is nothing but some noise. please help


Comments

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.