python client update

This commit is contained in:
wataru 2023-02-18 20:52:39 +09:00
parent fc5c4aa2fb
commit c6309b83f8
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import pyaudio
import json
if __name__ == '__main__':
audio = pyaudio.PyAudio()
audio_input_devices = []
@ -26,7 +26,6 @@ if __name__ == '__main__':
audio_output_devices.append({"kind": "audiooutput", "index": deviceIndex, "name": deviceName, "hostAPI": hostAPI})
audio_devices["audio_input_devices"] = audio_input_devices
audio_devices["audio_output_devices"] = audio_output_devices
json_str = json.dumps(audio_devices, indent=2, ensure_ascii=True)
json_compatible_item_data = jsonable_encoder(audio_devices)
print(json_compatible_item_data)
print(json_str)

View File

@ -116,13 +116,14 @@ if __name__ == '__main__':
input_device_index=inputDevice,
input=True)
print("output device", outputDevice)
if outputDevice >= 0:
audio_output_stream = audio.open(
format=pyaudio.paInt16,
channels=1,
rate=24000,
frames_per_buffer=BUFFER_SIZE,
input_device_index=outputDevice,
output_device_index=outputDevice,
output=True)
else:
audio_output_stream = None