[android-developers] How to sense the amplitude of mic while recording with audiorecord in android ?
i am recording the sound with audiorecord in android and at the same time i want to get notified about the amplitude of the input voice I want to send peak values at interval of times as input to my service . Is it possible . Also wanted to know how to get notified when audio file is finished while playing the media file with audiotrack. I Here is my code import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.util.Log; import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; /** * * @author Dany */ public class RecordSystem { private boolean isRecording; private String fileLocation; public RecordSystem(String fileLocation) { this.fileLocation = fileLocation; } public void stopRecord() { isRecording = false; } public void startRecord() { isRecording = true; int frequency = 11025; int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_STEREO; int audioEncoding = AudioFormat.ENCODING_PCM_16BIT; File file = new File(fileLocation); // delete any previous recording if (file.exists()) { file.delete(); } // create the new file on SD try { file.createNewFile(); } catch (IOException e) { throw new IllegalStateException("Failed to create " + file.toString()); } try { // create a DataOuputStream to write the audio data into the saved // file OutputStream os = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(os); DataOutputStream dos = new DataOutputStream(bos); int bufferSize = AudioRecord.getMinBufferSize(frequency, channelConfiguration, audioEncoding); // create a new AudioRecord object to record the audio // uses the permission 'android.permission.RECORD_AUDIO' in the // manifest AudioRecord audioRecord = new AudioRecord( MediaRecorder.AudioSource.MIC, frequency, channelConfiguration, audioEncoding, bufferSize); short[] buffer = new short[bufferSize]; audioRecord.startRecording(); while (isRecording) { // grab the buffered input (mic) and write it to a file on the // SD int bufferReadResult = audioRecord.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++) { dos.writeShort(buffer[i]); Log.i("result",""+bufferReadResult); } } audioRecord.stop(); audioRecord.release(); dos.flush(); dos.close(); } catch (Throwable t) { Log.e("AudioRecord", "Recording Failed"); } } } / package com.news.sample; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.EOFException; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import android.media.AudioFormat; import android.media.AudioManager; import android.media.AudioRecord; import android.media.AudioTrack; import android.util.Log; public class PlaySystem { private boolean isPlaying; private String fileLocation; public PlaySystem(String fileLocation) { this.fileLocation = fileLocation; } public void stopPlay() { isPlaying = false; } public void startPlay(int playFrequency) { isPlaying = true; int frequency = 11025; int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO; int audioEncoding = AudioFormat.ENCODING_PCM_16BIT; File file = new File(fileLocation); try { InputStream is = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(is); DataInputStream dis = new DataInputStream(bis); int bufferSize = AudioRecord.getMinBufferSize(frequency, channelConfiguration, audioEncoding); // initialize an audiotrack with a different frequency then // originally used for the recording // this wil automatically manipulate the 'pitch' of the sound AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, playFrequency, channelConfiguration, audioEncoding, bufferSize, AudioTrack.MODE_STREAM); // start pla
[android-developers] app freezes and get stucks
my app is an lock screen and during the lock activity i used to load images from the website as slide show. The images will continue to show like an loop and each time the image is downloaded from the net to display on the image view . now, after 20 or 25 minutes the app gets stuck and we cannot unlock the screen and cannot do anything. is there any problem in loading images in image view continuously from the net . or is there any cache like feature that we can clear. my application loads on screen off intent -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] cannot make full functionality of lock slider with the use of seek bar
converted android seek bar to lock slider but how to disable progress change when user single tap on the Seekbar in Android -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to get data From Status bar and disable it?
I am creating a custom lock screen so that in my activity the Status bar won't be there. At the mean time i want to get the the status bar notifications such as missed calls, new chat messages, new emails, new voicemail, etc... How to implement this ... please give me a hint .. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to switch between ANDROID homescreen and our custom homescreen programmatically?
hai, i have developed an android custom lock screen so that the default launcher is replaced with my app. I have done changes in android manifest file to make app as home screen. Now the problem is that i cannot control my app. That means whenever i click the home , my lock screen is come. i wanted to set an option to disable and enable my app. So i wanted to known whether there is no option programmatically(not in manifest file) to make my app activity as homescreen so that i can disable the app when i don't need that. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] CAN WE RUN THE APPLICATION AFTER THE PHONE IS LOCKED AND CONTINUE THE APPLICATION AFTER IT IS UNLOCKED
SIR, I HAVE TO DEVELOP AN APPLICATION JUST LIKE A SCREEN SAVER WITH SLIDE SHOW OF PICTURES, AND WHEN THE PHONE IS UNLOCK , SELECTED PICTURE AND DETAILS SHOULD BE SHOWN FIRST BEFORE GOING TO HOME SCREEN. IS THIS POSSIBLE IN ANDROID. IF POSSIBLE , CAN YOU GIVE ME A HINT , HOW TO DO THAT? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How to develop an android application to play flv files
iam having a list of 10 flv files in my sd card . I need to play the flv files using the media player in android. Is there any possibility and i need to known whether there is any external libraries used to play flv files -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en