Created
January 11, 2018 16:27
-
-
Save kindohm/efd30e90f1b40a4fc2e3d3004676c54e to your computer and use it in GitHub Desktop.
tidal-processing
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
import oscP5.*; | |
import netP5.*; | |
OscP5 oscP5; | |
NetAddress myRemoteLocation; | |
float x; | |
float y; | |
float z; | |
float opacity; | |
String thing = "foo"; | |
int dim = 2000; | |
float horizOffset = 300; | |
float vertOffset = 300; | |
void setup() { | |
size(2000, 2000); | |
frameRate(60); | |
/* start oscP5, listening for incoming messages at port 5000 */ | |
oscP5 = new OscP5(this, 5000); | |
myRemoteLocation = new NetAddress("127.0.0.1", 5000); | |
} | |
void draw() { | |
background(22); | |
noStroke(); | |
if (thing.equals("foo") == true){ | |
fill(255,0,0); | |
} else if (thing.equals("bar") == true) { | |
fill(0,255,0); | |
} else if (thing.equals("baz") == true) { | |
fill(0,255,255); | |
} else{ | |
fill (0,0,255); | |
} | |
float d = 300*z+100; | |
ellipse(x*(dim - horizOffset) + 30, y*(dim - vertOffset) + 30, d, d); | |
ellipse(dim - (x*(dim - horizOffset) + 30), y*(dim - vertOffset) + 30, d,d); | |
ellipse(x*(dim - horizOffset) + 30, dim - (y*(dim - vertOffset) + 30), d,d); | |
ellipse(dim - (x*(dim - horizOffset) + 30), dim - (y*(dim - vertOffset) + 30), d,d); | |
ellipse(x*(dim/2 - horizOffset) + 30, y*(dim/2 - vertOffset) + 30, d,d); | |
ellipse(dim - (x*(dim/2 - horizOffset) + 30), y*(dim/2 - vertOffset) + 30, d,d); | |
ellipse(x*(dim/2 - horizOffset) + 30, dim - (y*(dim/2 - vertOffset) + 30), d,d); | |
ellipse(dim - (x*(dim/2 - horizOffset) + 30), dim - (y*(dim/2 - vertOffset) + 30), d,d); | |
} | |
void oscEvent(OscMessage theOscMessage) { | |
if (theOscMessage.checkAddrPattern("/proc_osc")==true) { | |
thing = theOscMessage.get(1).stringValue(); | |
x = theOscMessage.get(2).floatValue(); | |
y = theOscMessage.get(3).floatValue(); | |
z = theOscMessage.get(4).floatValue(); | |
opacity = theOscMessage.get(5).floatValue() * 255; | |
} | |
} |
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
import Sound.Tidal.Stream | |
import Sound.Tidal.Pattern | |
import Sound.Tidal.Parse | |
import Sound.Tidal.OscStream | |
port = 5000 | |
testShape = Shape { | |
params = [ | |
S "thing" Nothing, | |
F "x" (Just 0), | |
F "y" (Just 0), | |
F "z" (Just 0), | |
F "duration" (Just 0.5) | |
], | |
cpsStamp = True, | |
latency = 0.38 | |
} | |
testSlang = OscSlang { | |
path = "/proc_osc", | |
timestamp = NoStamp, | |
namedParams = False, | |
preamble = [] | |
} | |
testStream = do | |
s <- makeConnection "127.0.0.1" port testSlang | |
stream (Backend s $ (\_ _ _ -> return ())) testShape | |
thing = makeS testShape "thing" | |
x = makeF testShape "x" | |
y = makeF testShape "y" | |
z = makeF testShape "z" | |
duration = makeF testShape "duration" | |
asdf <- testStream | |
cps (100/120) | |
do | |
asdf $ foldEvery [2,3] (1 <~) $ | |
every 4 (rev) $ | |
(# x (scale 0 1 $ slow 8.1 $ sine1)) $ | |
(# z (scale 0 1 $ slow 7.23 $ (0.75 <~) $ sine1)) $ | |
(# y (scale 0 1 $ slow 9.1312 sine1)) $ | |
rarely (stut' 4 (0.125*1) (|*| duration "0.75")) $ (1 <~) $ | |
sometimes (stut' 1 0.125 (|=| thing (shift $ choose["bar", "baz", "blop"]))) $ | |
shift $ degradeBy 0.4 $ | |
rarely (0.0625 <~) $ | |
thing "foo*8" | |
# nudge "0" | |
# duration "1" | |
d1 $ foldEvery [2,3] (1 <~) $ | |
every 4 (rev) $ | |
every 5 (|=| room (scale 0 0.5 $ shift' 181 $ rand)) $ | |
rarely (stut' 4 (0.125*1) (|*| gain "0.9")) $ (1 <~) $ | |
sometimes (stut' 1 0.125 (|=| n (shift $ choose [1,2,3]))) $ | |
shift $ degradeBy 0.4 $ | |
rarely (0.0625 <~) $ | |
stack [ | |
slow 2 $ s "[~ b2] ~ ~ ~", | |
whenmod 8 4 (# sound "pson") $ | |
sound "peri*8" # nudge "0" # n "0" # gain "1.1" # cut "2", | |
density 2 $ sound "sna(3,8)" | |
# gain "0.7" # cut "1" ] | |
# nudge "0.01" | |
# orbit "0" | |
# room "0.5" | |
# size "0.9" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment