xavieryang gist felülvizsgálása . Revízióhoz ugrás
1 file changed, 15 insertions
check_audio_device_id.py(fájl létrehozva)
@@ -0,0 +1,15 @@ | |||
1 | + | import pyaudio | |
2 | + | ||
3 | + | def list_audio_devices(): | |
4 | + | p = pyaudio.PyAudio() | |
5 | + | ||
6 | + | print("Available audio devices:") | |
7 | + | for i in range(p.get_device_count()): | |
8 | + | device_info = p.get_device_info_by_index(i) | |
9 | + | # 只打印输出设备 | |
10 | + | if device_info['maxOutputChannels'] > 0: | |
11 | + | print(f"Device ID: {i}, Name: {device_info['name']}, Max Output Channels: {device_info['maxOutputChannels']}") | |
12 | + | ||
13 | + | p.terminate() | |
14 | + | ||
15 | + | list_audio_devices() |
Újabb
Régebbi