Code example for MediaRecorder

Methods: getMaxAmplitude

0
	@Kroll.getProperty 
	public int getSoundAmplitude() { 
		if (recorder != null) {
			try { 
				// Convert from 16-bit sample value to dBFS 
				return (int)(20.0 * Math.log10((double)recorder.getMaxAmplitude() / 32767.0));
			} catch (RuntimeException e) {
			} 
		} 
		 
		return 0; 
	} 
	 
	@Kroll.getProperty 
	public boolean getIsRecording() { 
		return recorder != null;
	} 
}