Skip to content

Instantly share code, notes, and snippets.

@moxuse
Created January 6, 2017 01:51
Show Gist options
  • Save moxuse/d9c5df806ae91536069f872dd9315c53 to your computer and use it in GitHub Desktop.
Save moxuse/d9c5df806ae91536069f872dd9315c53 to your computer and use it in GitHub Desktop.
UnityOsc.hs
-- 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"
@moxuse
Copy link
Author

moxuse commented Jan 6, 2017

then when boot tidal,

:load UnityOsc

v1 <- testStream

@moxuse
Copy link
Author

moxuse commented Jan 7, 2017

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