Esempio n. 1
0
 def onPolyTouch(self, port, msg):
     if self._noteOutOfRange(msg.note):
         return
     channel = self._trackToChannel()
     if channel is None:
         return
     outMsg = msg.copy(channel=channel)
     midi.midiOutPort().send(outMsg)
Esempio n. 2
0
 def onAftertouch(self, port, msg):
     if port == midi.standaloneInPort():
         if self.page.trackPage.midiTrackMode:
             selectedTrack = settings['drumPage']['selectedMidiTrack']
             channel = settings['trackChannels']['audioMidiChannel'][
                 selectedTrack]
             if channel is None:
                 return
             outMsg = msg.copy(channel=channel)
             midi.midiOutPort().send(outMsg)
Esempio n. 3
0
        def onCC(self, port, msg):
            levelControl = 46
            volumeControl = 25
            trackMute = 49

            if port == midi.standaloneInPort():
                if msg.control >= 21 and msg.control <= 28:
                    track = msg.control - 21
                    channel = settings['trackChannels']['audioTrackChannel'][track]
                    if channel is None:
                        return
                    outMsg = mido.Message('control_change', channel=channel, control=levelControl, value=msg.value)
                    #outMsg = mido.Message('control_change', channel=channel, control=volumeControl, value=msg.value)
                    midi.midiOutPort().send(outMsg)
                elif msg.control in self.page.trackButtons:
                    if msg.value == 127:
                        track = msg.control - 1
                        channel = settings['trackChannels']['audioTrackChannel'][track]
                        self.page.muted[track] = not self.page.muted[track]
                        value = None
                        if self.page.muted[track]:
                            value = 127
                        else:
                            value = 0
                        outMsg = mido.Message('control_change', channel=channel, control=trackMute, value=value)
                        midi.midiOutPort().send(outMsg)
                    self.page.uiDraw()
            elif port == midi.midiInPort():
                if msg.control == levelControl:
                    channel = msg.channel
                    value = msg.value
                    # send midi cc to standalone port to light up fader value
                    outMsg = mido.Message('control_change', channel=midi.autochannel, control=channel+21, value=value)
                    midi.standaloneOutPort().send(outMsg)
                elif msg.control == trackMute:
                    channel = msg.channel
                    muted = (msg.value != 0)
                    track = settings['trackChannels']['audioTrackChannel'].index(channel)
                    self.page.muted[track] = muted
                    self.page.uiDraw()
Esempio n. 4
0
 def onNoteOn(self, port, msg):
     if port == midi.standaloneInPort():
         if not self.page.trackPage.midiTrackMode:
             # trigger slices
             selectedTrack = settings['drumPage']['selectedAudioTrack']
             channel = settings['trackChannels']['audioTrackChannel'][
                 selectedTrack]
             if channel is None:
                 return
             if msg.velocity == 0:
                 outMsg = mido.Message('note_off',
                                       channel=channel,
                                       note=self._audioTrackToNote(),
                                       velocity=msg.velocity)
                 midi.midiOutPort().send(outMsg)
             else:
                 outMsg = mido.Message('control_change',
                                       channel=channel,
                                       control=17,
                                       value=self._noteToSlice(
                                           msg.note))
                 midi.midiOutPort().send(outMsg)
                 util.sleep_ms(60)
                 outMsg = mido.Message('note_on',
                                       channel=channel,
                                       note=self._audioTrackToNote(),
                                       velocity=msg.velocity)
                 midi.midiOutPort().send(outMsg)
         else:
             # pass the notes through
             selectedTrack = settings['drumPage']['selectedMidiTrack']
             channel = settings['trackChannels']['audioMidiChannel'][
                 selectedTrack]
             if channel is None:
                 return
             outMsg = msg.copy(channel=channel)
             midi.midiOutPort().send(outMsg)
Esempio n. 5
0
 def onAftertouch(self, port, msg):
     channel = self._trackToChannel()
     if channel is None:
         return
     outMsg = msg.copy(channel=channel)
     midi.midiOutPort().send(outMsg)
Esempio n. 6
0
def triggerOctatackMidiDump():
    outMsg = mido.Message('control_change',
                          channel=midi.autochannel,
                          control=61,
                          value=0)
    midi.midiOutPort().send(outMsg)