Android examples for android.media:Audio
is audio data Silence
public class Main{ public static boolean isSilence(short[] data) { boolean silence = false; int RMS_SILENCE_THRESHOLD = 2000; if (rootMeanSquared(data) < RMS_SILENCE_THRESHOLD) { silence = true;/* w w w . j a v a2 s .c o m*/ } return silence; } public static double rootMeanSquared(short[] nums) { double ms = 0; for (int i = 0; i < nums.length; i++) { ms += nums[i] * nums[i]; } ms /= nums.length; return Math.sqrt(ms); } }