def main(): '''Driver code''' app = S3App() app.load_file(input('Enter filename: ')) app.load_trainedsynth() s = Server() s.setMidiInputDevice(99) # Open all input devices. s.boot() def play_midi(filename: str): mid = MidiFile(filename) # ... and reading its content. for message in mid.play(): # For each message, we convert it to integer data with the bytes() # method and send the values to pyo's Server with the addMidiEvent() # method. This method programmatically adds a MIDI message to the # server's internal MIDI event buffer. s.addMidiEvent(*message.bytes()) Synthesiser = S3Synth(app.reg.coef_) a = Synthesiser.out() s.gui(locals())
from pyo import Server, Sine server = Server() server.setMidiInputDevice(2) # Change as required server.boot() if __name__ == '__main__': server.start() audio = Sine().out() server.gui(locals())