Spaces:
Sleeping
Sleeping
| import keyboard | |
| from in_out_micro.to_virtual_micro import push_to_mic | |
| def stream(data, sr, device_name, start_key='e'): | |
| start_streaming = False | |
| if start_key is not None: | |
| print(f"Press '{start_key}' to start stream to {device_name}!") | |
| while not start_streaming: | |
| if keyboard.is_pressed(start_key) or keyboard.is_pressed(start_key.upper()): | |
| start_streaming = True | |
| push_to_mic(data, sr, device_name) | |
| else: | |
| while not start_streaming: | |
| start_streaming = True | |
| push_to_mic(data, sr, device_name) | |