Beispiel #1
0
    def getJNoteVOs(self, name, ch=0):
        lstMsg = self.lstSourceMIDI[name].getSMMsOnChannel(ch)
        lstNoteOn = {}
        length = len(lstMsg)
        lstJNote = []
        position = 0
        for i in range(0, length):
            msgNote = lstMsg[i]
            position += msgNote.delta
            if msgNote.state == EnumMsg.NOTE_ON:
                jNoteVO = JNoteVO()
                jNoteVO.deltaStart = position
                jNoteVO.ch = msgNote.channel
                jNoteVO.pitch = msgNote.pitch
                jNoteVO.velocity = msgNote.velocity
                lstNoteOn[msgNote.pitch] = jNoteVO

            if msgNote.state == EnumMsg.NOTE_OFF:
                jNoteVO = lstNoteOn[msgNote.pitch]
                jNoteVO.deltaEnd = position
                jNoteVO.index = len(lstJNote)
                jNoteVO.idGroup = jNoteVO.index
                lstJNote.append(jNoteVO)
                print jNoteVO
            pass
        return lstJNote
Beispiel #2
0
def getJNotes(mtrk, ch):
    lstMsg = mtrk.channels[ch]
    lstNoteOn = {}
    length = len(lstMsg)

    lstJNote = []
    for i in range(0, length):
        msgNote = lstMsg[i]
        if (msgNote.state == EnumMsg.NOTE_ON):
            jNoteVO = JNoteVO()
            jNoteVO.deltaStart = msgNote.delta
            jNoteVO.ch = msgNote.channel
            jNoteVO.pitch = msgNote.pitch
            jNoteVO.velocity = msgNote.velocity
            lstNoteOn[msgNote.pitch] = jNoteVO

        if (msgNote.state == EnumMsg.NOTE_OFF):
            jNoteVO = lstNoteOn[msgNote.pitch]
            jNoteVO.deltaEnd = msgNote.delta
            jNoteVO.index = len(lstJNote)
            lstJNote.append(jNoteVO)
            print jNoteVO
        pass
    return lstJNote