Note that there are some explanatory texts on larger screens.

plurals
  1. POGet decibel values whilst recording sound?
    primarykey
    data
    text
    <p>Is there a way of getting the decibel value of sound whilst it's being recorded? I'm using <code>MediaRecorder</code> to record the sound at the moment</p> <p>I can't use any applications on the Marketplace as I can't be sure the user will have it installed on their phone e.g. Audalyzer</p> <p>I'm using the following formulas but not sure if they're correct or if my results are correct!</p> <pre><code>short data[] = new short[bufferSize]; read = recorder.read(data, 0, bufferSize); double p2 = data[data.length-1]; System.out.println("p2: " + p2); double decibel; if (p2==0) decibel=Double.NEGATIVE_INFINITY; else decibel = 20.0*Math.log10(p2/65535.0); System.out.println("p2/65535: " + (p2/65535.0)); System.out.println("decibel: " + decibel); </code></pre> <p>Current results: </p> <pre><code> 01-11 16:43:03.821: I/System.out(14530): p2: 0.0 01-11 16:43:03.821: I/System.out(14530): p2/65535: 0.0 01-11 16:43:03.821: I/System.out(14530): decibel: -Infinity 01-11 16:43:03.911: I/System.out(14530): p2: 0.0 01-11 16:43:03.911: I/System.out(14530): p2/65535: 0.0 01-11 16:43:03.911: I/System.out(14530): decibel: -Infinity 01-11 16:43:04.001: I/System.out(14530): p2: 0.0 01-11 16:43:04.001: I/System.out(14530): p2/65535: 0.0 01-11 16:43:04.001: I/System.out(14530): decibel: -Infinity 01-11 16:43:04.091: I/System.out(14530): p2: 0.0 01-11 16:43:04.091: I/System.out(14530): p2/65535: 0.0 01-11 16:43:04.091: I/System.out(14530): decibel: -Infinity 01-11 16:43:04.191: I/System.out(14530): p2: 0.0 01-11 16:43:04.191: I/System.out(14530): p2/65535: 0.0 01-11 16:43:04.191: I/System.out(14530): decibel: -Infinity 01-11 16:43:04.281: I/System.out(14530): p2: 0.0 01-11 16:43:04.281: I/System.out(14530): p2/65535: 0.0 01-11 16:43:04.281: I/System.out(14530): decibel: -Infinity 01-11 16:43:04.371: I/System.out(14530): p2: 0.0 01-11 16:43:04.371: I/System.out(14530): p2/65535: 0.0 01-11 16:43:04.371: I/System.out(14530): decibel: -Infinity </code></pre>
    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.
 

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