mirror of
https://gitlab.dit.htwk-leipzig.de/computermusik-ws23/data-composition.git
synced 2025-05-18 22:31:47 +02:00
Update
This commit is contained in:
parent
c9592fadd2
commit
455aa7fc31
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "paper"]
|
||||
path = paper
|
||||
url = https://git@git.overleaf.com/65c0de00fe99eea78a9ac0df
|
||||
[submodule "tools/Troop"]
|
||||
path = tools/Troop
|
||||
url = https://github.com/Qirky/Troop.git
|
||||
|
22
.vscode/settings.json
vendored
Normal file
22
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.activeBackground": "#43920a",
|
||||
"activityBar.background": "#43920a",
|
||||
"activityBar.foreground": "#e7e7e7",
|
||||
"activityBar.inactiveForeground": "#e7e7e799",
|
||||
"activityBarBadge.background": "#a6c8f9",
|
||||
"activityBarBadge.foreground": "#15202b",
|
||||
"commandCenter.border": "#e7e7e799",
|
||||
"sash.hoverBorder": "#43920a",
|
||||
"statusBar.background": "#2d6207",
|
||||
"statusBar.foreground": "#e7e7e7",
|
||||
"statusBarItem.hoverBackground": "#43920a",
|
||||
"statusBarItem.remoteBackground": "#2d6207",
|
||||
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#2d6207",
|
||||
"titleBar.activeForeground": "#e7e7e7",
|
||||
"titleBar.inactiveBackground": "#2d620799",
|
||||
"titleBar.inactiveForeground": "#e7e7e799"
|
||||
},
|
||||
"peacock.color": "#2d6207"
|
||||
}
|
@ -1 +0,0 @@
|
||||
scratchpads/BootTidal.hs
|
@ -1,4 +1,4 @@
|
||||
"time","°C.value"
|
||||
"time","C.value"
|
||||
"2023-01-01T00:00:04.009+01:00","15.2"
|
||||
"2023-01-01T00:09:40.198+01:00","15"
|
||||
"2023-01-01T00:58:31.315+01:00","14.9"
|
||||
|
Can't render this file because it is too large.
|
2
paper
2
paper
@ -1 +1 @@
|
||||
Subproject commit f69ec93db93c2277168a64e0ecebfa22880cb6ee
|
||||
Subproject commit 53166e07376e51d9f93c2d7c0d6f6c546bcdea88
|
@ -1,17 +1,16 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
-- This requires my custom BootTidal.hs
|
||||
|
||||
|
||||
|
||||
import Prelude hiding (filter)
|
||||
import qualified Data.ByteString.Lazy as BL
|
||||
import Data.Csv -- this is from the Cassava library
|
||||
import qualified Data.Vector as V
|
||||
-- import System.Directory (doesFileExist)
|
||||
-- import Text.Printf
|
||||
-- import Control.Monad (forM_)
|
||||
import GHC.IO.Exception
|
||||
import Data.List
|
||||
import Control.Exception (try)
|
||||
|
||||
import qualified Data.ByteString.Lazy as BL
|
||||
import qualified Data.Vector as V
|
||||
import Graphics.Matplotlib
|
||||
|
||||
data TimestampedDatum = TimestampedDatum {
|
||||
timestamp :: String,
|
||||
@ -30,6 +29,8 @@ instance FromNamedRecord TimestampedDatum where
|
||||
type ErrorMsg = String
|
||||
type CsvData = (Header, V.Vector TimestampedDatum)
|
||||
|
||||
data CsvData = CsvData (Header, V.Vector TimestampedDatum)
|
||||
|
||||
parseCsv :: FilePath -> IO (Either ErrorMsg CsvData)
|
||||
parseCsv filePath = do
|
||||
result <- try $ BL.readFile filePath
|
||||
@ -37,8 +38,16 @@ parseCsv filePath = do
|
||||
Left (exception :: IOException) -> Left $ show exception
|
||||
Right contents -> decodeByName contents
|
||||
|
||||
getList :: CsvData -> V.Vector TimestampedDatum
|
||||
getList = snd
|
||||
getList :: Either ErrorMsg CsvData -> [Float]
|
||||
getList maybeCsvData = case maybeCsvData of
|
||||
CsvData (_, v) -> map datum v
|
||||
ErrorMsg _ -> []
|
||||
|
||||
getList parseCsv dataPath
|
||||
|
||||
d1 =<< (fmap (\x -> ) (parseCsv dataPath))
|
||||
|
||||
-- getValue :: TimestampedDatum -> Float
|
||||
-- getValue = datum
|
||||
|
||||
onscreen $ getList parseCsv dataPath
|
@ -2,4 +2,6 @@
|
||||
|
||||
d7 $ s "superpiano*2" # n (quantise 1 (perlin * 10))
|
||||
-- Why does the following not work then???
|
||||
d7 $ s "superpiano*2" # n (scale "major" (perlin * 10))
|
||||
d3 $ s "superpiano*2" # scale "major" n (quantise 1 ((perlin * 10)))
|
||||
|
||||
d1 $ s "bd"
|
@ -1,5 +1,3 @@
|
||||
import TemperatureData
|
||||
|
||||
data ValueRecord a = ValueRecord {
|
||||
time :: Data.Time.UTCTime,
|
||||
value :: a
|
||||
|
@ -4,10 +4,43 @@ import Sound.Tidal.Chords
|
||||
import TemperatureData
|
||||
import HumidityData
|
||||
import BatteryData
|
||||
import Graphics.Gnuplot.Simple
|
||||
import qualified Graphics.Gnuplot.Terminal.QT as QT
|
||||
import System.Random
|
||||
|
||||
|
||||
d1 $ s "bd"
|
||||
d1 $ s "[bd*4, ~!2 hh ~ hh*3 hh ~]" # room 0.1
|
||||
|
||||
randInt :: Int -> Int -> IO Int
|
||||
randInt minVal maxVal = randomRIO (minVal, maxVal)
|
||||
|
||||
getRawValueList :: [(a, a)] -> [a]
|
||||
getRawValueList tableData = map (\x -> snd x) tableData
|
||||
|
||||
getRawLabelList :: [(b, b)] -> [b]
|
||||
getRawLabelList tableData = map (\x -> fst x) tableData
|
||||
|
||||
makePlottableList :: [c] -> [(Int, c)]
|
||||
makePlottableList list = zip [0..] list
|
||||
|
||||
plotPlainList :: [(Int, d)] -> IO ()
|
||||
plotPlainList list = plotList [] $ makePlottableList list
|
||||
|
||||
listToNum :: [String] -> [Float]
|
||||
listToNum list = map (\x -> getNum x 1) list
|
||||
|
||||
getRandomStartIndex :: Int -> Int -> IO Int
|
||||
getRandomStartIndex listLength sliceSize = do
|
||||
gen <- getStdGen
|
||||
let validRange = listLength - sliceSize + 1
|
||||
randomInt <- randomR (0, validRange - 1) gen
|
||||
return randomInt
|
||||
|
||||
randomSlice :: Int -> [a] -> [a]
|
||||
randomSlice list length = take
|
||||
|
||||
|
||||
getNum :: String -> Float -> Float
|
||||
getNum value scalar = fromInteger $ round $ (maybe 0.0 id (readMaybe value :: Maybe Float)) * scalar
|
||||
sliceList start end list = take (end - start + 1) (drop start list)
|
||||
|
||||
@ -17,15 +50,34 @@ let temperatureScalar = 10
|
||||
temperature = fast 4 $ n ("x(3,5)" |> temperaturePattern + "['maj | 'min]" )# s "superpiano" # room 0.5
|
||||
in d1 $ temperature
|
||||
|
||||
queryArc (n ("1 2 3 4 5 6 7 8")) (Arc 0 1)
|
||||
|
||||
:i fromInteger
|
||||
|
||||
|
||||
getRawLabelList temper
|
||||
|
||||
:t temperaturedata
|
||||
|
||||
length $ listToNum $ getRawValueList $ temperaturedata
|
||||
|
||||
plotList [] (zip [0..] (listToNum (getRawValueList $ take 10 temperaturedata)))
|
||||
|
||||
:t temperaturedata
|
||||
|
||||
|
||||
selection = listToNum (getRawValueList $ take 10 temperaturedata)
|
||||
|
||||
plotPlainList (selection)
|
||||
|
||||
|
||||
let batteryScalar = 5
|
||||
batteryPattern = scale "major" (fromList (map (\x -> getNum x batteryScalar) (map (\x -> snd x) (sliceList 500 510 batterydata))) |- 150)
|
||||
battery = n ("x(3,5)" |> batteryPattern + "['maj | 'min]" )# s "jvbass" # room 0.5
|
||||
in d2 $ battery
|
||||
|
||||
batteryScalar = 5
|
||||
batteryPattern = scale "major" (fromList (map (\x -> getNum x batteryScalar) (map (\x -> snd x) (sliceList 500 510 batterydata))) |- 150)
|
||||
battery = n ("x(3,5)" |> batteryPattern + "['maj | 'min]" )
|
||||
batteryScalar = 5
|
||||
queryArc battery (Arc 0 2)
|
||||
|
||||
queryArc temperature (Arc 0 2.5)
|
||||
@ -39,9 +91,5 @@ d1 $ trigger $ s "<bd sn*4 bd sn*2>"
|
||||
d1 $ n ( run 10) # s "v"
|
||||
:t map (\x -> getMaybeFloat (snd x)) (take 100 temperaturedata)
|
||||
|
||||
queryArc (n("c'maj f4'maj'ii g4'maj'i c'maj")) (Arc 0 1)
|
||||
d1 $ n("c'maj f4'maj'ii g4'maj'i c'maj") # s "superpiano"
|
||||
|
||||
scaleTable
|
||||
|
||||
|
||||
chordTable
|
1
tools/.python-version
Normal file
1
tools/.python-version
Normal file
@ -0,0 +1 @@
|
||||
3.10
|
@ -1,12 +1,20 @@
|
||||
:set -XOverloadedStrings
|
||||
:set -XExtendedDefaultRules
|
||||
:set prompt ""
|
||||
:cd /home/phillip/Projekte/HTWK/Computermusik/data-composition/scratchpads
|
||||
|
||||
-- Load Data. This currently is pinned to my setup.
|
||||
:cd /home/phillip/Projekte/HTWK/Computermusik/data-composition/datamodules
|
||||
|
||||
import Sound.Tidal.Context
|
||||
|
||||
import System.IO (hSetEncoding, stdout, utf8)
|
||||
hSetEncoding stdout utf8
|
||||
|
||||
-- Expose otherwise hidden modules
|
||||
:set -package vector
|
||||
:set -package bytestring
|
||||
:set -package random
|
||||
|
||||
-- Load Data
|
||||
:l TemperatureData HumidityData BatteryData
|
||||
|
1
tools/Troop
Submodule
1
tools/Troop
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 529c5eb14e456f683e6d23fd4adcddc8446aa115
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# Make SuperCollider construct the Path to the default SuperDirt startup file and load it.
|
||||
# Afterwards direct stdin to sclang so we can control it.
|
||||
(echo -e 'load(Platform.userAppSupportDir+/+"/downloaded-quarks/SuperDirt/superdirt_startup.scd")' && cat) | sclang
|
8
tools/troop_client_no_interpreter.sh
Executable file
8
tools/troop_client_no_interpreter.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Script location
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
|
||||
cd "$SCRIPTPATH"/Troop || exit
|
||||
# Explicit python version is on purpose, Troop won't work with python 3.11+
|
||||
python3.10 run-client.py --syntax "tidalcycles" --mode "none"
|
8
tools/troop_client_with_tidal_interpreter.sh
Executable file
8
tools/troop_client_with_tidal_interpreter.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Script location
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
|
||||
cd "$SCRIPTPATH"/Troop || exit
|
||||
# Explicit python version is on purpose, Troop won't work with python 3.11+
|
||||
python3.10 run-client.py --cli --syntax "tidalcycles" --mode $(which ghci) --args "-ghci-script $SCRIPTPATH/BootTidal.hs"
|
9
tools/troop_server.sh
Executable file
9
tools/troop_server.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Script location
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
PROJECTBASEDIR=$(dirname "$SCRIPTPATH")
|
||||
|
||||
cd "$SCRIPTPATH"/Troop || exit
|
||||
# Explicit python version is on purpose, Troop won't work with python 3.11+
|
||||
python3.10 run-server.py
|
Loading…
x
Reference in New Issue
Block a user