MIDI Synth Sequencer Suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

25 lines
589 B

import mido
def chooseDevice(devices, searchString):
matchingDevice = None
for device in devices:
if searchString.lower() in device.lower():
matchingDevice = device
return matchingDevice
def openOut(deviceName):
outputPort = chooseDevice(mido.get_output_names(), deviceName)
if outputPort:
return mido.open_output(outputPort)
else:
return None
def openIn(deviceName):
inputPort = chooseDevice(mido.get_input_names(), deviceName)
if inputPort:
return mido.open_input(inputPort)
else:
return None