AowerDmax / Simple-Interview-Audio-Processing

136 stars 19 forks source link

语音测试有问题 #6

Open antsyan opened 3 months ago

antsyan commented 3 months ago
0dfa5dfe31aa308f3f2b0039cebd04e

这两个值分别填什么,我试了几个一直报错 image 是填我想给CABLE Output和CABLE Input的索引值吗

AowerDmax commented 2 months ago
❯ python interview/audioTest.py
Loading .env file from: /Users/<Your Computer Name>/python/interview/.env
Device 0: 27M2U-D
Device 1: XWF-1080P
Device 2: Background Music
Device 3: Background Music (UI Sounds)
Device 4: BlackHole 16ch
Device 5: BlackHole 2ch
Device 6: 外置麦克风
Device 7: 外置耳机
Device 8: Mac mini扬声器
Device 9: Iriun Webcam Audio
Device 10: WeMeet Audio Device
Device 11: TwsBowie
Device 12: 聚合设备
Device 13: 多输出设备
Traceback (most recent call last):
  File "/Users/<Your Computer Name>/python/interview/interview/audioTest.py", line 25, in <module>
    system_stream = audio.open(format=FORMAT,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<Your Computer Name>/Library/Caches/pypoetry/virtualenvs/interview--yN1BPal-py3.12/lib/python3.12/site-packages/pyaudio/__init__.py", line 639, in open
    stream = PyAudio.Stream(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<Your Computer Name>/Library/Caches/pypoetry/virtualenvs/interview--yN1BPal-py3.12/lib/python3.12/site-packages/pyaudio/__init__.py", line 441, in __init__
    self._stream = pa.open(**arguments)
                   ^^^^^^^^^^^^^^^^^^^^
OSError: [Errno -9998] Invalid number of channels

运行失败会显示这样的一个输出Traceback之前有一个Device List. 从这里面选择你对应的设备号,比如我的麦克风是Device 1: XWF-1080P,我的电脑内声音输出Device 12: 聚合设备.应该分别选择112.注意你需要安装多音频输出以解决多个应用同时读取声音的问题. 具体看README. 请您详细阅读README

antsyan commented 2 months ago

image 我这里没有聚合设备

AowerDmax commented 2 months ago

因为每个电脑的设置都不一样,所以尽管我的是聚合输出设备,并不代表你的也是.

这边没有一个好的解决方法,只能通过不断的尝试,我感觉你可以尝试将这两个index的值都设置为5或者12, 如果你没有使用耳机的话.

或许GPT能够帮助你

如果你都设置为5或者12,你不使用耳机,系统内声音和麦克风声音应该是都能读取的,但是此时内容全部相同,详细可以看最新的issues.

如果你想分离,按照下面的教程尝试.

https://github.com/AowerDmax/Simple-Interview-Audio-Processing?tab=readme-ov-file#audio-configuration-on-macos-and-windows

7