Note that there are some explanatory texts on larger screens.

plurals
  1. POgetMaxAmplitude() "always" reached
    primarykey
    data
    text
    <p>I want my app to react on a load sound like a clap. The problem is, that <code>getMaxAmplitude()</code> reaches it's maximum of 32762 even when talking in a normal voice which is <code>&gt;= my "allMaxAmpli"</code> variable set in the config mode.</p> <p>The media recorder is set up like this:</p> <pre><code>mrec = new MediaRecorder(); mrec.setAudioSource(MediaRecorder.AudioSource.MIC); mrec.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mrec.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); [..] mrec.setOutputFile(audiofile.getAbsolutePath()); mrec.prepare(); mrec.start(); </code></pre> <p>and the check is done like this (abstracted):</p> <pre><code>int maxAmp = mrec.getMaxAmplitude(); if (maxAmp &gt;= CalibAmp) Log.v("ID", "Max Amp is greater!"); </code></pre> <p>Did i miss something? </p> <p>Is there some other way to measure the volume, or increasing the limit for getMaxAmplitude? I thought about using AudioRecord, but then i'd have to calculate the amplitude by hand. I wanted to save myself from that.</p> <p>I searched for quite a bit before considering posting, but i was unable to find anything. Any help would be appreciated.</p> <p>/Edit: If i calculate the decibel out of the amplitude, will this get other values? This might solve the problem then.</p> <p>/Edit2: I calculated the decibel out of the amplitude, but the problem persists, since the Amplitude is so high all the time. Nobody has an idea? :/</p> <p>/Edit3: After testing some other Apps it seems that this is a general problem with Android. So that is why every sound measuring app is free..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload