Ejemplo n.º 1
0
 def stopNote(self):        
     if self.state.lastNote is None:
         return
     else:
         alsaseq.output(noteOffEvent(self.state.lastNote))
         self.state.lastNote = None
         logging.debug("stop note %s" % str(self.state.lastNote))
Ejemplo n.º 2
0
def supplyoutput():
    'Supply events to the sequencer.'
    global outgoing
    event_tmpl = 'events: {:3} in the ALSA sequencer queue, {:3} outgoing, {:3} may be sent, {:3} sent'
    enfila_old = 0
    while vivo:
        enfila = alsaseq.status()[2]
        if enfila < 250 and outgoing:
            nenviar = 500 - enfila - nlibres
            if len(outgoing) > nlibres:
                for evento in outgoing[:nlibres]:
                    alsaseq.output(evento)
                print(
                    event_tmpl.format(enfila, len(outgoing), 500 - enfila,
                                      nlibres))
                outgoing = outgoing[nlibres:]
            else:
                print(
                    event_tmpl.format(enfila, len(outgoing), 500 - enfila,
                                      len(outgoing)))
                for evento in outgoing:
                    alsaseq.output(evento)
                    outgoing = []
        elif enfila != enfila_old:
            print(event_tmpl.format(enfila, len(outgoing), 500 - enfila, 0))
        enfila_old = enfila
        time.sleep(0.5)
    print('Ending supplyoutput()')
Ejemplo n.º 3
0
def interaction_loop():
    """Interaction loop for the box, reads serial,
    makes predictions, outputs servo and sound."""
    global last_received_midi
    # Start Lever Processing
    userloc = read_lever()
    if userloc is not None:
        if args.verbose:
            print("Input:", userloc)
        # Send MIDI to synth.
        midi_loc = int(userloc * 127)
        midi_ctl_event = (10, 1, 0, 0, (0, 0), (0, 0), (0, 0), (0, 0, 0, 0, 0, midi_loc))
        alsaseq.output(midi_ctl_event)
        # print("MIDIOUT:", midi_ctl_event)
        if args.mirror:
            last_received_midi = midi_loc
    # Read incoming midi.
    while(alsaseq.inputpending() > 0):
        midi_event = alsaseq.input()
        if midi_event[0] == SND_SEQ_EVENT_CONTROLLER:
            # just take the controller value
            last_received_midi = midi_event[7][5]
        # do something with it
        if args.verbose:
            print("Servo:", last_received_midi)
            # print("MIDI:", midi_event)
    if args.servo:
        # Only send to servo if args suggest it.
        # Only act on most recent message.
        command_servo(last_received_midi)
Ejemplo n.º 4
0
 def playnote(self, note_idx, step_idx):
     r = random.randint(0, 99)
     if r >= self.prob[step_idx]:
         self.publish(("printat", None,
                       (step_idx * self.print_note_width + 2, 4, ".")))
         time.sleep(self.duration / 1000)
         self.publish(("printat", None,
                       (step_idx * self.print_note_width + 2, 4, " ")))
     else:
         duration_on = (self.durations[step_idx] * self.duration / 127)
         duration_off = self.duration - duration_on
         duration_on = duration_on / self.ratchets[step_idx]
         duration_off = duration_off / self.ratchets[step_idx]
         chosen = self.getnote(self.interval_indexes[note_idx])
         vel = self.vel[step_idx]
         note = (self.outchannel, chosen, vel)
         noteon = alsamidi.noteonevent(*note)
         noteoff = alsamidi.noteoffevent(*note)
         self.publish(("printat", None,
                       (step_idx * self.print_note_width + 2, 4, "*")))
         self.publish(("printat", None,
                       (note_idx * self.print_note_width + 2, 3, "*")))
         for i in range(self.ratchets[step_idx]):
             alsaseq.output(noteon)
             time.sleep(duration_on / 1000)
             alsaseq.output(noteoff)
             time.sleep(duration_off / 1000)
         self.publish(("printat", None,
                       (step_idx * self.print_note_width + 2, 4, " ")))
         self.publish(("printat", None,
                       (note_idx * self.print_note_width + 2, 3, " ")))
Ejemplo n.º 5
0
 def stopNote(self):        
     if self.lastNote is None:
         return
     else:
         alsaseq.output(noteOffEvent(self.lastNote, chan=self.params.midiChan))
         self.lastNote = None
         logging.debug("stop note %s" % str(self.lastNote))
Ejemplo n.º 6
0
    def main():

        se = ServoEvent()
        parser = MusicParser()
        alsaseq.client('RoboWhistle PassThrough', 1, 1,
                       False)  # Set up a new ALSA channel
        alsaseq.connectfrom(
            1, 129, 0)  # Midi file input needs to be sent in to channel 129
        # Backup ALSA channel to run on port 128. Can use either a virtual synth (e.g. Timidity or a physical MIDI keyboard)
        alsaseq.connectto(1, 128, 0)

        srv = ServoEvent()
        srv.ResetServoEvent()

        #To enter FreePlay mode provide any argument when running the program; if left blank AutoPlay will proceed automaticlly
        if len(sys.argv) is 2:
            print "Entering FreePlay Mode"
            play = FreePlay()
            play.ManualPlay()
        else:
            print str(len(sys.argv))
            while 1:
                if alsaseq.inputpending():  # ALSA queue
                    event = alsaseq.input()  # Pop event from top of the queue
                    eventPitch = event[7][
                        1]  # Pitch of the note that needs to be played

                    parsedNote = parser.AnalyseSingleNote(eventPitch % 12)

                    if parsedNote is None:
                        alsaseq.output(
                            event
                        )  # Event is unplayable by the whistle, forward it to the synthesiser
                    else:
                        se.PlayNoteEvent(parsedNote)  # Pass item for playing
Ejemplo n.º 7
0
	def output_pulses(self):
		for i in range(self.position, 
					   self.position + self.period,
					   self.pulse_period):
			alsaseq.output((alsaseq.SND_SEQ_EVENT_CLOCK, 1, 0, 1,
						   (i // 1000, (i%1000) * 1000000),
						   (0, 0), (0, 0), (0, 0, 0, 0, 0)))
		self.target = self.position
def finish():
    curses.nocbreak()
    curses.echo()
    curses.endwin()
    print 'cleaning up'
    for channel in range(16):
        for pitch in range(128):
            alsaseq.output(alsamidi.noteoffevent(channel, pitch, 0))
Ejemplo n.º 9
0
    def midi_failure_accord(self):
        _akord = [0,3,6]
        akord = [self.st.base - 12 + x for x in _akord]
        for t in akord:
            alsaseq.output(noteonevent(1, t, 120))
        time.sleep(2)

        for t in akord:
            alsaseq.output(noteoffevent(1, t, 120))
Ejemplo n.º 10
0
	def set_midi_preset(self, chan, msb, lsb, prg):
		logging.info("Set MIDI CH " + str(chan) + ", Bank MSB: " + str(msb) + ", Bank LSB: " + str(lsb) + ", Program: " + str(prg))
		self.bank_msb_selected[chan]=msb
		self.bank_lsb_selected[chan]=lsb
		self.prg_selected[chan]=prg
		self.set_midi_control(chan,0,msb)
		self.set_midi_control(chan,32,lsb)
		event=alsamidi.pgmchangeevent(chan, prg)
		alsaseq.output(event)
Ejemplo n.º 11
0
 def sample(self):
     # increase time wrt last sample time
     self.tick = (self.tick + self.period * self.resolution * self.freq) % self.resolution
     newValue = self.samples[int(self.tick)]
     if self.value <> newValue:
         self.value = newValue
         alsaseq.output(ccEvent(self.cc, self.value, chan=self.params.midiChan))
     self.dispatcher = Timer(self.period, self.sample)
     self.dispatcher.start()
Ejemplo n.º 12
0
 def handleQueue(self):
     self.printall()
     while self.running:
         try:
             msg = self.in_q.get_nowait()
         except Empty:
             pass
         else:
             ctrl, idx, value = msg
             if ctrl == "root":
                 old_root = self.root
                 self.root = value
                 self.printdetails()
                 self.printnotes()
             elif ctrl == "cc1":
                 if self.current_page == 0:
                     self.interval_indexes[idx] = value - 64
                     self.printnotes()
                 elif self.current_page == 1:
                     pass
             elif ctrl == "cc2":
                 if self.current_page == 0:
                     self.vel[idx] = value
                     self.printvel()
                 elif self.current_page == 1:
                     pass
             elif ctrl == "cc3":
                 if self.current_page == 0:
                     self.durations[idx] = value
                     self.printdurations()
                 elif self.current_page == 1:
                     pass
             elif ctrl == "cc4":
                 if self.current_page == 0:
                     self.prob[idx] = int(value / 127 * 100)
                     self.printprob()
                 elif self.current_page == 1:
                     pass
             elif ctrl == "pagechange":
                 self.current_page = (self.current_page + value) % PAGES
                 self.message(f"Page change {self.current_page}")
             elif ctrl == "scalechange":
                 scale_idx = [s[0] for s in SCALES].index(self.scale)
                 scale_idx = scale_idx + value
                 self.scale = SCALES[scale_idx % len(SCALES)][0]
                 self.printdetails()
                 self.printnotes()
             elif ctrl == "speedchange":
                 self.duration += value
                 self.printdetails()
             elif ctrl == "exit":
                 self.message(f"exit")
                 alsaseq.output((STOP, 0, 0, 0, (0, 0), (0, 0), (0, 0), 0))
                 self.running = False
             self.save()
     logger.info("Exit handle queue in model")
Ejemplo n.º 13
0
 def set_midi_instr(self, chan, msb, lsb, prg):
     print("Set MIDI CH " + str(chan) + ", Bank MSB: " + str(msb) +
           ", Bank LSB: " + str(lsb) + ", Program: " + str(prg))
     self.bank_msb_selected[chan] = msb
     self.bank_lsb_selected[chan] = lsb
     self.prg_selected[chan] = prg
     self.set_midi_control(chan, 0, msb)
     self.set_midi_control(chan, 32, lsb)
     event = alsamidi.pgmchangeevent(chan, prg)
     alsaseq.output(event)
Ejemplo n.º 14
0
Archivo: midi.py Proyecto: wrl/mfp
    def send(self, port, event):
        from datetime import datetime, timedelta
        starttime = datetime.now()

        raw_tuple = mk_raw(event, port)
        alsaseq.output(raw_tuple)
        
        elapsed = datetime.now() - starttime

        if elapsed > timedelta(microseconds=1000):
            print "MIDI send took %s milliseconds" % timedelta.total_seconds() * 1000
Ejemplo n.º 15
0
def drums(ritmo, tempo, compases):
    "Output one measure to queue."
    global incoming
    tiempoms = alsamidi.tuple2time(alsaseq.status()[1]) * 1000
    t = pista.construye(ritmo, tempo, compases, tiempoms)
    final = alsamidi.time2tuple(pista.duracion(ritmo, tempo, compases, tiempoms) / 1000.0)
    t.append((alsaseq.SND_SEQ_EVENT_ECHO, 1, 0, 0, final, (0, 0), (alsaseq.id(), 0), (1, 2, 3, 4, 5)))

    for evento in t:
        alsaseq.output(evento)
        incoming.append(evento)  # record it
Ejemplo n.º 16
0
def drums(ritmo, tempo, compases):
    'Output one measure to queue.'
    global incoming
    tiempoms = alsamidi.tuple2time(alsaseq.status()[1]) * 1000
    t = pista.construye(ritmo, tempo, compases, tiempoms)
    final = alsamidi.time2tuple(
        pista.duracion(ritmo, tempo, compases, tiempoms) / 1000.)
    t.append((alsaseq.SND_SEQ_EVENT_ECHO, 1, 0, 0, final, (0, 0),
              (alsaseq.id(), 0), (1, 2, 3, 4, 5)))

    for evento in t:
        alsaseq.output(evento)
        incoming.append(evento)  # record it
Ejemplo n.º 17
0
 def playNote(self):
     if self.state.lastNote:
         self.stopNote()
         self.arpeg.next()
     note = Note(self.pitch())
     if note.valid():
         alsaseq.output(noteOnEvent(note, chan=self.params.midiChan))
         logging.debug("play note %s" % str(note))
         self.state.lastNote = note
     self.lastStrike = time.time()
     if not self.params.quant and self.state.rapidFire and self.state.trigger: 
         duration = 60.0 / self.bpm()
         self.dispatcher = self.scheduleNote(duration)
def play(predicted):
    import alsaseq, alsamidi

    alsaseq.client('andreas', 1, 1, True)
    alsaseq.connectto(1, 20, 0)
    alsaseq.start()

    for pitches in predicted.T:
        for i, on in enumerate(pitches):
            note = i + 50
            alsaseq.output(alsamidi.noteoffevent(0, note, 100))
            if on:
                alsaseq.output(alsamidi.noteonevent(0, note, 100))
        time.sleep(.1)
Ejemplo n.º 19
0
    def midi_success_accord(self):
        _akord = [0, 12]
        akord = [self.st.base + 40 + x for x in _akord]
        for t in akord:
            alsaseq.output(noteonevent(1, t, 120))
        logger.info("midi_success, 1.faza")
        time.sleep(2)

        for t in akord:
            try:
                alsaseq.output(noteoffevent(1, t, 120))
            except Exception as e:
                logger.error("midi_success: " + str(e))
        logger.info("midi_success, posledna faza")
Ejemplo n.º 20
0
    def Write(self, pkt, mtime=None):
        if back_end == 'pypm':
            if mtime == None:
                mtime = pypm.Time()
            self.mDevOut.Write([[pkt,mtime]])
        elif back_end == 'alsaseq':
            # work in progress, alsa event handling is very complex...
            if self.last_alsaseq_pkt:
                    # just copy from last in pkt, reverse src,dest
                    # this is just a quick hack workaround.
                dest = self.last_alsaseq_pkt[5] # src
                src = self.last_alsaseq_pkt[6] # dest
            else:
                # otherwise punt, try setting them to (0,0).
                dest = (0,0)
                src = (0,0)

            if (pkt[0] & 0xf0) == 0x80: # NoteOn
                alsa_pkt = (alsaseq.SND_SEQ_EVENT_CONTROLLER, # mtype
                  0, 0, 253, # flags, tag, queue
                  (0,0), # m_time
                  src, # src
                  dest, # dest
                  (0, pkt[1], pkt[2], 0, 100)) # mdata
                alsaseq.output(alsa_pkt)
                print('tried sending alsa note on')
            elif (pkt[0] & 0xf0) == 0xb0: # CC
                alsa_pkt = (alsaseq.SND_SEQ_EVENT_CONTROLLER, # mtype
                  0, 0, 253, # flags, tag, queue
                  (0,0), # m_time
                  src, # src
                  dest, # dest
                  (1, 0, 0, 0, pkt[1], pkt[2])) # mdata: ? ? ? ctrl-num, value
                alsaseq.output(alsa_pkt)
                print('tried sendin alsa cc %02x %02x' % (pkt[1], pkt[2]))
            else:
                print('todo: send alsaseq')
                return False
        elif back_end == 'rtmidi':
            self.rtmidi_pkt = self.mDevOut.send_message(pkt)
            #note_on = [0x90, 60, 112] # channel 1, middle C, velocity 112
            #note_off = [0x80, 60, 0]
            #mDevOut.send_message(note_on)
            #time.sleep(0.5)
            #mDevOut.send_message(note_off)
        elif back_end == 'mididings':
            print('mididings Write not implemented')
            return False
        return True
Ejemplo n.º 21
0
    def send(self, port, event):
        from datetime import datetime, timedelta
        starttime = datetime.now()

        raw_tuple = mk_raw(event, port)
        try:
            alsaseq.output(raw_tuple)
        except Exception as e:
            log.debug("alsaseq: error on output of", raw_tuple, e)
            log.debug_traceback()

        elapsed = datetime.now() - starttime

        if elapsed > timedelta(microseconds=2000):
            log.debug("MIDI send took %s milliseconds" % elapsed.total_seconds() * 1000)
Ejemplo n.º 22
0
def parsecommand():
    'Read on letter from stdin.'
    global ritmos, nritmo, tempo, split, waitingforsplit
    global voz1, voz2, pgmchangevoz1, pgmchangevoz2
    if not playing:
        if letra == 'p':
            playback()
        elif letra == 'o':
            seq.read(ruta)
            print('read', ruta)
        elif letra == 's':
            seq.write(ruta)
            print('saved', ruta)
        elif letra == 't':
            enabledisabletracks()
        elif letra == 'k':
            print('hit keyboard split point:', end=' ')
            waitingforsplit = 1
        elif letra == 'v':
            voz1 = int(input())
            pgmchangevoz1 = alsamidi.pgmchangeevent(0, voz1)
            alsaseq.output(pgmchangevoz1)
            print('voice 1:', voz1)
        elif letra == 'b':
            voz2 = int(input())
            pgmchangevoz2 = alsamidi.pgmchangeevent(1, voz2)
            if voz2:
                alsaseq.output(pgmchangevoz2)
            print('voice 2:', voz2)
    else:
        if letra == 'p':
            stop()
        elif letra == 'r':
            ritmos = pista.lee('main.pat')
            for i, x in enumerate(ritmos):
                print('{:2} {}'.format(i, x[0]))
            drums(ritmos[nritmo], tempo, compases)
        elif letra in '0123456789':
            nritmo = int(letra)
            print('{:2} {}'.format(nritmo, ritmos[nritmo][0]))
        elif letra == 'n':
            number = int(input())
            if number < len(ritmos):
                nritmo = number
                print('{:2} {}'.format(nritmo, ritmos[nritmo][0]))
        elif letra == 't':
            tempo = int(input())
            print('tempo:', tempo)
Ejemplo n.º 23
0
def parsecommand():
    "Read on letter from stdin."
    global ritmos, nritmo, tempo, split, waitingforsplit
    global voz1, voz2, pgmchangevoz1, pgmchangevoz2
    if not playing:
        if letra == "p":
            playback()
        elif letra == "o":
            seq.read(ruta)
            print("read", ruta)
        elif letra == "s":
            seq.write(ruta)
            print("saved", ruta)
        elif letra == "t":
            enabledisabletracks()
        elif letra == "k":
            print("hit keyboard split point:", end=" ")
            waitingforsplit = 1
        elif letra == "v":
            voz1 = int(input())
            pgmchangevoz1 = alsamidi.pgmchangeevent(0, voz1)
            alsaseq.output(pgmchangevoz1)
            print("voice 1:", voz1)
        elif letra == "b":
            voz2 = int(input())
            pgmchangevoz2 = alsamidi.pgmchangeevent(1, voz2)
            if voz2:
                alsaseq.output(pgmchangevoz2)
            print("voice 2:", voz2)
    else:
        if letra == "p":
            stop()
        elif letra == "r":
            ritmos = pista.lee("main.pat")
            for i, x in enumerate(ritmos):
                print("{:2} {}".format(i, x[0]))
            drums(ritmos[nritmo], tempo, compases)
        elif letra in "0123456789":
            nritmo = int(letra)
            print("{:2} {}".format(nritmo, ritmos[nritmo][0]))
        elif letra == "n":
            number = int(input())
            if number < len(ritmos):
                nritmo = number
                print("{:2} {}".format(nritmo, ritmos[nritmo][0]))
        elif letra == "t":
            tempo = int(input())
            print("tempo:", tempo)
Ejemplo n.º 24
0
def refresh_midi(data=None):
    global last_time

    import scikits.audiolab
    import alsaseq, alsamidi

    this_time = time.time()
    if last_time is None:
        last_time = this_time
    sleep = max(0, .2 - (this_time - last_time))

    print sleep

    while app.Pending():
        app.Dispatch()
    if data is not None:
        visualiser.on_training_update(data)
        out = data[-1, -esn.n_output_units:]
        out = (out - esn.teacher_shift) / esn.teacher_scaling
        notes_to_output = collections.defaultdict(list)
        for i, x in enumerate(out):
            # if i > 18:
            #     chan = 2
            #     note = {19: 29, 20: 31, 21: 33}[i]
            # elif i > 15:
            #     chan = 1
            #     note = {16: 36, 17: 40, 18: 44}[i]
            # else:
            #     chan = 0
            #     note = i + 69 - 24
            chan = 0
            note = i + 40
            alsaseq.output(alsamidi.noteoffevent(chan, note, 100))
            if x > .5:
                notes_to_output[chan].append((x, note))
        for chan, notes in notes_to_output.items():
            if len(notes) > 3:
                notes = sorted(notes)[:3]
            for _, note in notes:
                alsaseq.output(alsamidi.noteonevent(chan, note, 100))
        drawing_time = time.time() - this_time
        time.sleep(sleep)

    last_time = time.time() - drawing_time
Ejemplo n.º 25
0
def refresh_midi(data=None):
    global last_time

    import scikits.audiolab
    import alsaseq, alsamidi
    
    this_time = time.time()
    if last_time is None:
        last_time = this_time
    sleep = max(0, .2 - (this_time - last_time))

    print sleep

    while app.Pending():
        app.Dispatch()
    if data is not None:
        visualiser.on_training_update(data)
        out = data[-1, -esn.n_output_units:]
        out = (out - esn.teacher_shift) / esn.teacher_scaling
        notes_to_output = collections.defaultdict(list)
        for i, x in enumerate(out):
            # if i > 18:
            #     chan = 2
            #     note = {19: 29, 20: 31, 21: 33}[i]
            # elif i > 15:
            #     chan = 1
            #     note = {16: 36, 17: 40, 18: 44}[i]
            # else:
            #     chan = 0
            #     note = i + 69 - 24
            chan = 0
            note = i + 40
            alsaseq.output(alsamidi.noteoffevent(chan, note, 100))
            if x > .5:
                notes_to_output[chan].append((x, note))
        for chan, notes in notes_to_output.items():
            if len(notes) > 3:
                notes = sorted(notes)[:3]
            for _, note in notes:
                alsaseq.output(alsamidi.noteonevent(chan, note, 100))
        drawing_time = time.time() - this_time
        time.sleep(sleep)

    last_time = time.time() - drawing_time
Ejemplo n.º 26
0
    def clickThreadRun(self):
        def noteOff(time):
            time_split = math.modf(time)
            time_i = int(time_split[1])
            time_f = int(time_split[0] * 1e9)
            # print (time_i, time_f)
            return (7, 1, 0, 0, (time_i, time_f), (130, 0), (131, 0), (9, 75, 0, 0, 0))

        def noteOn(time, v, instrument):
            time_split = math.modf(time)
            time_i = int(time_split[1])
            time_f = int(time_split[0] * 1e9)
            # print (time_i, time_f)
            return (6, 1, 0, 0, (time_i, time_f), (130, 0), (131, 0), (9, instrument, v, 0, 0))

        clicks = self.songStructure.getAllClicksSecs()
        clicks.sort()
        lookAheadTime = 10  # seconds
        self.clickStartTime = time.time()
        alsaseq.start()

        """
        print "-=---------------------------"
        print self.songStructure.totalNumMeasures()
        print self.songStructure.totalSecsLength()
        print len(clicks)
        print "-=---------------------------"
        """
        totalSongLenSecs = self.songStructure.totalSecsLength()

        for c in clicks:
            alsaseq.output(noteOn(c[0], 127, c[1]))
            if self.stopClick:
                break
            while c[0] > (time.time() - self.clickStartTime) + lookAheadTime:
                time.sleep(0.5)

        while (time.time() - self.clickStartTime) < totalSongLenSecs:
            time.sleep(0.5)
        print "done with song!"
        alsaseq.stop()
        self.clickStartTime = 0
        self.stopClick = True
Ejemplo n.º 27
0
def main(dest_client, file_name, display=False):
    seq = alsamidi.Seq()
    seq.read(file_name)
    events = alsamidi.merge(seq.tracks)
    seq.info()

    print(len(events), 'events')
    alsaseq.client('aseqplay', 0, 1, 1)
    alsaseq.connectto(0, dest_client, 0)

    for channel in range(16):
        alsaseq.output(alsamidi.pgmchangeevent(channel, 0))

    alsaseq.start()

    for event in events:
        if display:
            print(event)
        alsaseq.output(event)

    alsaseq.syncoutput()
Ejemplo n.º 28
0
    def run(self):
        last = (0, 0)
        while True:
            with self.lock:
                (x1, y1) = self.volumePoint.getValues()
                (x2, y2) = self.notePoint.getValues()

            volume = self._fromWIItoMIDI(127, 0, cwiid.IR_Y_MAX, 100, int(y1))
            note = self._fromWIItoMIDI(110, 40, cwiid.IR_X_MAX, 0, int(x1))

            if volume > 0:
                lastnote, lastvolume = last
                if lastnote != note or lastvolume != volume:
                    for chordnote in self.create_chord(alsamidi.noteoffevent, self.channel, lastnote, lastvolume):
                        alsaseq.output(chordnote)
                        # time.sleep(0.03)
                    for chordnote in self.create_chord(alsamidi.noteonevent, self.channel, int(note), int(volume)):
                        alsaseq.output(chordnote)
                        # print "sending note %d at volume %d on channel %d" % (note, volume, self.channel)
            else:
                lastnote, lastvolume = last
                if lastvolume != 0:
                    for chord in self.create_chord(alsamidi.noteoffevent, self.channel, lastnote, lastvolume):
                        alsaseq.output(chord)
                        # print "offing the note"

            last = (note, volume)

            time.sleep(self.sleepDelay)
Ejemplo n.º 29
0
    def run(self):
        p1 = False
        p2 = False

        lastx1 = lastx2 = 0
        while True:
            with self.lock:
                (x1, y1) = self.pointA.getValues()
                (x2, y2) = self.pointB.getValues()
            if y1 == 0 and p1 == True:
                p1 = False
                #note = self._fromWIItoMIDI(52, 36, cwiid.IR_X_MAX, 0, int(lastx1))
                note = random.randint(1, 100) % 16 + 36
                alsaseq.output(
                    alsamidi.noteonevent(self.channel, int(note), 126))
                print note
#print "1: sending %d" % (int(note))

            elif y1 != 0:
                p1 = True
            else:
                pass

            if y2 == 0 and p2 == True:
                p2 = False
                #note = self._fromWIItoMIDI(52, 36, cwiid.IR_X_MAX, 0, int(lastx2))
                note = random.randint(1, 100) % 16 + 36
                alsaseq.output(
                    alsamidi.noteonevent(self.channel, int(note), 126))

#print "2: sending %d" % (int(note))

            elif y2 != 0:
                p2 = True
            else:
                pass
            lastx1 = x1
            lastx2 = x2

            time.sleep(self.sleepDelay)
Ejemplo n.º 30
0
    def run(self):
        last = (0, 0)
        while True:
            with self.lock:
                (x1, y1) = self.volumePoint.getValues()
                (x2, y2) = self.notePoint.getValues()

            volume = self._fromWIItoMIDI(127, 0, cwiid.IR_Y_MAX, 100, int(y1))
            note = self._fromWIItoMIDI(110, 40, cwiid.IR_X_MAX, 0, int(x1))

            if volume > 0:
                lastnote, lastvolume = last
                if lastnote != note or lastvolume != volume:
                    for chordnote in self.create_chord(alsamidi.noteoffevent,
                                                       self.channel, lastnote,
                                                       lastvolume):
                        alsaseq.output(chordnote)
                    #time.sleep(0.03)
                    for chordnote in self.create_chord(alsamidi.noteonevent,
                                                       self.channel, int(note),
                                                       int(volume)):
                        alsaseq.output(chordnote)
                    #print "sending note %d at volume %d on channel %d" % (note, volume, self.channel)
            else:
                lastnote, lastvolume = last
                if lastvolume != 0:
                    for chord in self.create_chord(alsamidi.noteoffevent,
                                                   self.channel, lastnote,
                                                   lastvolume):
                        alsaseq.output(chord)
                    #print "offing the note"

            last = (note, volume)

            time.sleep(self.sleepDelay)
Ejemplo n.º 31
0
 def playnote(self, note_idx):
     r = random.randint(0, 99)
     if r >= self.prob[note_idx]:
         self.publish(("printat", None,
                       (note_idx * self.print_note_width + 2, 3, ".")))
         time.sleep(self.duration / 1000)
         self.publish(("printat", None,
                       (note_idx * self.print_note_width + 2, 3, " ")))
     else:
         duration_on = self.durations[note_idx] * self.duration / 127
         chosen = self.getnote(self.interval_indexes[note_idx])
         vel = self.vel[note_idx]
         note = (0, chosen, vel)
         noteon = alsamidi.noteonevent(*note)
         noteoff = alsamidi.noteoffevent(*note)
         alsaseq.output(noteon)
         self.publish(("printat", None,
                       (note_idx * self.print_note_width + 2, 3, "*")))
         time.sleep(duration_on / 1000)
         alsaseq.output(noteoff)
         self.publish(("printat", None,
                       (note_idx * self.print_note_width + 2, 3, " ")))
         time.sleep((self.duration - duration_on) / 1000)
Ejemplo n.º 32
0
    def run(self):
        p1 = False
        p2 = False

        lastx1 = lastx2 = 0
        while True:
            with self.lock:
                (x1, y1) = self.pointA.getValues()
                (x2, y2) = self.pointB.getValues()
            if y1 == 0 and p1 == True:
                p1 = False
                # note = self._fromWIItoMIDI(52, 36, cwiid.IR_X_MAX, 0, int(lastx1))
                note = random.randint(1, 100) % 16 + 36
                alsaseq.output(alsamidi.noteonevent(self.channel, int(note), 126))
                print note
                # print "1: sending %d" % (int(note))

            elif y1 != 0:
                p1 = True
            else:
                pass

            if y2 == 0 and p2 == True:
                p2 = False
                # note = self._fromWIItoMIDI(52, 36, cwiid.IR_X_MAX, 0, int(lastx2))
                note = random.randint(1, 100) % 16 + 36
                alsaseq.output(alsamidi.noteonevent(self.channel, int(note), 126))
                # print "2: sending %d" % (int(note))

            elif y2 != 0:
                p2 = True
            else:
                pass
            lastx1 = x1
            lastx2 = x2

            time.sleep(self.sleepDelay)
Ejemplo n.º 33
0
def supplyoutput():
    "Supply events to the sequencer."
    global outgoing
    event_tmpl = "events: {:3} in the ALSA sequencer queue, {:3} outgoing, {:3} may be sent, {:3} sent"
    enfila_old = 0
    while vivo:
        enfila = alsaseq.status()[2]
        if enfila < 250 and outgoing:
            nenviar = 500 - enfila - nlibres
            if len(outgoing) > nlibres:
                for evento in outgoing[:nlibres]:
                    alsaseq.output(evento)
                print(event_tmpl.format(enfila, len(outgoing), 500 - enfila, nlibres))
                outgoing = outgoing[nlibres:]
            else:
                print(event_tmpl.format(enfila, len(outgoing), 500 - enfila, len(outgoing)))
                for evento in outgoing:
                    alsaseq.output(evento)
                    outgoing = []
        elif enfila != enfila_old:
            print(event_tmpl.format(enfila, len(outgoing), 500 - enfila, 0))
        enfila_old = enfila
        time.sleep(0.5)
    print("Ending supplyoutput()")
Ejemplo n.º 34
0
    def Write(self, pkt):
        # work in progress, alsa event handling is very complex...
        # there are helper functions in alsaseq - alsamidi module.
        if self.last_alsaseq_pkt:
            # just copy from last in pkt, reverse src,dest
            # this is just a quick hack workaround.
            dest = self.last_alsaseq_pkt[5] # src
            src = self.last_alsaseq_pkt[6] # dest
        else:
            # otherwise punt, try setting them to (0,0).
            src = (0,0)
            dest = (0,0)

        if (pkt[0] & 0xf0) == 0x80: # NoteOn
            alsa_pkt = (alsaseq.SND_SEQ_EVENT_NOTEON, # mtype
              0, 0, 253, # flags, tag, queue
              (0,0), # m_time
              src, # src
              dest, # dest
              (pkt[0] & 0xf, pkt[1], pkt[2], 0, 100)) # mdata
            alsaseq.output(alsa_pkt)
            if self.verbose & 4:
                print('tried sending alsa note on')
        elif (pkt[0] & 0xf0) == 0xb0: # CC
            alsa_pkt = (alsaseq.SND_SEQ_EVENT_CONTROLLER, # mtype
              0, 0, 253, # flags, tag, queue
              (0,0), # m_time
              src, # src
              dest, # dest
              (pkt[0] & 0xf, 0, 0, 0, pkt[1], pkt[2])) # mdata: ? ? ? ctrl-num, value
                #(1, 0, 0, 0, pkt[1], pkt[2])) # mdata: ? ? ? ctrl-num, value
            alsaseq.output(alsa_pkt)
            if self.verbose & 4:
                print('tried sendin alsa cc %02x %02x' % (pkt[1], pkt[2]))
        elif (pkt[0] & 0xf0) == 0xc0: # program change
            alsa_pkt = (alsaseq.SND_SEQ_EVENT_PGMCHANGE, # mtype
              0, 0, 253, # flags, tag, queue
              (0,0), # m_time
              src, # src
              dest, # dest
              (pkt[0] & 0xf, 0, 0, 0, 0, pkt[1])) # mdata: ? ? ? ctrl-num, value
                #(1, 0, 0, 0, 0, pkt[1])) # mdata: ? ? ? ctrl-num, value
            alsaseq.output(alsa_pkt)
            if self.verbose & 4:
                print('tried sendin alsa prog %02x' % (pkt[1]))
        else:
            print('todo: send alsaseq')
            print(pkt)
            return False
Ejemplo n.º 35
0
def retrieveinput():
    "Retrieve received events."
    global incoming, waitingforsplit, split
    p = select.poll()
    p.register(fd, select.POLLIN)
    while vivo:
        p.poll(5000)
        while alsaseq.inputpending():
            entrante = alsaseq.input()
            nota = entrante[7][1]
            type = entrante[0]
            if type in rechazados:
                continue  # discard obnoxious Clavinova events
            elif type == alsaseq.SND_SEQ_EVENT_ECHO:
                drums(ritmos[nritmo], tempo, compases)
                continue
            ev = alsamidi.modifyevent(entrante, ch=1)
            if waitingforsplit:
                split = nota
                waitingforsplit = 0
                print(nota)
                continue  # discard note
            if not split:
                alsaseq.output(entrante)
                alsaseq.output(ev)
                incoming.append(ev)
                incoming.append(entrante)
            elif nota > split:
                alsaseq.output(entrante)
                incoming.append(entrante)
            else:
                alsaseq.output(ev)
                incoming.append(ev)
            print(len(incoming), "incoming")

    print("Ending retrieveinput()")
Ejemplo n.º 36
0
def retrieveinput():
    'Retrieve received events.'
    global incoming, waitingforsplit, split
    p = select.poll()
    p.register(fd, select.POLLIN)
    while vivo:
        p.poll(5000)
        while alsaseq.inputpending():
            entrante = alsaseq.input()
            nota = entrante[7][1]
            type = entrante[0]
            if type in rechazados:
                continue  # discard obnoxious Clavinova events
            elif type == alsaseq.SND_SEQ_EVENT_ECHO:
                drums(ritmos[nritmo], tempo, compases)
                continue
            ev = alsamidi.modifyevent(entrante, ch=1)
            if waitingforsplit:
                split = nota
                waitingforsplit = 0
                print(nota)
                continue  # discard note
            if not split:
                alsaseq.output(entrante)
                alsaseq.output(ev)
                incoming.append(ev)
                incoming.append(entrante)
            elif nota > split:
                alsaseq.output(entrante)
                incoming.append(entrante)
            else:
                alsaseq.output(ev)
                incoming.append(ev)
            print(len(incoming), 'incoming')

    print('Ending retrieveinput()')
Ejemplo n.º 37
0
#!/usr/bin/env python3

# amiditimer.py - Tom Clayton

# Connect input and output to alsa midi streams and this program will
# send a message out and time how long it takes for it to return.

import alsaseq
import sys

alsaseq.client('Midi Timer', 1, 1, True)

# alsaseq event:
# (type, flags, tag, queue, time stamp, source, destination, data)

# data = (channel, note, velocity, start, duration)

out_event = (6, 1, 0, 1, (0, 0), (0, 0), (0, 0), (0, 60, 127, 0, 0))
input("Midi Timer, connect then hit enter to start.")
alsaseq.output(out_event)
alsaseq.start()

while True:
    if alsaseq.inputpending():
        event = alsaseq.input()
        if event[0] == 6:
            print(event[4][1] / 1000000, " ms")
            break
Ejemplo n.º 38
0
            if number < len(ritmos):
                nritmo = number
                print("{:2} {}".format(nritmo, ritmos[nritmo][0]))
        elif letra == "t":
            tempo = int(input())
            print("tempo:", tempo)


rechazados = (alsaseq.SND_SEQ_EVENT_CLOCK, alsaseq.SND_SEQ_EVENT_SENSING)
alsaseq.client("ReproductorGrabador", 1, 1, 1)
alsaseq.connectfrom(0, source_cliente, 0)
alsaseq.connectto(1, dest_cliente, 0)
alsaseq.start()
pgmchangevoz1 = alsamidi.pgmchangeevent(0, voz1)
pgmchangevoz2 = alsamidi.pgmchangeevent(1, voz2)
alsaseq.output(pgmchangevoz1)
if voz2:
    alsaseq.output(pgmchangevoz2)

nlibres = 100
import kbhit

kbhit.unbuffer_stdin()
vivo = 1
seq = alsamidi.Seq()
try:
    fd = alsaseq.fd()
    thso = threading.Thread(target=supplyoutput)
    thso.start()
    thri = threading.Thread(target=retrieveinput)
    thri.start()
Ejemplo n.º 39
0
#!/usr/bin/python

import sys
import alsaseq
import alsamidi

alsaseq.client('ZynthianGUI', 0, 1, True)
alsaseq.connectto(0, 128, 0)
alsaseq.connectto(0, 130, 0)
alsaseq.connectto(0, 131, 0)
alsaseq.start()

# Instrument Select
note = sys.argv[1]
print "Program " + note
event = alsamidi.pgmchangeevent(0, int(note))
alsaseq.output(event)
Ejemplo n.º 40
0
 def setControllers(self):
     ccs = self.state.ccs[self.state.mode()]
     for cc in ccs:
         if cc.update(self.state.gyro[cc.axis]):
             alsaseq.output(ccEvent(cc.cc, cc.value, chan=self.params.midiChan))
Ejemplo n.º 41
0
#0xB0 + (CHANNEL-1), 0x62, 0x48)) )
#alsaseq.output( (alsaseq.SND_SEQ_EVENT_NONREGPARAM, 1, 0, 1, (0,0), (0,0), (0,0), (CHANNEL-1,
#0xB0 + (CHANNEL-1), 0x05, 0x00)) )
#alsaseq.output( (alsaseq.SND_SEQ_EVENT_NONREGPARAM, 1, 0, 1, (0,0), (0,0), (0,0), (CHANNEL-1,
#0xB0 + (CHANNEL-1), 0x26, 0x05)) )

#while(True):
#  alsaseq.output( (alsaseq.SND_SEQ_EVENT_NONREGPARAM, 1, 0, 1, (0,0), (0,0), (0,0), (0x63, FX2_SEND)) )
#  alsaseq.output( (alsaseq.SND_SEQ_EVENT_NONREGPARAM, 1, 0, 1, (0,0), (0,0), (0,0), (0x62, 0x48)) )
#  alsaseq.output( (alsaseq.SND_SEQ_EVENT_NONREGPARAM, 1, 0, 1, (0,0), (0,0), (0,0), (0x05, 0x00)) )
#  alsaseq.output( (alsaseq.SND_SEQ_EVENT_NONREGPARAM, 1, 0, 1, (0,0), (0,0), (0,0), (0x26, 0x05)) )
#  time.sleep(0.5)

#alsaseq.output( (6, 1, 0, 1, (5, 0), (0, 0), (0, 0), (0, 60, 127, 0, 100)) )  
  
alsaseq.output( (alsaseq.SND_SEQ_EVENT_NONREGPARAM, 1, 0, alsamidi.SND_SEQ_QUEUE_DIRECT, (0, 0), (0, 0), (0, 0), (0xB0 + (CHANNEL-1), 0x63, FX2_SEND,   0xB0 + (CHANNEL-1), 0x62, 0x48,   0xB0 + (CHANNEL-1), 0x05,0x00,   0xB0 + (CHANNEL-1), 0x26,0x05)) )   


time.sleep(1000)


# mute group 2 -> muted
msg_part1 = alsamidi.noteonevent(CHANNEL-1, MUTE_GRP2_NOTE, 0x40)
msg_part2 = alsamidi.noteoffevent(CHANNEL-1, MUTE_GRP2_NOTE, 0)
alsaseq.output(msg_part1)
alsaseq.output(msg_part2)

time.sleep(2)

# mute group 2 -> unmuted
msg_part1 = alsamidi.noteonevent(CHANNEL-1, MUTE_GRP2_NOTE, 0x40-1)
Ejemplo n.º 42
0
    parser.add_argument("-n", "--notes", type=int, nargs='+', default=[60], help="List of MIDI note numbers to send, default: %s" % DEFAULT_MIDI_NOTES)
    parser.add_argument("-d", "--duration", default=DEFAULT_NOTE_DURATION, type=float, help="Note duration in seconds, default: %s" % DEFAULT_NOTE_DURATION)

    args = parser.parse_args()

    grpc_helper = SushiRPChelper(args.processor)

    alsaseq.client(PROC_NAME, 0, 1, True)
    alsaseq.connectto(0, get_alsa_port_by_name(args.alsa_port), 0)
    alsaseq.start()

    grpc_helper.reset_timings()
    time.sleep(0.5)
    timings_no_load = grpc_helper.get_timings()
    print("Processor load without Note ONs:  %s avg, %s max" % (timings_no_load.average, timings_no_load.max))

    while (True):
        grpc_helper.reset_timings()
        for note in args.notes:
            alsaseq.output(noteonevent(0, note, 127))

        time.sleep(args.duration)
        timings_end = grpc_helper.get_timings()
        for note in args.notes:
            alsaseq.output(noteoffevent(0, note, 127))

        print("Notes: %s, %s avg, %s max" % (args.notes,
            timings_end.average, timings_end.max))
        time.sleep(0.5 * args.duration)

Ejemplo n.º 43
0
# 3) Resonance Center Frequency (Sound control 8) (no. 77) 
#    This changes the center frequency of the resonance.
#
# 4) Resonance Bandwidth (Sound control 9) (no. 78) 
#    This changes the bandwidth of the resonance. 
#--------------------------------------

alsaseq.client('ZynthianGUI', 0, 1, True)
alsaseq.connectto( 0, 128, 0 )
alsaseq.connectto( 0, 130, 0 )
alsaseq.connectto( 0, 131, 0 )
alsaseq.start()

control=sys.argv[1]
period=sys.argv[2]
print "Control " + control + "("+period+")"

tts=int(period)/32

while True:
	for i in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15):
		value=i*8
		alsaseq.output( (alsaseq.SND_SEQ_EVENT_CONTROLLER, 1, 0, 0, (0, 0), (0, 0), (0, 0), (0, 0, 0, 0, int(control), value)) )
		time.sleep(tts)

	for i in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15):
		value=(15-i)*8
		alsaseq.output( (alsaseq.SND_SEQ_EVENT_CONTROLLER, 1, 0, 0, (0, 0), (0, 0), (0, 0), (0, 0, 0, 0, int(control), value)) )
		time.sleep(tts)

Ejemplo n.º 44
0
 def play(eventos):
     'Envia lista de eventos a la cola del secuenciador.'
     alsaseq.start()
     for evento in eventos:
         alsaseq.output(evento)
     alsaseq.syncoutput()
Ejemplo n.º 45
0
 def handleQueue(self):
     self.printall()
     while self.running:
         try:
             msg = self.in_q.get_nowait()
         except Empty:
             pass
         else:
             ctrl, idx, value = msg
             if ctrl == "root":
                 self.root = value
                 self.printdetails()
                 self.printnotes()
             elif ctrl == "cc1":
                 if isinstance(value, tuple) and value[0] == "relative":
                     self.interval_indexes[idx] = min(
                         127, max(0, self.interval_indexes[idx] + value[1]))
                 else:
                     self.interval_indexes[idx] = value - 64
                 self.printnotes()
             elif ctrl == "cc2":
                 if isinstance(value, tuple) and value[0] == "relative":
                     self.vel[idx] = min(127,
                                         max(0, self.vel[idx] + value[1]))
                 else:
                     self.vel[idx] = value
                 self.printvel()
             elif ctrl == "cc3":
                 if isinstance(value, tuple) and value[0] == "relative":
                     self.durations[idx] = min(
                         127, max(0, self.durations[idx] + value[1]))
                 else:
                     self.durations[idx] = value
                 self.printdurations()
             elif ctrl == "cc4":
                 if isinstance(value, tuple) and value[0] == "relative":
                     self.prob[idx] = min(100,
                                          max(0, self.prob[idx] + value[1]))
                 else:
                     self.prob[idx] = int(value / 127 * 100)
                 self.printprob()
             elif ctrl == "pagechange":
                 self.current_page = (self.current_page + value) % PAGES
                 self.message(f"Page change {self.current_page}")
             elif ctrl == "scalechange":
                 scale_idx = [s[0] for s in SCALES].index(self.scale)
                 scale_idx = scale_idx + value
                 self.scale = SCALES[scale_idx % len(SCALES)][0]
                 self.printdetails()
                 self.printnotes()
             elif ctrl == "orderchange":
                 order_idx = [o[0] for o in ORDER].index(self.order)
                 order_idx = order_idx + value
                 self.order = ORDER[order_idx % len(ORDER)][0]
                 self.printdetails()
             elif ctrl == "speedchange":
                 self.duration += value
                 self.printdetails()
             elif ctrl == "ratchetchange":
                 self.ratchets[idx] = ((self.ratchets[idx] + value) % 4)
                 if self.ratchets[idx] == 0:
                     self.ratchets[idx] = 4
                 self.printratchets()
             elif ctrl == "channelchange":
                 self.outchannel = (self.outchannel + value) % 17
                 self.printdetails()
             elif ctrl == "exit":
                 self.message(f"exit")
                 alsaseq.output((STOP, 0, 0, 0, (0, 0), (0, 0), (0, 0), 0))
                 self.running = False
             self.save()
     logger.info("Exit handle queue in model")
