def main(argv): args = parseArgs() level = logging.DEBUG if args.debug else logging.WARNING logging.basicConfig(level=level) if args.list_ports: probeMidiAndPrint() sys.exit(0) if args.list_tracks: extractTracksAndPrint(args.song_path) sys.exit(0) midiin = midi.InputConnection() inPorts = midiin.probeMidiPorts() midiin.attach(InstrumentState) midiin.openPort(inPorts[args.in_port]) midiout = midi.OutputConnection() outPorts = midiout.probeMidiPorts() midiout.openPort(outPorts[args.out_port]) midiplayer = MidiPlayer(midiout, args.song_path, args.speed) midiplayer.attach(PlayingSongState) # TODO: consider moving note sequence and ticks per beat out of # PlayingSongState. Pass these to components that need them and # store only what is necessary in the global object (things that # change). noteSequence = midiplayer.getNoteSequence() noteSequenceForGui = noteSequence[args.track][args.channel].getNotesForProgram(args.program) PlayingSongState.setTicksPerBeat(noteSequence.ticksPerBeat) PlayingSongState.setNotes(noteSequenceForGui) Assets.loadAssets() app = ApplicationWindow() playerThread = threading.Thread(target=midiplayer.play) playerThread.start() app.start() midiplayer.stop() playerThread.join() midiin.closePort() midiout.closePort()
def _getScoreAssets(self): self._staffLineImage = Assets.get("staff_line.png")
def _getPianoKeyAssets(self): self.bDownImage = Assets.get("black_key_down.png") self.wDownImage = Assets.get("white_key_down.png") self.bUpImage = Assets.get("black_key_up.png") self.wUpImage = Assets.get("white_key_up.png")