From 6acdc72db18b774b92581fcbded46023124226a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Mon, 5 Feb 2024 03:22:06 +0100 Subject: [PATCH] Something audible! (in "lists.tidal") --- BootTidal.hs | 1 + scratchpads/BootTidal.hs | 5 ++--- scratchpads/lists.tidal | 13 ++++++++++++- tools/tidal.sh | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) create mode 120000 BootTidal.hs diff --git a/BootTidal.hs b/BootTidal.hs new file mode 120000 index 0000000..4e4078d --- /dev/null +++ b/BootTidal.hs @@ -0,0 +1 @@ +scratchpads/BootTidal.hs \ No newline at end of file diff --git a/scratchpads/BootTidal.hs b/scratchpads/BootTidal.hs index 986549c..c593985 100644 --- a/scratchpads/BootTidal.hs +++ b/scratchpads/BootTidal.hs @@ -1,5 +1,6 @@ :set -XOverloadedStrings :set prompt "" +:cd /home/phillip/Projekte/HTWK/Computermusik/data-composition/scratchpads import Sound.Tidal.Context @@ -7,9 +8,7 @@ import System.IO (hSetEncoding, stdout, utf8) hSetEncoding stdout utf8 -- Load Data -:l TemperatureData --- :l HumidityData --- :l BatteryData +:l TemperatureData HumidityData BatteryData tidal <- startTidal (superdirtTarget {oLatency = 0.05, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20}) diff --git a/scratchpads/lists.tidal b/scratchpads/lists.tidal index 0e1a7c9..fe56a0f 100644 --- a/scratchpads/lists.tidal +++ b/scratchpads/lists.tidal @@ -1,5 +1,16 @@ +import Text.Read +import Data.Maybe +import TemperatureData +import HumidityData +import BatteryData + d1 $ s "bd" +-- Yes, i know this is not optimal... +getFloat x = maybe 0.0 id (readMaybe x :: Maybe Float) -map snd $ take 10 $ temperaturedata \ No newline at end of file +-- Do something audible with the temperature data for the first time ever +d1 $ fast 10 $ n (fromList (map (\x -> fromInteger (round ((getFloat x)*10))) (map (\x -> snd x) (take 100 temperaturedata)))) # s "jvbass" # room 0.5 # delay 0.7 + +d2 $ fast 10 $ n (fromList (map (\x -> fromInteger (round ((getFloat x)*5))) (map (\x -> snd x) (take 100 humiditydata)))) # s "arpy" # room 0.5 # delay 0.7 \ No newline at end of file diff --git a/tools/tidal.sh b/tools/tidal.sh index c999633..c1bfcd2 100755 --- a/tools/tidal.sh +++ b/tools/tidal.sh @@ -1,3 +1,3 @@ #!/bin/sh -ghci -ghci-script "$(ghc -e 'import Paths_tidal' -e 'getDataDir>>=putStr')/BootTidal.hs" +ghci -ghci-script ../scratchpads/BootTidal.hs