Skip to content

Instantly share code, notes, and snippets.

View MaurizioB's full-sized avatar

MaurizioB

View GitHub Profile
@MaurizioB
MaurizioB / midi_timings.py
Created August 30, 2018 23:20
Timing of MIDI events in seconds
#!/usr/bin/env python2.7
import sys
import midi
def getTempoMap(pattern, maxTick=None):
#create a first tempo (default to 120, if there is no tempo event)
tempoMap = [[0, .5 / pattern.resolution]]
lastTick = 0
for track in pattern:
@MaurizioB
MaurizioB / mididingsSceneCallback.py
Created February 9, 2018 17:56
Mididings scene switch callback
#!/usr/bin/env python
'''
Two alternatives for scene switch callback.
1. Using a custom made Hook() object, which responds only *after* a scene
change has been made. This means that if a scene switch request contains
a non existing scene/subscene, nothing happens.
2. Rewriting the private Engine.scene_switch_callback function, which
intercepts scene switch requests and can do some further actions before
the change is actually made.
@MaurizioB
MaurizioB / miditokeypress
Created January 4, 2018 23:22
Simple MIDI note to keyboard event
#!/usr/bin/env python2.7
from mididings import *
config(
client_name='MidiKeyPress',
in_ports = [('Mixer', 'USB Midi 4i4o:.*MIDI 1')],
out_ports = 0,
)