Created
January 6, 2017 01:51
-
-
Save moxuse/d9c5df806ae91536069f872dd9315c53 to your computer and use it in GitHub Desktop.
UnityOsc.hs
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
-- custom osc send to unity | |
module UnityOsc where | |
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.02 | |
} | |
testSlang = OscSlang { | |
path = "/unity_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" | |
Using with other connections,
I don't know this is the correct way, but import Sound.Tidal.Context
after other import lines, it will work.
module UnityOsc where
import Sound.Tidal.Stream
import Sound.Tidal.Pattern
import Sound.Tidal.Parse
import Sound.Tidal.OscStream
import Sound.Tidal.Context
then when boot tidal
:load UnityOsc
v1 <- testStream
and ghci
d1 ...
v1 ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
then when boot tidal,