英文:
TarsosDSP Android applying lowpass filter and saving to wav gives choppy results
问题
以下是翻译的代码部分:
private void eq2(File file) throws FileNotFoundException {
new AndroidFFMPEGLocator(this);
InputStream inputStream = new FileInputStream(file);
TarsosDSPAudioFormat format = new TarsosDSPAudioFormat(16000, 16, 2, true, false);
AudioDispatcher adp = new AudioDispatcher(new UniversalAudioInputStream(inputStream, format), 2048, 0);
adp.addAudioProcessor(new LowPassFS(100, 16000));
RandomAccessFile raf = null;
raf = new RandomAccessFile(Environment.getExternalStorageDirectory() + "/cibiodLogs/audioFiltered1.wav", "rw");
adp.addAudioProcessor(new WriterProcessor(format, raf));
adp.run();
Thread audioThread = new Thread(adp, "Audio Thread");
audioThread.start();
}
如果您需要更多帮助,请随时提问。
英文:
I am using TarsosDSP library to apply a low pass filter on a wav file. Here is the code.
private void eq2(File file) throws FileNotFoundException {
new AndroidFFMPEGLocator(this);
InputStream inputStream = new FileInputStream(file);
TarsosDSPAudioFormat format = new TarsosDSPAudioFormat(16000,16,2,true,false);
AudioDispatcher adp = new AudioDispatcher(new UniversalAudioInputStream(inputStream,format),2048,0);
adp.addAudioProcessor(new LowPassFS(100,16000));
RandomAccessFile raf = null;
raf = new RandomAccessFile(Environment.getExternalStorageDirectory()+ "/cibiodLogs/audioFiltered1.wav", "rw");
adp.addAudioProcessor(new WriterProcessor(format,raf));
adp.run();
Thread audioThread = new Thread(adp, "Audio Thread");
audioThread.start();
}
It gives output but the output is choppy and not even filtered.
Here take a look at the original wav file and the output wav file.
I have tried different buffer sizes from 2 - 4096 but every time either the output is choppy or the audio is not filtered. Can someone point me what might be going wrong here.
答案1
得分: 0
这个问题现在已经解决了!TarsosDSP不支持双声道音频处理,所以算法在处理两个声道的音频时会混淆,从而导致了不流畅的结果。
英文:
This issue is solved now! The TarsosDSP does not support dual-channel audio processing so the algorithm was getting confused with two channels of audio and thus giving the choppy results.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论