TarsosDSP 音高偏移伪像

问题描述

我正在尝试读取 .wav 文件,改变音高,然后将其写入 android 上的新文件。我正在使用 tarsosdsp 来执行此操作,但在新文件中不断出现奇怪的工件。我尝试了单个正弦波,这是文件的前几个样本的比较方式:

image comparison

橙色为原始文件,蓝色由tarsos生成。据我所知,与 github 上的音高移位示例相比,我没有处理差异。这是我的代码

    File directory = getDir("audio",Context.MODE_PRIVATE);

    String source = directory.toString() + "/" + "in.wav";
    String target = directory.toString() + "/" + "out.wav";
    RandomAccessFile outputFile = null;
    try {
        outputFile = new RandomAccessFile(target,"rw");
    } catch (FileNotFoundException e) {
        e.printstacktrace();
    }

    int bitsPerSample = 16;
    int channels = 1;
    tarsosdspAudioFormat format = new tarsosdspAudioFormat(SAMPLE_RATE,bitsPerSample,channels,true,false);

    double cents = 0;
    double factor = centToFactor(cents);
    RateTransposer rateTransposer = new RateTransposer(factor);
    WaveformSimilarityBasedOverlapAdd wsola = new WaveformSimilarityBasedOverlapAdd(WaveformSimilarityBasedOverlapAdd.Parameters.musicDefaults(factor,SAMPLE_RATE));

    WriterProcessor writer = new WriterProcessor(format,outputFile);

    try {
        InputStream inputStream = new FileInputStream(source);
        UniversalAudioInputStream uStream = new UniversalAudioInputStream(inputStream,format);
        print(wsola.getInputBufferSize());
        print(wsola.getoverlap());

        Audiodispatcher audiodispatcher = new Audiodispatcher(uStream,wsola.getInputBufferSize(),wsola.getoverlap());
        wsola.setdispatcher(audiodispatcher);
        audiodispatcher.addAudioProcessor(wsola);
        audiodispatcher.addAudioProcessor(rateTransposer);
        audiodispatcher.addAudioProcessor(writer);
        audiodispatcher.run();
    } catch (FileNotFoundException e) {
        e.printstacktrace();
    }

和:

public static double centToFactor(double cents) {
    return 1 / Math.pow(Math.E,cents * Math.log(2) / 1200 / Math.log(Math.E));
}

我尝试对声音 (cents != 0) 进行实际更改,但结果并没有好转。我是否必须希望这些伪像在真实录音中总是不明显,或者有没有办法解决这个问题?我对音频处理很陌生。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...