import pyaudio def list_audio_devices(): p = pyaudio.PyAudio() print("Available audio devices:") for i in range(p.get_device_count()): device_info = p.get_device_info_by_index(i) # 只打印输出设备 if device_info['maxOutputChannels'] > 0: print(f"Device ID: {i}, Name: {device_info['name']}, Max Output Channels: {device_info['maxOutputChannels']}") p.terminate() list_audio_devices()