PulseAudio를 사용하는 경우 pacat을 사용해서 system 출력 sound 저장하기

2021. 12. 30. 11:21Open source tools

pulse audio를 사용하는 경우 pacat을 이용하면 간단하게 system output sound를 파일로 저장할수 있습니다.

다음과 같이 하시면 저장할 수 있습니다.


 

정확한 Device 를 찾기 위해 다음 명령을 실행합니다.

pacmd list | grep ".monitor"

 

실행하고 나면 다음과 같이 표시됩니다.

	alsa_output.pci-0000_06_05.0.analog-stereo.monitor/#1: Monitor of CA0106 Soundblaster Analog Stereo

sound card

 alsa_output.pci-0000_06_05.0.analog-stereo.monitor

Afterwards pacat is used to read the signal and sox is used to change the output format. See the man page of sox for parameters to choose for correct output format. The default output from pacat is raw audio, rate 44100, signed-integer, little-endian, 16-bit and stereo. The sox reads from standard input by specifying "-" as filename. The format of the output file is therefore specified after the "-" in the examples under.

Here is an example of how to write to a float formatted raw audio file with mono sound at a rate of 40000sps:

pacat --record -d alsa_output.pci-0000_06_05.0.analog-stereo.monitor | sox -t raw -r 44100 -s -L -b 16 -c 2 - -t raw -r 40000 -f -b 32 -c 1 output.raw

This one is nice if you will record sounds for using in gnuradio. To record to a wav-file with a rate of 44100sps, simply do like this:

pacat --record -d alsa_output.pci-0000_06_05.0.analog-stereo.monitor | sox -t raw -r 44100 -s -L -b 16 -c 2 - "output.wav"

 

원본 : https://www.funwithelectronics.com/?id=95

'Open source tools' 카테고리의 다른 글

Netdata install on centos 7  (0) 2021.10.15
Ubuntu에 RDP 구성  (0) 2021.09.07
Cuda Encoder 사용하는 방법  (0) 2019.12.09
OpenCV 빌드하기 (OpenCV 3.2 + CUDA + TBB)  (0) 2019.11.01
Zookeeper znode type  (0) 2019.11.01