java - Obtaining Sound Pressure Level of wav file -
i trying obtain , represent spl of a wav file recorded internal mic of device. problem values getting seem not logic @ all, i´m getting values on 100 db clapping hands can see here:
image http://s2.subirimagenes.com/imagen/previo/thump_8946906screenshot2014060821.png
this doing:
- first of all, wav file saved in 16-bit pcm, operate bytes have unique double value normalized between [-1,1] ( don´t operate first 44 bytes wav header).
- then, following equation spl=10*log(audiosample/iref) obtain each of desired sound levels (being iref=10^-12).
- at end calculate max , min values set margins of plot.
do guys know im doing wrong? think values should around half of ones obtained
here piece of code:
protected void mithread() { thread t=new thread() { public void run(){ //operaciones ope=new operaciones(); double [] st =new double [arr.length]; int j=0; try{ (int = 44; < s; i+=2) { // convert byte pair int double audiosample = (double) (array[i+1] << 8 | array[i] & 0xff)/ 32767.0; arr[j]=audiosample; //double n[j] = (number)arr[j]; //number st[j]=10*math.log10(math.abs((audiosample/math.pow(10, -12)))); //double l[j]=(number)(10*math.log10(math.abs((audiosample/math.pow(10, -12))))); //number if(audiosample == 0.0 ){ if(j!=0){ l[j]=l[j-1]; st[j]=st[j-1]; }else{ l[j]=0.0; st[j]=0.0; } } j=j+1;} min=operaciones.minimum(arr); max=operaciones.maximum(arr); min2=operaciones.minimum(st); max2=operaciones.maximum(st); } catch (nullpointerexception e){ e.printstacktrace(); } handle.post(proceso); } }; t.start(); } final runnable proceso=new runnable(){ public void run(){ //plot.redraw(); //plot2.redraw(); toast.maketext(grafica.this, "ya se ha cargado todo el array", toast.length_long).show(); } };
isnt spl standing sound pressure level compared absolute reference?. microphone plugged 16bit precision port think it
s ok. snr should around 60db have around 44db voice interval. when microphone receives sound signal should go (around 104db if recall 16bit).
spl=20log (pascal/2e-5)
Comments
Post a Comment