如何修改实时文件流 [英] How to modify a live file stream
问题描述
我有一个树莓派将音频发送到我的桌面,然后我在它上面运行了 Pocketsphinx.问题是文件很快就变得太大了.我想基本上清空文件,保持其格式,并让管道仍然写入它.这可能吗?
I have a raspberry pi sending audio to my desktop, I then run pocketsphinx on it. The problem is the file quickly becomes too big. I would like to basically empty the file, keep its formatting, and have the pipe still write to it. Is this possible?
我现在拥有的,
arecord -D plughw:1,0 -f S16_LE -r 16000 | ssh -C mingram@192.168.86.101 sox - pipe.wav
和间隔,
pocketsphinx_continuous -hmm /usr/local/share/pocketsphinx/model/en-us/en-us -dict ~/4568.dic -lm ~/4568.lm -infile ~/pipe.wav > ~/ButlerAssistant/newWords.log
我试着做一个 cat baseFormatFile.wav >>pipe.wav
在一个间隔上,但它似乎并没有真正覆盖它.
I tried to do a cat baseFormatFile.wav >> pipe.wav
on an interval but it didn't appear to actually overwrite it.
我的意思是尝试做 cat baseFormatFile.wav >pipe.wav
我不想附加文件.
I meant tried to do cat baseFormatFile.wav > pipe.wav
I don't want to append the file.
编辑 #2:我做了一个 sox pipe.wav pipe.wav trim 0 10
但随后管道停止写入.我也试过 sox baseFormatFile.wav pipe.wav trim 0 02
但除非管道停止,否则它不会改变它.
Edit #2: I did a sox pipe.wav pipe.wav trim 0 10
But then the pipe stops writing to it. I also tried sox baseFormatFile.wav pipe.wav trim 0 02
but it wouldn't change it unless the pipe was stopped.
最终我认为 cat baseFormatFile.wav >pipe.wav
实际上有效,只是没有出现在 ls -l 中.它减少了计算时间并且不显示旧结果,因此我将其标记为成功.
Final edit: I think cat baseFormatFile.wav > pipe.wav
actually worked, it just wasn't showing up in ls -l. It is reducing computation time and not showing old results so I mark it a success.
推荐答案
我觉得 cat baseFormatFile.wav >pipe.wav 实际上有效
,只是没有出现在 ls -l 中.它减少了计算时间并且不会显示旧的结果,所以我将其标记为成功.
I think cat baseFormatFile.wav > pipe.wav actually worked
, it just wasn't showing up in ls -l. It is reducing computation time and not showing old results so I mark it a success.
这篇关于如何修改实时文件流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!