

Osc "/1/led1", 0 #switch on large LED on TouchOSC screen Osc "/1/led1", 1 if get ( :bg )= 1 #switch on large LED on TouchOSC screen Live_loop :alwaysplaying, sync: :metro do #runs continuously playing Live_loop :metro do #metronome to sync stuff together times do #do this to get a quicker response time Play scale ( :c3, :minor_pentatonic, num_octaves: 2 ). #function to setup sequence of notes (stoppable)ĭefine :doLoopSequence do | n, vol, synth|

S = play note, sustain: dur- 1, release: 1, cutoff: 100, amp: vol #general function to set up long repeating noteĭefine :doLongNote do | n, vol, synth, note, dur| #general function to start stoppable single shot sampleĭefine :doOneShot do | n, vol, sampleName, bs = 0| S = sample sampleName, beat_stretch: bs, amp: vol #general function to set up stoppable live_loopĭefine :doLoop do | n, vol, sampleName, bs ,| #as a singleShot plays once so only sync the start #*** can add an optiona beat_stretch, but probably not requiredĭoLoopSequence 6, 0.1, :tb303 #parameters channel, vol,synthĭoLoop 9, 0.9, :loop_safari, 16 #doSingleSampleĭoOneShot 11, 4, path+ "testsample.flac" #parameters channel,vol,sample split ( "," ) #.to_iĭoLoop 1, 0.5, :loop_amen, 4 #parameters: channel,vol,samplename,beatstrech valueĭoLongNote 5, 0.5, :fm, :c3, 4 #parameters channel, vol,synth,note,repeat duration***** #input on and off live_loops to detect inputs Use_osc "192.168.1.240", 9000 #adjust for output IP to which to send LED on/off signals (TouchOSC) #Can be modified to use any suitable OSC source thant can give on/off signals when a button is pressed #This version uses 11 push buttons on TouchOSC for input and 1 LED on TouchOSC for output #Also may have to cut down use of fx calls on Pi3 as may overload it otherwise. #These can be copied to teh samples folder on version 3.0.1 if required #in particular uses some new :loop samples only in version 3.1 #Tested on a Mac: this version NOT sutiable for Pi3 #VERSION 2 ADDS CONTROL OF BACKGROUND PULSE AND SCREEN #Sonic Pi Loop Controller by Robin Newman I have also tried this on a new Pi3 B+ just released. YOu may get better performacne using a wired network connection, rather than wireless. It works quite well, although response time is slightly worse. Most fx wrappers removed which stops distortion and crashing. Differences: slightly less agressive timings in the functions and live loops You should adjust the IP address in the program to suit your Tablet or Phone running TouchOSC, and set that to point to the IP address of the machine running Sonic Pi The Sonic PI file SPloopController.rb should be copied to a Sonic Pi buffer and run there. YOu can then load it into the TouchOSC editor and send it via WiFi to the tablet or phone with TouchOSC
TOUCHOSC EDITOR SYNC PROBLEM ZIP
To produce the TouchOSC template, download the index.xml file and compress, or zip it.
TOUCHOSC EDITOR SYNC PROBLEM PLUS
In this version I have developed generic functions for each required use, into which the samples to be used, plus information about which button has been pressed, can be fed. In the original development separate live Loops were used for each button.Īlso, in the first versions I developed separate functions for dealing with each button, which led to some repetition in code. Sonic Pi supports wild cards in OSC addresses, and using the undocumented get_eventįunction I have parsed the received address and obtained the information as to which switch has been activated. The program has been streamlined to use just ONE live loop to detect the switches being pushed,Īnd another to detect them being released. I also drive a large "LED" on the TouchOSC screen with OSC commands from the Sonic Pi program. Here I have used a TouchOSC template with 11 pushbuttons on it as the input source. The original question was concerned with using mekey-makey as the "switch input" source. NOW UPDATED TO INCLUDE CONTROL OF THE BACKGROUND PULSE AND SCREEENīOTH PROGRAM AND TOUCHOSC TEMPLATE CHANGEDĪ SEPARATE VERSION TUNED FOR Pi3 IS ALSO INCLUDED
