You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
813 B
Python
53 lines
813 B
Python
import csv
|
|
import time
|
|
from pythonosc.udp_client import SimpleUDPClient
|
|
|
|
# OSC client connection
|
|
|
|
ip= "192.168.43.216" #"127.0.0.1"
|
|
port= 9000
|
|
|
|
client = SimpleUDPClient(ip, port) #create client
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bpm = 100
|
|
tempo = 1/4
|
|
|
|
def set_bpm(tracker, ):
|
|
for row in tracker:
|
|
row = row['bpm']
|
|
bpm = row
|
|
print(csv.reader(tracker).fieldnames())
|
|
|
|
def update_bpm(bpm, tempo):
|
|
s = (60/bpm*tempo)
|
|
return s
|
|
|
|
|
|
def play_sheet():
|
|
with open('tracker.csv', newline='') as f:
|
|
tracker = csv.DictReader(f)
|
|
|
|
for row in tracker:
|
|
row = row['tum'], row['ts'], row['cha']
|
|
client.send_message("/vvvv", row)
|
|
print(' '.join(row))
|
|
time.sleep(update_bpm(bpm, tempo))
|
|
|
|
|
|
|
|
|
|
while True:
|
|
play_sheet()
|
|
|
|
|
|
|
|
|
|
# connect to pd osc
|