【问题标题】:run aubiopitch continuously on a file descriptor在文件描述符上连续运行 aubiopitch
【发布时间】:2014-10-03 20:15:02
【问题描述】:

我想使用aubiopitch 连续输出来自输入源的信号频率。由于aubiopitch 喜欢输入文件而不是流,所以我尝试使用process substitution

$ aubiopitch -i <(sox -q -d -t wav -)

我希望这能输出从我的默认音频输入设备读取的信号频率。相反,我得到了这个:

./sox WARN wav: Length in output .wav header will be wrong since can't seek to fix it
AUBIO ERROR: source_apple_audio: Failed opening /dev/fd/63, error in ExtAudioFileOpenURL (-40)
AUBIO ERROR: source_wavread: could not find RIFF header in /dev/fd/63
AUBIO ERROR: source: failed creating aubio source with /dev/fd/63 at samplerate 0 with hop_size 256
Error: could not open input file /dev/fd/63

问题似乎不在于sox,因为这个命令可以正常工作:

cat <(sox -q -d -t wav -) > output.wav

它会创建一个output.wav 文件,除了aubiopitch 之外,播放似乎没什么问题:

$ aubiopitch output.wav
Segmentation fault: 11

这里发生了什么?是否是 RIFF 标头的长度设置错误?

如果重要的话,我正在运行 OSX 10.7.5,并且我重新编译了 aubio 以使用我的旧 OSX 版本。

【问题讨论】:

    标签: audio sox audio-analysis aubio


    【解决方案1】:
    $ sox -q -d -t wav - | aubiopitch -i -
    

    当编译时使用 libsndfile 支持,'-' = stdin,所以上面的命令可以给出以下输出。

    sox WARN wav: Length in output .wav header will be wrong since can't seek to fix it
    0.000000 0.000000
    0.005805 707.323486
    0.011610 [...]
    

    如果您使用更多来源(avcodecapple_audio)编译 aubio,您将收到更多警告。您可以通过将stderr 重定向到/dev/null 来隐藏这些警告。这是aubioonset 的示例:

    $ ( sox -q -d -t wav - | aubioonset -i - ) 2> /dev/null
    0.000000
    0.096871
    0.279297
    [...]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-11
      • 1970-01-01
      • 2014-04-06
      • 1970-01-01
      • 1970-01-01
      • 2011-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多