{
"Fractional a => Pattern a": {
"oscillators": "sine", "cosine", "tri", "square", "tri", "saw", "isaw",
"random generators": "rand"
},
"Num a => Pattern a": {
"random generators": "irand"
},
"Pattern Int -> ControlPattern -> ControlPattern": {
"control functions": "spin", "chop", "striate", "gap", "randslice"
},
"Pattern Int -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a" : {
"functions": "every", "chunk", "chunk'", "plyWith"
},
{
"Int": {
"1", "2","4","8","16"..
}
}
}
d1 $ every 2 (chop 2 ) $ sound "" #pan (sine *2)
==>
d1 $ chunk 2 (hurry 4 ) $ sound "" # pan (rand *2)
import System.Random
g <- getStdGen
let randVal = take 10 (randoms g :: [Float])
let x0 = randVal!!0
x1 = randVal!!1
-- replace this from the json grammar ..
let functionArray = [C.sine, C.cosine, C.tri, C.saw]
functionChooser :: (Ord a2, Real a1, Fractional a2, Fractional a1) => a2 -> Pattern a1
functionChooser randVal
| (randVal >= 0 && randVal < 0.25) = functionArray!!0
| (randVal >= 0.25 && randVal < 0.5) = functionArray!!1
| (randVal >= 0.5 && randVal < 0.75) = functionArray!!2
| (randVal >= 0.75 && randVal < 1) = functionArray!!3
| otherwise = functionArray!!4 -- add in
d1 $ s "bd(3,8)" # speed (slow 4 $ functionChooser (x1))
-- doesn't explicity show what pattern is chosen, see autcode example..?
TODO:
-- Create state transition matrices, based on existing code performances etc, probability of various associations -- https://github.com/lwlsn/tidal_codes (automated script on this repository?)