listeningdaemon/tidal/compositions/2024-10-22.tidal

81 lines
1.9 KiB
Plaintext
Raw Normal View History

2024-10-22 15:18:37 +00:00
-- (setq tidal-boot-script-path "~/.config/tidal/LolinAndDevkit.hs")
-- (setq tidal-boot-script-path "~/.config/tidal/example_1.hs")
p1 $ blink "off"
p2 $ blink "off"
import Data.Maybe
import Sound.Osc.Fd as O
import Control.Concurrent
actOne :: Udp -> Maybe O.Message -> IO ()
actOne _ _ = do
h1 $ slow 8 $ blink "on"
-- d1 $ fast 4 $ sound "sn" # pan (range 0 1 square)
actTwo :: Udp -> Maybe O.Message -> IO ()
actTwo _ _ = do
h1 $ slow 4 $ blink "off"
listenOne :: IO ()
listenOne = do udp <- udpServer "0.0.0.0" listenPortOne
loop udp
where
loop udp =
do m <- recvMessage udp
actOne udp m
loop udp
listenTwo :: IO ()
listenTwo = do udp <- udpServer "0.0.0.0" listenPortTwo
loop udp
where
loop udp =
do m <- recvMessage udp
actTwo udp m
loop udp
actThree :: Udp -> Maybe O.Message -> IO ()
actThree _ _ = do
h2 $ slow 8 $ blink "off"
-- d1 $ fast 4 $ sound "sn" # pan (range 0 1 square)
actFour :: Udp -> Maybe O.Message -> IO ()
actFour _ _ = do
h2 $ slow 4 $ blink "on"
listenThree :: IO ()
listenThree = do udp <- udpServer "0.0.0.0" listenPortThree
loop udp
where
loop udp =
do m <- recvMessage udp
actOne udp m
loop udp
listenFour :: IO ()
listenFour = do udp <- udpServer "0.0.0.0" listenPortFour
loop udp
where
loop udp =
do m <- recvMessage udp
actTwo udp m
loop udp
office = do
forkIO listenOne
forkIO listenTwo
forkIO listenThree
forkIO listenFour
office