-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
72 lines (48 loc) · 1.71 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# from PyQt5 import QtWidgets, uic
import sys, time, signal
from interfaces import midi
from interfaces import titreur
from interfaces import webapp
from interfaces import sampler
from interfaces import leds
from interfaces import elp
from interfaces import osc
from interfaces import xlsreader
webappURL = 'https://live.beaucoupbeaucoup.art'
print("KTITREUR - Midi Bridge\n")
if len(sys.argv) < 2:
print('no broker specified, default to 10.0.0.1')
brokerIP = "10.0.0.1"
else :
brokerIP = sys.argv[1]
print("Connecting...\n")
# XLS
xls = xlsreader.XlsParser("MidiMapping.xls")
#
# MIDI BRIDGES
#
midiMon = midi.MidiInterface("K32-monitor", midi.MidiMonitor() )
midiLeds = midi.MidiInterface("K32-leds", leds.Midi2MQTT( brokerIP ) )
# midiLeds = midi.MidiInterface("K32-leds", leds.Midi2OSC( 9137, "255.255.255.255" ) )
midiTitreur = midi.MidiInterface( "KTitreur", titreur.Midi2MQTT( brokerIP , xls) )
# midiWebapp = midi.MidiInterface( "KWebapp", webapp.Midi2SocketIO( webappURL , xls, brokerIP) )
# midiSampler = midi.MidiInterface("K32-sampler", sampler.Midi2MQTT( brokerIP ) )
midiELP = midi.MidiInterface("K32-elp", elp.Midi2MQTT( brokerIP ) )
#
# OSC
#
# oscIN = osc.OscInterface(9037, osc.Osc2MQTT(brokerIP))
def signal_handler(sig, frame):
print('You pressed Ctrl+C!')
midiTitreur.stop()
# oscIN.stop()
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
print('Press Ctrl+C to quit')
try:
while True:
signal.pause()
except AttributeError:
# signal.pause() is missing for Windows; wait 1s and loop instead
while True:
time.sleep(1.0)