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.
54 lines
918 B
Python
54 lines
918 B
Python
import csv
|
|
import time
|
|
from pythonosc.udp_client import SimpleUDPClient
|
|
|
|
# OSC client connection
|
|
|
|
ip= "192.168.1.128" # "192.168.43.216" "127.0.0.1"
|
|
port= 9000
|
|
|
|
client = SimpleUDPClient(ip, port) #create client
|
|
# client.send_message("/sc", "hello")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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('inputscim.csv', newline='') as f:
|
|
tracker = csv.DictReader(f)
|
|
|
|
for row in tracker:
|
|
row = row['tum'], row['ts'], row['cha']
|
|
client.send_message("/sc", row)
|
|
# print(' '.join(row)) #it gives problems
|
|
time.sleep(update_bpm(bpm, tempo))
|
|
|
|
|
|
|
|
|
|
while True:
|
|
play_sheet()
|
|
|
|
client.send_message("/sc", " ")
|
|
|
|
|
|
|
|
# connect to pd osc
|