将烟斗播放命令发送到标准输出 [英] pipe sox play command to stdout

查看:122
本文介绍了将烟斗播放命令发送到标准输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我目前正在尝试从树莓派(阿拉伯语)流式传输我的麦克风输入某种网络流,以便稍后在我的手机上接收.为了做到这一点,我使用 arecord -D plughw:1,0 -f dat -r 44100 | 将从我的USB麦克风到stdout的声音流传输到顶部,据我所知可以正常工作,但是我需要使其声音更大一些,以便我可以理解远离它的人.

So I'm currently trying to stream my microphone input from my raspberry pi (rasbian) to some sort of network stream in order to receive it later on my phone. In order to do this I use arecord -D plughw:1,0 -f dat -r 44100 | top pipe the soundstream from my usb-microphone to stdout which works fine as far as I can see but I needed it to be a bit louder so I can understand people standing far away from it .

所以我将它通过管道传送到sox play命令:

So i piped it to the sox play command like this :

arecord -D plughw:1,0 -f dat -r 44100 |播放-t原始-b 16 -e签名-c 2 -v 7 -r 44100-test.wav (test.wav只是一些随机的wav文件ID,如果没有它,将无法工作,并且在44100和test.wav之间-后面有一个空格,因为我认为-是一个单独的参数:

arecord -D plughw:1,0 -f dat -r 44100| play -t raw -b 16 -e signed -c 2 -v 7 -r 44100 - test.wav (test.wav is just some random wav file id doesn't work without it and there is a whitespace between the - behind 44100 and test.wav because i think - is a seperate parameter:

特殊文件名(infile,outfile):-管道/重定向输入/输出(stdin/stdout);可能需要-t-d,--default-device使用默认音频设备(如果有))

我发现使用-v参数可以增加音量.这会将录制的流播放到我连接到rapiberry pi 3的扬声器上.

I figured out by using the -v parameter i can increase the volume. This plays the recorded stream to the speakers I connected to the raspberry pi 3 .

最终目标:将增大音量的声音流传输到stdout(或一些fifopipe文件),这样我就可以从另一个脚本中的stdin中获取它,并将其发送到我的手机中.

Final goal : pipe the volume increased soundstream to the stdout(or some fifopipe file) so i can get it from stdin inside another script to send it to my phone.

但是我对播放命令的手册非常困惑 http://sox.sourceforge.net/sox.html

However im very confused by the manpage of the play command http://sox.sourceforge.net/sox.html

我需要选择要通过管道或粗壮之类的输出设备
如果您知道一种更好的方法来增加我的声音,我认为 Recording WAVE'stdin':带符号的16位Little Endian,速率44100 Hz,立体声 Soundstream让我知道

i need to select the outputdevice to pipe or stout or something
if you know a better way to just increase the voulme of the i think Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereosoundstream let me know

推荐答案

据我所知,您无法通过管道传输 play 的输出,必须使用常规的 sox 命令.例如:

As far as I'm aware you can't pipe the output from play, you'll have to use the regular sox command for that. For example:

# example sound file
sox -n -r 48k -b 16 test16.wav synth 2 sine 200 gain -9 fade t 0 0 0.1

# redundant piping
sox test16.wav -t wav - | sox -t wav - gain 8 -t wav - | play -

就您所要的命令而言,将 play 更改为 sox 并添加 -t wav 以使sox足够了知道要以哪种格式传送声音.

In the case of the command in your question it should be sufficient to change play to sox and add -t wav to let sox know in what format you want to pipe the sound.

arecord -D plughw:1,0 -f dat -r 44100 | \
sox -t raw -b 16 -e signed -c 2 -v 7 -r 44100 - -t wav -

这篇关于将烟斗播放命令发送到标准输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