Last active
April 23, 2018 16:43
-
-
Save dirkk0/ea1a5609296a504d057b48b6a553ca03 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# do this first: | |
# pip install pyosc | |
import OSC | |
import time | |
def sendCmd(cmd,par = None): | |
oscmsg = OSC.OSCMessage() | |
oscmsg.append('MY_PYTHON_GUI') | |
oscmsg.setAddress(cmd) | |
if par: | |
oscmsg.append(par) | |
c.send(oscmsg) | |
c = OSC.OSCClient() | |
c.connect(('127.0.0.1', 4557)) # connect to SuperCollider | |
#change these: | |
MYPATH = "/Users/dirk/Dropbox/projects/pi-osc/" | |
# currentSong = MYSONG + ".txt" | |
# song = open( currentSong, 'r').read() | |
# MYSONG = "cloudbeat" | |
song = """ | |
# music by Pit Noack | |
# http://www.maschinennah.de/sonic-pi-codeschnipsel-compus-loop/ | |
use_bpm 80 | |
live_loop :compus do | |
with_fx :ixi_techno, phase: [0.125, 0.25, 0.5, 1, 2].choose do | |
sample :loop_compus, beat_stretch: (ring 4, 8)[tick], amp: 4 | |
sleep (ring 4, 8)[look] | |
end | |
end | |
""" | |
sendCmd("/stop-all-jobs") | |
sendCmd("/start-recording") | |
sendCmd("/run-code", song) | |
# the recording time should be calculated | |
time.sleep(3) | |
sendCmd("/stop-all-jobs") | |
# wait for reverb tail, etc | |
time.sleep(1) | |
sendCmd("/stop-recording") | |
time.sleep(0.1) | |
# sendCmd("/save-recording", MYPATH + MYSONG + ".wav") | |
sendCmd("/save-recording", MYPATH + "song.wav") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment