mirror of
https://gitlab.dit.htwk-leipzig.de/computermusik-ws23/data-composition.git
synced 2025-05-18 22:01:47 +02:00
Update
This commit is contained in:
parent
455aa7fc31
commit
6dd0c39b7e
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -18,5 +18,6 @@
|
|||||||
"titleBar.inactiveBackground": "#2d620799",
|
"titleBar.inactiveBackground": "#2d620799",
|
||||||
"titleBar.inactiveForeground": "#e7e7e799"
|
"titleBar.inactiveForeground": "#e7e7e799"
|
||||||
},
|
},
|
||||||
"peacock.color": "#2d6207"
|
"peacock.color": "#2d6207",
|
||||||
|
"tidalcycles.bootTidalPath": "/home/phillip/Projekte/HTWK/Computermusik/data-composition/configs/BootTidal.hs"
|
||||||
}
|
}
|
@ -2,9 +2,6 @@
|
|||||||
:set -XExtendedDefaultRules
|
:set -XExtendedDefaultRules
|
||||||
:set prompt ""
|
:set prompt ""
|
||||||
|
|
||||||
-- Load Data. This currently is pinned to my setup.
|
|
||||||
:cd /home/phillip/Projekte/HTWK/Computermusik/data-composition/datamodules
|
|
||||||
|
|
||||||
import Sound.Tidal.Context
|
import Sound.Tidal.Context
|
||||||
|
|
||||||
import System.IO (hSetEncoding, stdout, utf8)
|
import System.IO (hSetEncoding, stdout, utf8)
|
||||||
@ -15,9 +12,29 @@ hSetEncoding stdout utf8
|
|||||||
:set -package bytestring
|
:set -package bytestring
|
||||||
:set -package random
|
:set -package random
|
||||||
|
|
||||||
|
-- Load all the Modules i need for data transformation, plotting and other stuff.
|
||||||
|
import Text.Read
|
||||||
|
import Data.Maybe
|
||||||
|
import Graphics.Gnuplot.Simple
|
||||||
|
import qualified Graphics.Gnuplot.Terminal.QT as QT
|
||||||
|
import System.Random
|
||||||
|
|
||||||
|
|
||||||
|
-- Have Chords available all the time
|
||||||
|
import Sound.Tidal.Chords
|
||||||
|
|
||||||
|
|
||||||
-- Load Data
|
-- Load Data
|
||||||
|
:cd /home/phillip/Projekte/HTWK/Computermusik/data-composition/datamodules
|
||||||
:l TemperatureData HumidityData BatteryData
|
:l TemperatureData HumidityData BatteryData
|
||||||
|
|
||||||
|
-- Load Data. This currently is pinned to my setup.
|
||||||
|
import TemperatureData
|
||||||
|
import HumidityData
|
||||||
|
import BatteryData
|
||||||
|
|
||||||
|
|
||||||
|
-- Normal Tidal Startup from here on
|
||||||
tidal <- startTidal (superdirtTarget {oLatency = 0.05, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20})
|
tidal <- startTidal (superdirtTarget {oLatency = 0.05, oAddress = "127.0.0.1", oPort = 57120}) (defaultConfig {cVerbose = True, cFrameTimespan = 1/20})
|
||||||
|
|
||||||
:{
|
:{
|
||||||
@ -88,6 +105,21 @@ let getState = streamGet tidal
|
|||||||
setB = streamSetB tidal
|
setB = streamSetB tidal
|
||||||
:}
|
:}
|
||||||
|
|
||||||
|
|
||||||
|
-- Custom Functions
|
||||||
|
:{
|
||||||
|
let getRawValueList tableData = map (\x -> snd x) tableData
|
||||||
|
getRawLabelList tableData = map (\x -> fst x) tableData
|
||||||
|
makePlottableList list = zip [0..] list
|
||||||
|
plotPlainList list = plotListStyle [] (defaultStyle {plotType = LinesPoints, lineSpec = CustomStyle [LineTitle "Numerical Value", LineWidth 3, PointType 7, PointSize 3]}) $ makePlottableList list
|
||||||
|
getNum value scalar = fromInteger $ round $ (maybe 0.0 id (readMaybe value :: Maybe Float)) * scalar
|
||||||
|
listToNum list = map (\x -> getNum x 1) list
|
||||||
|
sliceAt start length list = take length (drop start list)
|
||||||
|
normalize max list = map (\x -> fromIntegral ( round ( max * ( x / (maximum list))))) list
|
||||||
|
normalizeAt zero max list = map (\x -> fromIntegral ( round ( max * ((x - zero)/ (maximum (map (\y -> y - zero) list)))))) list
|
||||||
|
scaleBetween low high max list = map (\x -> fromIntegral ( round (max * ((x - low)/ (high - low))))) list
|
||||||
|
:}
|
||||||
|
|
||||||
:set prompt "tidal> "
|
:set prompt "tidal> "
|
||||||
:set prompt-cont ""
|
:set prompt-cont ""
|
||||||
|
|
54
configs/superdirt_startup.scd
Normal file
54
configs/superdirt_startup.scd
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
This is an example startup file.
|
||||||
|
If you want to modify it, best copy it elsewhere to keep the git repository clean.
|
||||||
|
|
||||||
|
You can then load it by calling
|
||||||
|
"path/to/my/superdirt_startup.scd".load
|
||||||
|
from the supercollider startup file
|
||||||
|
|
||||||
|
The supercollider startup file is to be found in
|
||||||
|
Platform.userAppSupportDir +/+ "startup.scd",
|
||||||
|
or via the menu File > Open startup file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
(
|
||||||
|
s.reboot { // server options are only updated on reboot
|
||||||
|
// configure the sound server: here you could add hardware specific options
|
||||||
|
// see http://doc.sccode.org/Classes/ServerOptions.html
|
||||||
|
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
|
||||||
|
s.options.memSize = 8192 * 32; // increase this if you get "alloc failed" messages
|
||||||
|
s.options.numWireBufs = 64; // increase this if you get "exceeded number of interconnect buffers" messages
|
||||||
|
s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
|
||||||
|
s.options.numOutputBusChannels = 2; // set this to your hardware output channel size, if necessary
|
||||||
|
s.options.numInputBusChannels = 2; // set this to your hardware output channel size, if necessary
|
||||||
|
// boot the server and start SuperDirt
|
||||||
|
s.waitForBoot {
|
||||||
|
~dirt.stop; // stop any old ones, avoid duplicate dirt (if it is nil, this won't do anything)
|
||||||
|
~dirt = SuperDirt(2, s); // two output channels, increase if you want to pan across more channels
|
||||||
|
~dirt.loadSoundFiles(thisProcess.nowExecutingPath.dirname +/+ "../samples/*"); // load custom samples
|
||||||
|
~dirt.loadSoundFiles; // load samples (path containing a wildcard can be passed in)
|
||||||
|
s.sync; // wait for samples to be read
|
||||||
|
~dirt.start(57120, 0 ! 12); // start listening on port 57120, create two busses each sending audio to channel 0
|
||||||
|
|
||||||
|
// optional, needed for convenient access from sclang:
|
||||||
|
(
|
||||||
|
~d1 = ~dirt.orbits[0]; ~d2 = ~dirt.orbits[1]; ~d3 = ~dirt.orbits[2];
|
||||||
|
~d4 = ~dirt.orbits[3]; ~d5 = ~dirt.orbits[4]; ~d6 = ~dirt.orbits[5];
|
||||||
|
~d7 = ~dirt.orbits[6]; ~d8 = ~dirt.orbits[7]; ~d9 = ~dirt.orbits[8];
|
||||||
|
~d10 = ~dirt.orbits[9]; ~d11 = ~dirt.orbits[10]; ~d12 = ~dirt.orbits[11];
|
||||||
|
);
|
||||||
|
|
||||||
|
// directly below here, in your own copy of this file, you could add further code that you want to call on startup
|
||||||
|
// this makes sure the server and ~dirt are running
|
||||||
|
// you can keep this separate and make it easier to switch between setups
|
||||||
|
// by using "path/to/my/file.scd".load and if necessary commenting out different load statements
|
||||||
|
// ...
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
s.latency = 0.3; // increase this if you get "late" messages
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
);
|
47
performance_prep/base.tidal
Normal file
47
performance_prep/base.tidal
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
let temperatureScalar = 10
|
||||||
|
temperaturePattern = scale "major" (fromList (map (\x -> getNum x temperatureScalar) (map (\x -> snd x) (take 10 temperaturedata))) |- 150)
|
||||||
|
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
|
||||||
|
|
||||||
|
: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
|
||||||
|
|
||||||
|
battery = n ("x(3,5)" |> batteryPattern + "['maj | 'min]" )
|
||||||
|
batteryScalar = 5
|
||||||
|
queryArc battery (Arc 0 2)
|
||||||
|
|
||||||
|
queryArc temperature (Arc 0 2.5)
|
||||||
|
|
||||||
|
d1 $ fast 10 $ append (n (fromList (map (\x -> fromInteger (round ((getFloat x)*10))) (map (\x -> snd x) (take 100 temperaturedata))))) ("~!10") # 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
|
||||||
|
|
||||||
|
d1 $ trigger $ s "<bd sn*4 bd sn*2>"
|
||||||
|
|
||||||
|
d1 $ n ( run 10) # s "v"
|
||||||
|
:t map (\x -> getMaybeFloat (snd x)) (take 100 temperaturedata)
|
||||||
|
|
||||||
|
d1 $ n("c'maj f4'maj'ii g4'maj'i c'maj") # s "superpiano"
|
||||||
|
|
||||||
|
d1 $ slow 4 $ n "[1..5]" # s "meteo"
|
||||||
|
|
@ -44,6 +44,19 @@ getNum :: String -> Float -> Float
|
|||||||
getNum value scalar = fromInteger $ round $ (maybe 0.0 id (readMaybe value :: Maybe Float)) * scalar
|
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)
|
sliceList start end list = take (end - start + 1) (drop start list)
|
||||||
|
|
||||||
|
normalizeBetween :: Int Int [Float] -> [Float]
|
||||||
|
normalizeBetween min max list = map (\x -> (max - min) * ((x - min)/ (maximum (map (\y -> y - min) list)))) list
|
||||||
|
|
||||||
|
normalizeAt :: Int Int [Float] -> [Float]
|
||||||
|
normalizeAt zero max list = map (\x -> max * ((x - zero)/ (maximum (map (\y -> y - zero) list)))) list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
map (\x -> max * ( x / (maximum list))) list
|
||||||
|
|
||||||
|
|
||||||
|
maximum [1,2,3,4,5]
|
||||||
|
|
||||||
|
|
||||||
let temperatureScalar = 10
|
let temperatureScalar = 10
|
||||||
temperaturePattern = scale "major" (fromList (map (\x -> getNum x temperatureScalar) (map (\x -> snd x) (take 10 temperaturedata))) |- 150)
|
temperaturePattern = scale "major" (fromList (map (\x -> getNum x temperatureScalar) (map (\x -> snd x) (take 10 temperaturedata))) |- 150)
|
||||||
@ -54,9 +67,6 @@ queryArc (n ("1 2 3 4 5 6 7 8")) (Arc 0 1)
|
|||||||
|
|
||||||
:i fromInteger
|
:i fromInteger
|
||||||
|
|
||||||
|
|
||||||
getRawLabelList temper
|
|
||||||
|
|
||||||
:t temperaturedata
|
:t temperaturedata
|
||||||
|
|
||||||
length $ listToNum $ getRawValueList $ temperaturedata
|
length $ listToNum $ getRawValueList $ temperaturedata
|
||||||
@ -93,3 +103,4 @@ d1 $ n ( run 10) # s "v"
|
|||||||
|
|
||||||
d1 $ n("c'maj f4'maj'ii g4'maj'i c'maj") # s "superpiano"
|
d1 $ n("c'maj f4'maj'ii g4'maj'i c'maj") # s "superpiano"
|
||||||
|
|
||||||
|
d1 $ slow 4 $ n "[1..5]" # s "meteo"
|
BIN
samples/meteo/1.wav
Normal file
BIN
samples/meteo/1.wav
Normal file
Binary file not shown.
BIN
samples/meteo/2.wav
Normal file
BIN
samples/meteo/2.wav
Normal file
Binary file not shown.
BIN
samples/meteo/3.wav
Normal file
BIN
samples/meteo/3.wav
Normal file
Binary file not shown.
BIN
samples/meteo/4.wav
Normal file
BIN
samples/meteo/4.wav
Normal file
Binary file not shown.
BIN
samples/meteo/5.wav
Normal file
BIN
samples/meteo/5.wav
Normal file
Binary file not shown.
@ -1,4 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Make SuperCollider construct the Path to the default SuperDirt startup file and load it.
|
# Load Supercollider with custom SuperDirt startup script
|
||||||
# Afterwards direct stdin to sclang so we can control it.
|
SCRIPT=$(readlink -f "$0")
|
||||||
(echo -e 'load(Platform.userAppSupportDir+/+"/downloaded-quarks/SuperDirt/superdirt_startup.scd")' && cat) | sclang
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||||
|
PROJECTBASEDIR=$(dirname "$SCRIPTPATH")
|
||||||
|
|
||||||
|
cd "$PROJECTBASEDIR/configs" || exit
|
||||||
|
sclang "$PROJECTBASEDIR/configs/superdirt_startup.scd"
|
@ -1,3 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
ghci -ghci-script ../scratchpads/BootTidal.hs
|
|
||||||
|
SCRIPT=$(readlink -f "$0")
|
||||||
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||||
|
PROJECTBASEDIR=$(dirname "$SCRIPTPATH")
|
||||||
|
|
||||||
|
ghci -ghci-script "$PROJECTBASEDIR/configs/BootTidal.hs"
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
# Script location
|
# Script location
|
||||||
SCRIPT=$(readlink -f "$0")
|
SCRIPT=$(readlink -f "$0")
|
||||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||||
|
PROJECTBASEDIR=$(dirname "$SCRIPTPATH")
|
||||||
|
|
||||||
cd "$SCRIPTPATH"/Troop || exit
|
cd "$SCRIPTPATH"/Troop || exit
|
||||||
# Explicit python version is on purpose, Troop won't work with python 3.11+
|
# 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"
|
python3.10 run-client.py --cli --syntax "tidalcycles" --mode $(which ghci) --args "-ghci-script $PROJECTBASEDIR/configs/BootTidal.hs"
|
@ -6,4 +6,4 @@ PROJECTBASEDIR=$(dirname "$SCRIPTPATH")
|
|||||||
|
|
||||||
cd "$SCRIPTPATH"/Troop || exit
|
cd "$SCRIPTPATH"/Troop || exit
|
||||||
# Explicit python version is on purpose, Troop won't work with python 3.11+
|
# Explicit python version is on purpose, Troop won't work with python 3.11+
|
||||||
python3.10 run-server.py
|
python3.10 run-server.py --password ""
|
Loading…
x
Reference in New Issue
Block a user