feat: add led recording feedback

This commit is contained in:
Jan Häusler 2025-06-30 03:48:57 +02:00
parent 9523da403e
commit abd3de50c2

View file

@ -97,9 +97,11 @@ def main():
if stt_trigger_type == "note_on" and hasattr(msg, 'note') and msg.note == stt_note: if stt_trigger_type == "note_on" and hasattr(msg, 'note') and msg.note == stt_note:
# For note_on messages, check velocity to determine press/release # For note_on messages, check velocity to determine press/release
if hasattr(msg, 'velocity') and msg.velocity > 0: if hasattr(msg, 'velocity') and msg.velocity > 0:
midi_controller.send_message(mido.Message('note_on', note=msg.note, velocity=127, channel=msg.channel))
print("\nStarting speech recognition (button pressed)...") print("\nStarting speech recognition (button pressed)...")
stt.start_recording() stt.start_recording()
else: else:
midi_controller.send_message(mido.Message('note_on', note=msg.note, velocity=0, channel=msg.channel))
print("\nStopping speech recognition (button released)...") print("\nStopping speech recognition (button released)...")
stt.stop_recording() stt.stop_recording()
elif stt_trigger_type == "control_change" and hasattr(msg, 'control') and msg.control == stt_note: elif stt_trigger_type == "control_change" and hasattr(msg, 'control') and msg.control == stt_note: