audio - Decibels in android -


i have created application getmaxampitude , converts decibels range of 30db.

does android phone have range of 30db or problem in code?

public class getmaxampitude extends asynctask<void, float, void>{      string db = "";          int ampitude;      float db;      @override     public void doinbackground(void... params) {         while(rec == true){             try{                 thread.sleep(250);             }catch(interruptedexception e){                 e.printstacktrace();             }             ampitude = recorder.getmaxamplitude();             db =(float) (20 * math.log10(ampitude/700.0));             publishprogress(db);         }         return null;     }     public void onprogressupdate(float... progress){          //database.addsounddata(db);         db = (progress[0].tostring()); 

the decibel scale measure relative - , in case of digital audio, customarily largest value sample capable of holding. either 1.0 floating point representations of samples , 32767 signed 16-bit samples. calculated db values negative, 0db being clip.

without knowledge of precisely recorder instance of, assume it's android's mediarecorder - uses signed 16-bit ints.

the correct equation in case therefore be:

db = 20.0 * log10(peakamplitude/32767.0)

the equation you've used above however, merely biases results it's eqivelant to:

db = 20.0 * log10(peakamplitude) - 20.0 * log10(700)

=20.0*log10(peakamplitude) - ~56.9

the dynamic range figure of 30db might not surprising if you're recording onboard microphone , automatic gain control enabled - unless you've taken active steps disable it.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -