我创建了一个音频缓冲区并想在播放此声音之前对其进行编辑。我的问题是当数字大于 1 时我会听到很大的噪音。这意味着当我不编辑缓冲区(数据)时,我只能播放没有噪音的缓冲区。背景信息:数据是一个录音缓冲区,包含以下信息:
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;
我的效果类:
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);
}
}