Better debug

This commit is contained in:
sam 2020-10-06 20:03:48 +02:00
parent 77afd636e8
commit 666698c633
3 changed files with 27 additions and 15 deletions

View File

@ -1,7 +1,7 @@
# Forward Midi events to redis/OSC # Forward Midi events to redis/OSC
Miredis hooks to all midi devices connected and listen for events. Miredis hooks to all midi devices connected and listen for events.
Miredis can optionnaly hook to Link protocol -> "/beats" & "/bpm" Miredis can optionnaly hook to opensourced Link protocol (200+ music & videos apps) -> "/beat" & "/bpm"
All events are forwarded to a redis server and an OSC server. All events are forwarded to a redis server and an OSC server.
Run : Run :
@ -12,6 +12,10 @@ See options :
python3 miredis.py -h python3 miredis.py -h
To enable Link :
python3 miredis.py -link
## Redis keys ## Redis keys
@ -21,10 +25,11 @@ python3 miredis.py -h
"/midi/cc/midichannel/ccnumber" value : "ccvalue" "/midi/cc/midichannel/ccnumber" value : "ccvalue"
"/beats" value : "beatnumber" "/beat" value : "beatnumber"
"/bpm" value : "currentbpm" "/bpm" value : "currentbpm"
## OSC ## OSC
/midi/noteon midichannel note velocity /midi/noteon midichannel note velocity
@ -39,6 +44,6 @@ python3 miredis.py -h
/midi/stop /midi/stop
/beats beatnumber /beat beatnumber
/bpm bpm /bpm bpm

View File

@ -4,12 +4,11 @@
''' '''
Ableton Link Ableton Link with bridge to OSC & Redis
LICENCE : CC LICENCE : CC
Sam Neurohack Sam Neurohack
Get: Get:
git clone --recursive https://github.com/gonzaloflirt/link-python.git git clone --recursive https://github.com/gonzaloflirt/link-python.git
@ -47,21 +46,23 @@ def RedOSC(tempo_str, beats_str):
#sys.stdout.flush() #sys.stdout.flush()
# redis key : "/beats" value : currentbeat # redis key : "/beat" value : currentbeat
if midix.toKey('/beats', beats_str)==True: if midix.toKey('/beat', beats_str)==True:
print("redis :", '/beats', beats_str) pass
#print("redis :", '/beat', beats_str)
# OSC : /midi/cc midichannel ccnumber value # OSC : /midi/cc midichannel ccnumber value
midix.SendOSC('/beats', [beats_str]) midix.SendOSC('/beat', [beats_str])
print("osc :",'/beats', [beats_str]) #print("osc :",'/beat', [beats_str])
# redis key : "/bpm" value : newbpm # redis key : "/bpm" value : newbpm
if midix.toKey('/bpm', bpm)==True: if midix.toKey('/bpm', bpm)==True:
print("redis :", '/bpm', bpm) pass
#print("redis :", '/bpm', bpm)
# OSC : /bpm newbpm # OSC : /bpm newbpm
midix.SendOSC('/bpm', [bpm]) midix.SendOSC('/bpm', [bpm])
print("osc :",'/bpm', [bpm]) #print("osc :",'/bpm', [bpm])
def BeatEvent(): def BeatEvent():
@ -87,14 +88,17 @@ def BeatEvent():
#midix.SendAU('/aurora/beats', beats_str) #midix.SendAU('/aurora/beats', beats_str)
#AllStatus("Beat "+str(beats_str)) #AllStatus("Beat "+str(beats_str))
# New external bpm saved in redis key ?
redbpm = float(midix.fromKey("/bpm"))
if bpm != redbpm:
print("New external BPM -> Link", redbpm)
newtempo(redbpm)
# Change current Link Tempo. # Change current Link Tempo.
def newtempo(tempo): def newtempo(tempo):
global lnk global lnk
#print("val2", val2, "tempo", tempo)
if linked == True: if linked == True:
lnk.enabled = False lnk.enabled = False
lnk.startStopSyncEnabled = False lnk.startStopSyncEnabled = False

View File

@ -128,6 +128,9 @@ if __name__ == '__main__':
midix.check() midix.check()
midix.toKey("/beats","0.0")
midix.toKey("/bpm",120)
try: try:
while True: while True: