我有一个 RTL-SDR 无线电接收器,可以将流数据输出到标准输出。我可以使用以下命令收听音频:
$ rtl_fm -M wbfm -f 96.5M | play -r 32k -t raw -e s -b 16 -c 1 -V1 -
如您所见,rtl_fm 以 32 kHz 的采样率输出由 16 位有符号整数组成的样本流。
现在,我想用 sox 录制这个音频,所以我尝试了
$ rtl_fm -M wbfm -f 96.5M -g 25 | rec -e s -b 16 -r 32000 out.wav
我得到了一个 wav 文件,但它只是空的——所有的值都是零。我试过了
$ rtl_fm -M wbfm -f 96.5M -g 25 | rec -e s -b 16 -r 32000 -t raw out.wav
但这只是给了我一个文件,Audacity 没有识别为 wav。如果我将其作为原始数据导入,它仍然是全零。
就像我写的那样,当我运行播放命令时,我有音频,但是当我录制时,我什么也得不到。
对于它的价值,这里是记录命令的输出:
$ rtl_fm -M wbfm -f 96.5M -g 25 | rec -e s -b 16 -r 32000 -c 1 out.wav
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001
rec WARN alsa: can't encode 0-bit Unknown or not applicable
Using device 0: Generic RTL2832U OEM
Input File : 'default' (alsa)
Channels : 1
Sample Rate : 32000
Precision : 16-bit
Sample Encoding: 16-bit Signed Integer PCM
In:0.00% 00:00:00.00 [00:00:00.00] Out:0 [ | ] Clip:0 Detached kernel driver
In:0.00% 00:00:00.26 [00:00:00.00] Out:0 [ | ] Clip:0 Found Rafael Micro R820T tuner
In:0.00% 00:00:00.51 [00:00:00.00] Out:8.19k [ | ] Clip:0 Tuner gain set to 25.40 dB.
Tuned to 96771000 Hz.
oversampling input by: 6x.
Oversampling output by: 1x.
Buffer size: 8.03ms
Exact sample rate is: 1020000.026345 Hz
Create UDP thread
Created UDP thread
Allocating 15 zero-copy buffers
Main socket started! :-) Tuning enabled on UDP/6020
Sampling at 1020000 S/s.
Output at 170000 Hz.
In:0.00% 00:00:09.22 [00:00:00.00] Out:287k [ | ] Clip:0 ^CSignal caught, exiting!
User cancel, exiting...
In:0.00% 00:00:09.47 [00:00:00.00] Out:295k [ | ] Clip:0
Aborted.
Signal caught, exiting!
Reattached kernel driver