I create an audio buffer and want to edit this before I play this sound. My problem is that i get an big noise when number is more than 1. It means I can only play the buffer without noise when I dont edit the buffer (data). Background informations: data is an audiorecord buffer with following informations:
private static final String TAG = "Aufnahme";
private AudioRecord recorder = null;
private boolean isRecording = false;
private int SAMPLERATE = 44100;
private int CHANNELS = AudioFormat.CHANNEL_CONFIGURATION_MONO;
private int AUDIO_FORMAT = AudioFormat.ENCODING_PCM_16BIT;
private int bufferSize = AudioRecord.getMinBufferSize(SAMPLERATE, CHANNELS,
AUDIO_FORMAT);
private Thread recordingThread = null;
And my effect class :
public class verzerrer {
public void distortion(short[] data) {
output out = new output();
long[] y = new long[data.length];
int number =1000;
for(int i=1;i<data.length;i++){
y[i]=(data[i]/number)*number;
}
for(int i=0;i<data.length;i++){
data[i]=(short) y[i];
}
out.send(data);
}
}