initial commit

This commit is contained in:
Riviera Taylor 2024-10-22 17:18:37 +02:00
parent 7851cf121b
commit fa7946a2c6
8 changed files with 253 additions and 0 deletions

View File

View File

View File

View File

173
tidal/boot/2024-10-22.hs Normal file
View File

@ -0,0 +1,173 @@
:set -XOverloadedStrings
:set prompt ""
import Sound.Tidal.Context
import System.IO (hSetEncoding, stdout, utf8)
hSetEncoding stdout utf8
listenPortOne = 8001
listenPortTwo = 8002
listenPortThree = 8003
listenPortFour = 8004
listenPortFive = 8005
listenPortSix = 8006
listenPortSeven = 8007
listenPortEight = 8008
listenPortNine = 8009
listenPortTen = 8010
listenPortEleven = 8011
listenPortTwelve = 8012
listenPortThriteen = 8013
listenPortFourteen = 8014
listenPortFifteen = 8015
listenPortSixteen = 8016
listenPortSeventeen = 8017
listenPortEighteen = 8018
listenPortNineteen = 8019
listenPortTwenty = 8020
listenPortTwentyOne = 8021
listenPortTwentyTwo = 8022
listenPortTwentyThree = 8023
listenPortTwentyFour = 8024
listenPortTwentyFive = 8025
listenPortTwentySix = 8026
listenPortTwentySeven = 8027
listenPortTwentyEight = 8028
listenPortTwentyNine = 8029
listenPortThirty = 8030
listenPortThirtyOne = 8031
listenPortThirtyTwo = 8032
:{
let lolinTarget =
Target {oName = "lolin",
oAddress = "192.168.1.110",
oPort = 7000,
oLatency = 0.15,
oSchedule = Live,
oWindow = Nothing,
oHandshake = False,
oBusPort = Nothing
}
lolinLedAnalog = [("intensity", Just $ VF 0)]
lolinLedDigital = [("blink", Just $ VS "off")]
lolinFormats = [(OSC "/led/analog" $ ArgList lolinLedAnalog),
(OSC "/led/digital" $ ArgList lolinLedDigital)
]
lolinMap = [(lolinTarget, lolinFormats)]
:}
lolinStream <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6010}) lolinMap
h1 = streamReplace lolinStream 1
:{
let devkitTarget =
Target {oName = "devkit",
oAddress = "192.168.1.111",
oPort = 7000,
oLatency = 0.15,
oSchedule = Live,
oWindow = Nothing,
oHandshake = False,
oBusPort = Nothing
}
devkitLedAnalog = [("intensity", Just $ VF 0)]
devkitLedDigital = [("blink", Just $ VS "off")]
devkitFormats = [(OSC "/led/analog" $ ArgList devkitLedAnalog),
(OSC "/led/digital" $ ArgList devkitLedDigital)
]
devkitMap = [(devkitTarget, devkitFormats)]
:}
devkitStream <- startStream (defaultConfig {cCtrlAddr = "0.0.0.0", cCtrlPort = 6020}) devkitMap
h2 = streamReplace devkitStream 1
:{
let intensity = pF "intensity"
blink = pS "blink"
:}
tidal <- startTidal (superdirtTarget {oLatency = 0.05, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20, cCtrlAddr = "0.0.0.0", cCtrlPort = 6030})
:{
let only = (hush >>)
p = streamReplace tidal
hush = streamHush tidal
panic = do hush
once $ sound "superpanic"
list = streamList tidal
mute = streamMute tidal
unmute = streamUnmute tidal
unmuteAll = streamUnmuteAll tidal
unsoloAll = streamUnsoloAll tidal
solo = streamSolo tidal
unsolo = streamUnsolo tidal
once = streamOnce tidal
first = streamFirst tidal
asap = once
nudgeAll = streamNudgeAll tidal
all = streamAll tidal
resetCycles = streamResetCycles tidal
setCycle = streamSetCycle tidal
setcps = asap . cps
getcps = streamGetcps tidal
getnow = streamGetnow tidal
xfade i = transition tidal True (Sound.Tidal.Transition.xfadeIn 4) i
xfadeIn i t = transition tidal True (Sound.Tidal.Transition.xfadeIn t) i
histpan i t = transition tidal True (Sound.Tidal.Transition.histpan t) i
wait i t = transition tidal True (Sound.Tidal.Transition.wait t) i
waitT i f t = transition tidal True (Sound.Tidal.Transition.waitT f t) i
jump i = transition tidal True (Sound.Tidal.Transition.jump) i
jumpIn i t = transition tidal True (Sound.Tidal.Transition.jumpIn t) i
jumpIn' i t = transition tidal True (Sound.Tidal.Transition.jumpIn' t) i
jumpMod i t = transition tidal True (Sound.Tidal.Transition.jumpMod t) i
jumpMod' i t p = transition tidal True (Sound.Tidal.Transition.jumpMod' t p) i
mortal i lifespan release = transition tidal True (Sound.Tidal.Transition.mortal lifespan release) i
interpolate i = transition tidal True (Sound.Tidal.Transition.interpolate) i
interpolateIn i t = transition tidal True (Sound.Tidal.Transition.interpolateIn t) i
clutch i = transition tidal True (Sound.Tidal.Transition.clutch) i
clutchIn i t = transition tidal True (Sound.Tidal.Transition.clutchIn t) i
anticipate i = transition tidal True (Sound.Tidal.Transition.anticipate) i
anticipateIn i t = transition tidal True (Sound.Tidal.Transition.anticipateIn t) i
forId i t = transition tidal False (Sound.Tidal.Transition.mortalOverlay t) i
d1 = p 1 . (|< orbit 0)
d2 = p 2 . (|< orbit 1)
d3 = p 3 . (|< orbit 2)
d4 = p 4 . (|< orbit 3)
d5 = p 5 . (|< orbit 4)
d6 = p 6 . (|< orbit 5)
d7 = p 7 . (|< orbit 6)
d8 = p 8 . (|< orbit 7)
d9 = p 9 . (|< orbit 8)
d10 = p 10 . (|< orbit 9)
d11 = p 11 . (|< orbit 10)
d12 = p 12 . (|< orbit 11)
d13 = p 13
d14 = p 14
d15 = p 15
d16 = p 16
:}
:{
let getState = streamGet tidal
setI = streamSetI tidal
setF = streamSetF tidal
setS = streamSetS tidal
setR = streamSetR tidal
setB = streamSetB tidal
:}
:set prompt "> "
:set prompt-cont ""
default (Pattern String, Integer, Double)

View File

@ -0,0 +1,80 @@
-- (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