2014-10-03 64 views
1

我想用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版本。

+0

对于任何人谁来寻找做类似的事情,我建立我自己的解决方案:https://github.com/whereswalden90/analyze-signal HTTPS://gist.github。 COM/whereswalden90/9b352f577e5f36533cd1 – whereswalden 2014-10-14 21:30:15

回答

0
$ 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 
[...]