Piping output from aplay to arecord in centos

半城伤御伤魂 提交于 2019-12-24 03:25:02

问题


I am trying to automate some tests for a websocket client. This client connects to a server on command and the server is basically a speech to text engine. The client supports audio streaming from a microphone, such that people can record themselves in real time and transmitting it to the engine. I am running the client in a centos VM which does not have a physical sound card so I decided to simulate one using

modprobe snd-dummy

My plan is to pipe the output of

aplay audioFile.raw

to the input of

arecord test.raw -r 8000 -t raw

so that I can use that simulate the microphone feature. I read online that the file plugin for ALSA can pipe the results of one command to the next so I made the following modifications to the .asoundrc file in my root directory:

pcm.!default {
    type hw
    card 0
}

pcm.Ted {
       type file
       slave mySlave
       file "| arecord test.raw -r 8000 -t raw"
}

pcm_slave.mySlave {
       pcm "hw:0,0"

}

ctl.!default {
        type hw
        card 0
}

When I try the following command:

aplay audioFile.raw -D Ted

It seems to run fine but the output of test.raw seems to contain only silence... Does anyone know what I am doing wrong, I am very new to ALSA so if anyone can point me in the right direction, it would be greatly appreciated. Thanks!


回答1:


Issue Fixed, instead of using snd-dummy I used snd-aloop and audio correctly pipes refer to this question:

Is it possible to arecord output from dummy card?



来源:https://stackoverflow.com/questions/42843128/piping-output-from-aplay-to-arecord-in-centos

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!