audio - How to mix a recorded voice with prerecorded music in android? -
it's working 2 prerecorded wav files of same characteristics(sample rate,channel,bitspersample etc) recorded voice creates white noises in output.
how can reduce white noise mixed sound?
is there native library that?
byte[] output = new byte[(music1.length > music2.length) ? music2.length : music1.length]; (int = 0; < output.length; i++) { float samplef1 = music1[i] / 128.0f; // 2^7=128 float samplef2 = music2[i] / 128.0f; float mixed = (samplef1 + samplef2) / 2; if (mixed > 1.0f) mixed = 1.0f; if (mixed < -1.0f) mixed = -1.0f; byte outputsample = (byte) (mixed * 128.0f); output[i] = outputsample; }
Comments
Post a Comment