How to modify a live file stream

2019-09-05 21:43发布

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?

What I have now,

arecord -D plughw:1,0 -f S16_LE -r 16000 | ssh -C mingram@192.168.86.101 sox - pipe.wav

and on interval,

pocketsphinx_continuous -hmm /usr/local/share/pocketsphinx/model/en-us/en-us -dict ~/4568.dic -lm ~/4568.lm -infile ~/pipe.wav > ~/ButlerAssistant/newWords.log

I tried to do a cat baseFormatFile.wav >> pipe.wav on an interval but it didn't appear to actually overwrite it.

Edit: I meant tried to do cat baseFormatFile.wav > pipe.wav I don't want to append the file.

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.

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.

标签: linux unix
1条回答
Rolldiameter
2楼-- · 2019-09-05 22:10

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.

查看更多
登录 后发表回答