Created
February 6, 2018 22:44
-
-
Save kindohm/fa6a107158d1012da6a64f058675e516 to your computer and use it in GitHub Desktop.
TidalProc.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
module TidalProc where | |
import Sound.Tidal.Stream | |
import Sound.Tidal.Pattern | |
import Sound.Tidal.Parse | |
import Sound.Tidal.OscStream | |
port = 5000 | |
procShape = Shape { | |
params = [ | |
F "hit" (Just 0), | |
S "view" (Just ""), | |
F "fade" (Just 0), | |
F "a" (Just 0), | |
F "b" (Just 0), | |
F "c" (Just 0), | |
F "d" (Just 0) | |
], | |
cpsStamp = True, | |
latency = 0.1 | |
} | |
procSlang = OscSlang { | |
path = "/proc_osc", | |
timestamp = NoStamp, | |
namedParams = False, | |
preamble = [] | |
} | |
procStream = do | |
s <- makeConnection "127.0.0.1" port procSlang | |
stream (Backend s $ (\_ _ _ -> return ())) procShape | |
hit = makeF procShape "hit" | |
view = makeS procShape "view" | |
fade = makeF procShape "fade" | |
a = makeF procShape "a" | |
b = makeF procShape "b" | |
c = makeF procShape "c" | |
d = makeF procShape "d" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cpsStamp
adds the current cps to the messagetimestamp
- when you send a message over a network, you get 'jitter' - timing issues. This is a problem with dodgy wifi networks, or if you want really tight timing in general. You can get really accurate timing by sending messages ahead of time, with a timestamp for when the message should be acted upon. You have it set toNoStamp
which turns off this behaviour - instead there is no timestamp in the message, the message just gets sent at the 'right' time, and the other end won't get it until a bit later. This is completely fine for triggering visuals, especially if the message is being sent locally.namedParams
- if True, for every parameter you send two values - the name of the parameter, and the value of it. Furthermore, only the parameters are sent that have values in the pattern. If False, only the values are sent, but they're all sent, so you can tell what a value is for by its position in the message. In the latter case, default values are used for parameters without values set in a pattern.Yes the last bit ties it together.. I think it's a bit longwinded because the same code gets used for midi connections.