Skip to content

Instantly share code, notes, and snippets.

@lennart
Created December 16, 2015 19:18
Show Gist options
  • Save lennart/68f5405bba1567f873dd to your computer and use it in GitHub Desktop.
Save lennart/68f5405bba1567f873dd to your computer and use it in GitHub Desktop.
Changing time in tidal via OSC messages
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