- Added audio confirmation via 3,5 jack

This commit is contained in:
bklronin 2024-06-30 20:17:51 +02:00
parent 9913dc987d
commit 3993d31f9f

View File

@ -1,12 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
### Copyright 2024 Thomas Herrmann ### Copyright 2024 Thomas Herrmann
### Released under GPL v3 ### Released under GPL v3
import time import time
import mido import mido
def match_device_name(input_name, output_list): def match_device_name(input_name, output_list):
# Function to match device names flexibly # Function to match device names flexibly
for device in output_list: for device in output_list:
@ -16,7 +15,6 @@ def match_device_name(input_name, output_list):
#If name differs #If name differs
elif any(substring in device for substring in input_name.split()): elif any(substring in device for substring in input_name.split()):
return device return device
return None return None
def remove_through_ports(ports): def remove_through_ports(ports):
@ -25,7 +23,6 @@ def remove_through_ports(ports):
return filtered_ports return filtered_ports
def determine_host(devices_in: list) -> str: def determine_host(devices_in: list) -> str:
master = None master = None
""" """
@ -148,6 +145,10 @@ def main_run():
devices_out = remove_through_ports(devices_out) devices_out = remove_through_ports(devices_out)
print("Available MIDI input devices:", devices_in) print("Available MIDI input devices:", devices_in)
for i in range(len(devices_out)):
#Try to communicate nr of devices via 3,5 output of raspi
os.system(f'speaker-test -t sine -f 44{i*5} -l 1')
# Listen for devices that send start and return the host name # Listen for devices that send start and return the host name
midi_host_in = determine_host(devices_in) midi_host_in = determine_host(devices_in)
print(midi_host_in) print(midi_host_in)