Ejemplo n.º 46
0
def PlayNote(note):
    alsaseq.output(alsamidi.noteonevent( 0, note, 127 ))
Ejemplo n.º 47
0
#
# 4) Resonance Bandwidth (Sound control 9) (no. 78)
#    This changes the bandwidth of the resonance.
#--------------------------------------

alsaseq.client('ZynthianGUI', 0, 1, True)
alsaseq.connectto(0, 128, 0)
alsaseq.connectto(0, 130, 0)
alsaseq.connectto(0, 131, 0)
alsaseq.start()

time.sleep(1)

# Instrument Select
event = alsamidi.pgmchangeevent(0, 0)
alsaseq.output(event)

# Raw Note ON:
alsaseq.output((6, 1, 0, 0, (0, 0), (0, 0), (0, 0), (0, 70, 127, 0, 100)))

# Note ON Event
event = alsamidi.noteonevent(0, 66, 120)
alsaseq.output(event)

control = 74
for i in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15):
    value = i * 16
    alsaseq.output((alsaseq.SND_SEQ_EVENT_CONTROLLER, 1, 0, 0, (0, 0), (0, 0),
                    (0, 0), (0, 0, 0, 0, control, value)))
    time.sleep(0.04)
Ejemplo n.º 48
0
def _midiOut(port, mtype, params):
    alsaseq.output((mtype, 1, 0, 253, (0, 0), (_devi, port), (_devo, 0), params))
