Voice-Human2Robot / in_out_micro /stream_to_virtual_mic.py
Danh Tran
Upload 34 files
3190c86 verified
raw
history blame contribute delete
661 Bytes
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)