我正在尝试从我的 RME Fireface UCX 声卡输出多达 4 个音频通道,并在我的 miniDSP 16 通道麦克风阵列上获取 16 个通道的音频数据。目前,如果我使用 query_devices 命令中列出的设备的组合,我可以让 16 进/2 出系统正常工作,但我似乎无法增加输出通道的数量。
从设备列表中:
0 name:Microsoft Sound Mapper - Input input ch:2 out ch:0
1 name:ADAT (7+8) (RME Fireface UCX) input ch:2 out ch:0
2 name:Line (miniDSP micArray Multi-ch input ch:2 out ch:0
...
46 name:ASIO Fireface USB input ch:18 out ch:18
47 name:ASIO4ALL v2 input ch:2 out ch:2
48 name:miniDSP ASIO Driver input ch:16 out ch:2
...
60 name:Line (miniDSP micArray Multi-channels) input ch:16 out ch:0
72 name:Line (nanoSHARC micArray16 UAC2.0) input ch:16 out ch:0
73 name:Analog (1+2) (Fireface Analog (1+2)) input ch:0 out ch:8
74 name:Analog (1+2) (Fireface Analog (1+2)) input ch:2 out ch:0
...
因此,如果我有 x(这是一个 44100*5 行乘三列的 numpy 数组,表示以 44.1 kHz (=fs) 采样的 5 秒 3 通道数据),我可以这样做:
sd.default.device = [46, 46]
rx_data = sd.playrec(x, samplerate=fs, channels=8)
这会同时向我的扬声器播放 3 个输出通道,并在我的 RME 声卡输入上获取 8 个通道。同样,如果我这样做:
duration = 5
sd.default.device = [48, 48]
sd.rec(int(duration * fs), samplerate=fs, channels=16)
我可以让我的 miniDSP 录制 16 通道的音频 5 秒。另外,如果我这样做:
sd.default.device = [60, 73]
rx_data = sd.playrec(x, samplerate=fs, channels=16)
我可以让 miniDSP h/w 获取 16 个音频通道,而 RME 仅输出 2 个通道(是的,尽管 numpy 数组有 3 列并且设备列表显示设备可以输出 8 个通道,但只有 2 个通道?)。这没关系,但正如我所说,我可能想要 3 或 4 个音频输出通道。
我考虑过结合 ASIO 设备,即
sd.default.device = [48, 46]
rx_data = sd.playrec(x, samplerate=fs, channels=16)
但这(并不奇怪)会导致 PortAudioError -9993 I/O 设备的非法组合。
所以我考虑过使用 InputStreams 和 OutputStreams,但我并没有完全遵循 sounddevice 文档中的一些示例代码。但也许这是解决这个问题的出路?