I am developing VOIP
kind of application. Sending the voice is perfect but when i receive the same voice from the webserver, i am playing back that using AudioTrack
API.
I am calling at.play()
and at.write
in a Thread so that i should get all the voice which is recorded and sent from the other device.
But, now the problem here i m facing is, if there is no voice than its still playing like some bullet sound, i mean there is a continuos background sound when i try to play .
I m using this following function in a Thread:
if (at != null) {
if (at.getPlayState() != AudioTrack.PLAYSTATE_PLAYING) {
at.play();
} else {
if (playing == true) {
System.out.println("BEFORE WRITE");
at.write(playShortData, 0,
playShortData.length);
System.out.println("AFTER WRITE");
at.flush();
playing = false;
}
}
}
How can i remove the background noise if there no voice is send from other device.
I think its playing Junk value when none of them is speaking on other sides, its just sending junk values ..