Ejemplo n.º 49
0
 def play( eventos ):
     'Envia lista de eventos a la cola del secuenciador.'
     alsaseq.start()
     for evento in eventos:
         alsaseq.output( evento )
     alsaseq.syncoutput()
Ejemplo n.º 50
0
def PlayNote(num):
    alsaseq.output(
        [6, 0, 0, 253, (0, 0), (129, 0), (131, 0), (0, num, 127, 0, 0)])
Ejemplo n.º 51
0
from alsamidi import noteonevent, noteoffevent

#alsaseq.client( 'MIDI through', 1, 1, False )
#alsaseq.connectfrom( 1, 129, 0 )
#alsaseq.connectto( 0, 130, 0 )

alsaseq.client( 'Simple', 1, 1, True )
alsaseq.connectto( 1, 128, 0 )

alsaseq.start()

_akord=[0,4,7]

akord=[i+12*j for i in _akord for j in range(1)]

for base in range(40):
    events=[(1, 40+base+i, 120) for i in akord]

    noteons=[noteonevent(*event) for event in events]
    noteoffs=[noteoffevent(*event) for event in events]

    s=raw_input("stlac enter")
    for noteon in noteons:
        alsaseq.output(noteon)
    time.sleep(1)
    for noteoff in noteoffs:
        alsaseq.output(noteoff)
    time.sleep(0.2)
time.sleep(10)
#alsaseq.output( (6, 1, 0, 1, (1, 0), (0, 0), (0, 0), (0, 60, 127, 0, 100)) )
Ejemplo n.º 52
0
def PlayNote(num):
    alsaseq.output( [6, 0, 0, 253, (0, 0), (129, 0), (131, 0), (0, num, 127, 0, 0)] )
Ejemplo n.º 53
0
 def enqueue_events(self):
     for i in range(self.enqueue_at_once):
         send = (36, 1, 0, 0, (self.time_s, self.time_ns), (128, 0),
                 (self.client_id, self.client_port), None)
         alsaseq.output(send)
         self.advance_time()
Ejemplo n.º 54
0
 def send_event(self, ev):
     log.debug(ev)
     alsaseq.output(ev)
Ejemplo n.º 55
0
 def send_note(self, note):
     alsaseq.output(
         (6, 0, 0, 0, (0, 0), (128, 0), (self.client_id, self.client_port),
          (0, note, 127, 0, 0)))