algorithmic-composition-basic- Helps to create experimental music from a file (or its part) and a Ukrainian text.
Copyright(c) OleksandrZhabenko 2020-2021
Safe HaskellNone



Helps to create experimental music from a file (or its part) and a Ukrainian text. It can also generate a timbre for the notes. Uses SoX inside.


Working with OvertonesO and function f

maybeFFromStrVec :: Int -> Float -> String -> Maybe (Float, Float -> [(Float, Float)]) Source #

Gets a function f::Float -> OvertonesO that can be used further. Has two variants with usage of closestNote (Int argument is greater than 0)v and without it (Int argument is less than 0). For both cases String must be in a form list of tuples of pairs of Float to get somewhat reasonable result. The function f can be shown using a special printing function showFFromStrVec. It is a simplest multiplicative (somewhat acoustically and musically reasonable) form for the function that can provide such a result that fits into the given data.

let (y,f1) = fromJust (maybeFFromStrVec 1 3583.9783 "[(25.368,0.2486356),(37.259,0.6464867),(486.153,0.374618646),(789.563,0.463486461)]") in (y,f1 3583.9783)


let (y,f1) = fromJust (maybeFFromStrVec (-1) 3583.9783 "[(25.368,0.2486356),(37.259,0.6464867),(486.153,0.374618646),(789.563,0.463486461)]") in (y,f1 3583.9783)


fVecCoefs :: Int -> Float -> String -> [Float] Source #

Gets multiplication coefficients for f::Float -> [(Float,Float)] from the maybeFFromStrVec with the same arguments.

showFFromStrVec :: Int -> Float -> String -> String Source #

Experimental show for f::Float -> [(Float,Float)] that is used only for visualisation. It is correct only with maybeFFromStrVec or equivalent function. Because the shape of the f is known the function can be defined.

showFFromStrVec (-1) 440 "[(25.358,0.3598),(489.35,0.4588962),(795.35,0.6853)]"

"(440.00,(\t -> [(0.05763181818181818 * t, 0.3598),(1.112159090909091 * t, 0.4588962),(1.8076136363636364 * t, 0.6853)]))"