def __init__(self, midiport, piglow): '''Create a Midi listener sequencer''' LOGGER.debug("Connecting midi to port: " + midiport) client, port = midiport.split(':') self.seq = sequencer.SequencerRead(sequencer_resolution=120) self.seq.set_nonblock(False) self.seq.subscribe_port(client, port) self.seq.start_sequencer() self.piglow = piglow self.reset_leds_tracking()
def __init__(self): self.client = 28 self.port = 0 self.writer = sequencer.SequencerWrite() self.writer.subscribe_port(self.client, self.port) self.writer.start_sequencer() self.reader = sequencer.SequencerRead(sequencer_resolution=120) self.reader.subscribe_port(self.client, self.port) self.reader.start_sequencer() self.sliders = {} def listen_callback(dt): event = self.reader.event_read() while not (event is None): # print(event) self.process_event(event) event = self.reader.event_read() Clock.schedule_interval(listen_callback, 1.0 / 20.0)
import midi from midi import sequencer import sys import serial CLIENT = 20 PORT = 0 PLAY = True seq = sequencer.SequencerRead(sequencer_resolution=128) seq.subscribe_port(CLIENT, PORT) seq.start_sequencer() def read_event(): event = seq.event_read() return event def stop_events(): global PLAY PLAY = False def record(filename): pattern = midi.Pattern() track = midi.Track() pattern.append(track) port = get_port() try: while True:
def get_reader_sequencer(self): (client, port) = self.get_loop_client_port() seq = sequencer.SequencerRead(sequencer_resolution=self.RESOLUTION) seq.subscribe_port(client, port) return seq
import midi.sequencer as sequencer from collections import Counter from pymongo import MongoClient db = MongoClient()["chord_recognizer"] from lib import notes2chordName, chordName2chord if len(sys.argv) != 3: print "Usage: {0} <client> <port>".format(sys.argv[0]) exit(2) client = sys.argv[1] port = sys.argv[2] midi_sequencer = sequencer.SequencerRead(sequencer_resolution=120) midi_sequencer.subscribe_port(client, port) midi_sequencer.start_sequencer() """ def flat( chord ): def (): = [ chr(x) for x in range(ord("A"),ord("H")) ] += [ x+"#" for x in chordNames ] += [ x+"#" for x in chordNames ] """ last_notes_pressed = [] last_time_played = None