Ejemplo n.º 1
0
def main(mode):
    print "PERF=%d PROG=%d PROFILE=%d BASE_NOTE=%s BASE_NOTE_NUM=%d" % (not prog_mode, prog_mode, prof_mode, base_note, base_note_num)
    h = cm.open()
    A = {"accX" : 32768,
         "accY" : 32768,
         "accZ" : 32768}
    Ai = {"accX" : 0,
          "accY" : 1,
          "accZ" : 2}

    for e in ps3events():
        if ps3_spy:
            print e

        if e[0] == 'select' and (not e[1][0] and e[2][0]):
            mode = mode_mappers.keys()[(modes.index(mode) + 1) % len(modes)]
            print "Mode changed to:", mode

        (mes, A) = mode_mappers[mode](e, A, base_note_num=base_note_num)
        if acc_spy and e[0].startswith('acc'):
            print '%d:%d' % (Ai[e[0]], A[e[0]])
        if mes:
            cm.midi_send(h, mes)
Ejemplo n.º 2
0
import coremidi
import midi

from time import sleep

h = coremidi.open()

def main():
    print "starting...."
    sleep(3)

    packets = [midi.note_on(0, 65, 120),
               midi.note_on(0, 68, 120),
               midi.note_on(0, 80, 120)]
    coremidi.midi_send(h, packets)
    print "note on..."

    sleep(.5)

    packets = [midi.note_aftertouch(0, 65, 60)]
    coremidi.midi_send(h, packets)
    print "note aftertouch 1..."

    sleep(.5)

    packets = [midi.note_aftertouch(0, 65, 30),
               midi.note_aftertouch(0, 68, 60)]
    coremidi.midi_send(h, packets)
    print "note aftertouch 2..."

    sleep(.5)