Created
December 16, 2015 19:18
-
-
Save lennart/68f5405bba1567f873dd to your computer and use it in GitHub Desktop.
Changing time in tidal via OSC messages
This file contains 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.OSC.FD | |
import Data.Maybe | |
import Sound.Tidal.Context | |
import Control.Applicative | |
oscTempoResponder = do | |
x <- udpServer "127.0.0.1" 4013 | |
(cps, getNow) <- bpsUtils | |
forkIO $ loop cps x | |
where loop cps x = do m <- recvMessage x | |
act cps m | |
loop cps x | |
act cps (Just (Message "/tempo" (pid:bpm:_))) = | |
do | |
let bpm' = (fromJust $ d_get bpm) :: Float | |
cps $ ((fromIntegral $ round $ realToFrac bpm') / 60) / 2 | |
return () | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment