在文件描述符上连续运行aubiopitch [英] run aubiopitch continuously on a file descriptor
问题描述
我想使用aubiopitch
连续输出来自输入源的信号的频率.由于aubiopitch
喜欢将其输入作为文件而不是流,因此我尝试使用流程替换:
I'd like to use aubiopitch
to continuously output the frequency of a signal coming from an input source. Since aubiopitch
likes to have its input be a file, not a stream, I tried using process substitution:
$ aubiopitch -i <(sox -q -d -t wav -)
我希望它可以输出从默认音频输入设备读取的信号的频率.相反,我得到了这个:
I'd expect this to output the frequency of the signal being read off of my default audio input device. Instead, I got this:
./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
,因为此命令可以正常工作:
The problem doesn't seem to lie with sox
, since this command works fine:
cat <(sox -q -d -t wav -) > output.wav
它会创建一个output.wav
文件,似乎没有问题,但aubiopitch
除外:
It creates an output.wav
file that nothing seems to have trouble playing, except aubiopitch
of course:
$ aubiopitch output.wav
Segmentation fault: 11
这是怎么回事? RIFF标头设置的长度错误吗?
What's going on here? Is the issue with the RIFF header having the wrong length set?
如果有问题,我正在运行OSX 10.7.5,并且我重新编译了aubio以使其与我的旧OSX版本一起使用.
If it matters, I'm running OSX 10.7.5 and I recompiled aubio to work with my older OSX version.
推荐答案
$ sox -q -d -t wav - | aubiopitch -i -
使用libsndfile支持'-' = stdin
进行编译时,因此上述命令可以提供以下输出.
When compiled with libsndfile support, '-' = stdin
, so the above command could give the following output.
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 [...]
如果使用更多源(avcodec
或apple_audio
)编译了aubio,则会收到更多警告.您可以通过将stderr
重定向到/dev/null
来隐藏这些警告.这是aubioonset
的示例:
If you compiled aubio with more sources (avcodec
or apple_audio
), you will get more warnings. You can hide these warnings by redirecting stderr
to /dev/null
. Here is an example with aubioonset
:
$ ( sox -q -d -t wav - | aubioonset -i - ) 2> /dev/null
0.000000
0.096871
0.279297
[...]
这篇关于在文件描述符上连续运行aubiopitch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!