TarsosDSP在Android上应用低通滤波器并保存为wav会产生不流畅的结果。

huangapple go评论78阅读模式
英文:

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.

Original

Filtered

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.

huangapple
  • 本文由 发表于 2020年9月8日 19:03:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/63792569.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定