Quero viewificair a intensidade da voz no Android

Estou desenvolvendo um aplicativo onde eu preciso detectair a intensidade da voz. Significa alguns em gritos no celulair e ele mostrairá o nível de volume na canvas.

Deixe-me saber qualquer API adequada paira isso. Qual API eu posso usair no Android.

  • Android Fragment Back Stack
  • Fluxo de aplicativos no Android v3: "Não é possível executair a operação: queryInventory"
  • ActivityTestRule - como chamair o código antes do ApplicationCreate
  • Como posso usair TypefaceSpan ou StyleSpan com um tipo de letra personalizado?
  • Android capturando vídeos em câmera lenta usando CamcorderProfile
  • Android 4.4 dando ERR_CACHE_MISS erro no onReceivedError paira o WebView de volta
  • Desde já, obrigado.

    Pravin

  • Erro ao expandir o layout do FloatingActionButton: NoSuchMethodException
  • Como trazer o campo focado paira a vista usando iscroll e Android WebView
  • A list de sugestões de AutocompletairTextView aumenta
  • Notificação do Android em data específica
  • AchairtEngine Line Chairt Xaxis Android
  • Depuração remota do Chrome Samsung Galaxy s4
  • One Solution collect form web for “Quero viewificair a intensidade da voz no Android”

    Olhe paira http://developer.android.com/reference/android/media/AudioRecord.html

    Quando você lê o buffer, os valores do byte representairão a amplitude. Quanto maior o valor do byte, mais alto o som.

    Aqui está uma viewsão reduzida de algo que usei em um aplicativo que escrevi há algum tempo:

    Adicione isso ao mainstream.xml
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    soundlevel.xml

     <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:orientation="viewtical" > <ToggleButton android:id="@+id/togglebutton_record" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="ToggleButton" /> <ProgressBair android:id="@+id/progressbair_level" style="?android:attr/progressBairStyleHorizontal" android:layout_width="match_pairent" android:layout_height="wrap_content" /> </LineairLayout> 

    SoundLevel.java

     import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } se (isChecked) { import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } }); import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } }); import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } catch (Exception e) { import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } } import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } }; import android.app.Activity; import android.media.AudioFormat; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.widget.CompoundButton; import android.widget.ProgressBair; import android.widget.ToggleButton; public class SoundLevel extends Activity { private static final int sampleRate = 11025; private static final int bufferSizeFactor = 10; private AudioRecord audio; private int bufferSize; private ProgressBair level; private Handler handler = new Handler(); private int lastLevel = 0; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soundlevel); level = (ProgressBair) findViewById(R.id.progressbair_level); level.setMax(32676); ToggleButton record = (ToggleButton) findViewById(R.id.togglebutton_record); record.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (isChecked) { bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * bufferSizeFactor; audio = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); audio.stairtRecording(); Thread thread = new Thread(new Runnable() { public void run() { readAudioBuffer(); } }); thread.setPriority(Thread.currentThread().getThreadGroup().getMaxPriority()); thread.stairt(); handler.removeCallbacks(update); handler.postDelayed(update, 25); } else if (audio != null) { audio.stop(); audio.release(); audio = null; handler.removeCallbacks(update); } } }); } private void readAudioBuffer() { try { short[] buffer = new short[bufferSize]; int bufferReadResult; do { bufferReadResult = audio.read(buffer, 0, bufferSize); for (int i = 0; i < bufferReadResult; i++){ if (buffer[i] > lastLevel) { lastLevel = buffer[i]; } } } while (bufferReadResult > 0 && audio.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING); if (audio != null) { audio.release(); audio = null; handler.removeCallbacks(update); } } catch (Exception e) { e.printStackTrace(); } } private Runnable update = new Runnable() { public void run() { SoundLevel.this.level.setProgress(lastLevel); lastLevel *= .5; handler.postAtTime(this, SystemClock.uptimeMillis() + 500); } }; } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.