algorithmic-composition-basic-0.2.2.0: Helps to create experimental music from a file (or its part) and a Ukrainian text.
Copyright(c) OleksandrZhabenko 2020-2021
LicenseMIT
Maintainerolexandr543@yahoo.com
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010
ExtensionsBangPatterns

Composition.Sound.Functional.Elements

Description

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.

Synopsis

Functions to edit OvertonesO and function f

renormF :: OvertonesO -> OvertonesO Source #

Renormalizes amplitudes for the frequencies so that the maximum one of them (if OvertonesO is not []) is equal by the absolute value to 1.0 and the mutual ratios of the amplitudes are preserved.

uniq :: Eq a => [a] -> [a] Source #

luniq :: Eq a => [a] -> Int Source #

renormFD :: Float -> OvertonesO -> OvertonesO Source #

Renormalizes amplitudes for the frequencies so that the maximum one of them (if OvertonesO is not []) is equal by the absolute value to Float argument and the mutual ratios of the amplitudes are preserved.

sameOvertone :: OvertonesO -> Bool Source #

Predicate to check whether all tuples in the list have the same first element.

sameFreqF :: Float -> (Float, Float) -> (Float -> OvertonesO) -> ((Float, Float) -> OvertonesO -> OvertonesO) -> OvertonesO Source #

g :: (Float,Float) -> OvertonesO -> OvertonesO is a function that defines how the new element is added to the OvertonesO. It depends only on the element being added and the actual OvertonesO. It does not depend on the Float argument for f :: Float -> OvertonesO so for different Float for f it gives the same result.

sameFreqFI :: Float -> (Float, Float) -> (Float -> OvertonesO) -> ((Float, Float) -> OvertonesO -> OvertonesO) -> OvertonesO Source #

g :: (Float,Float) -> OvertonesO -> OvertonesO is a function that defines how the new element is added to the OvertonesO. Variant of sameFreqF where g depends only on the elements of the OvertonesO, which first elements in the tuples equal to the first element in the (Float,Float). It does not depend on the Float argument for f :: Float -> OvertonesO so for different Float for f it gives the same result.

fAddFElem :: (Float, Float) -> (Float -> OvertonesO) -> ((Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO) -> Float -> OvertonesO Source #

gAdd :: (Float,Float) -> Float -> (Float -> OvertonesO) -> OvertonesO is a function that defines how the element is added to the OvertonesO. fAddFElem is actually a higher-order function, it changes the function f and returns a new one. It can be an interesting task (in general) to look at such a function through a prism of notion of operator (mathematical, for example similar to that ones that are used for quantum mechanics and quantum field theory). gAdd allows not only to insert an element if missing, but to change all the OvertonesO system. So depending on the complexity, it can produce rather complex behaviour.

fRemoveFElem :: (Float, Float) -> (Float -> OvertonesO) -> ((Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO) -> Float -> OvertonesO Source #

gRem:: (Float,Float) -> Float -> (Float -> OvertonesO) -> OvertonesO is a function that defines how the element is removed from the OvertonesO. fRemoveFElem is actually a higher-order function, it changes the function f and returns a new one. It can be an interesting task (in general) to look at such a function through a prism of notion of operator (mathematical, for example that ones that are used for quantum mechanics and quantum field theory). gRem allows not only to delete an element if existing, but to change all the OvertonesO system. So depending on the complexity, it can produce rather complex behaviour.

fChangeFElem :: (Float, Float) -> Float -> (Float -> (Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO) -> (Float -> OvertonesO) -> Float -> OvertonesO Source #

Changes elements of the OvertonesO using two functions. It is a generalization of the fAddFElem and fRemoveFElem functions. For example, if the first of the two inner functional arguments acts as gAdd01 or similar, then it adds element to the OvertonesO, if it acts as gRem01, then it removes the element. Its behaviour is defined by the Float parameter (meaning frequency, probably), so you can change elements depending on what point it is applied.

gAdd01 :: (Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Example of the function gAdd for the fAddFElem. If the frequency is already in the OvertonesO then the corresponding amplitude is divided equally between all the elements with the repeated given frequency from (Float, Float). Otherwise, it is just concatenated to the OvertonesO.

gAdd02 :: Float -> (Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Can be used to produce an example of the function gAdd for the fAddFElem. Similar to gAdd01, but uses its first argument to renorm the result of the gAdd01 so that its maximum by absolute value amplitude equals to the first argument.

gAdd03 :: (Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Example of the function gAdd. for the fAddFElem. If the frequency is not already in the OvertonesO then the corresponding element is added and the OvertonesO are renormed with renormF. Otherwise, the element is tried to be inserted with a new frequency between the greatest by an absolute values notes as an intermediate value with the respective amplitude, or if there is only one element, to produce two elements in the resulting list with two consequent harmonics.

gAdd04 :: (Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Example of the function gAdd. for the fAddFElem. It tries to insert the given (Float,Float) into the less dense frequency region.

gRem01 :: (Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Example of the function gRem for the fRemoveFElem. If the element is already in the OvertonesO then it is removed (if there are more than 5 elements already) and OvertonesO are renormalized. Otherwise, all the same for the element already existing elements become less in an amlitude for a numbers that in sum equal to amplitude of the removed element.

gRem02 :: Float -> (Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Can be used to produce an example of the function gRem for the fRemoveFElem. Similar to gRem01, but uses its first argument to renorm the result of the gRem01 so that its maximum by absolute value amplitude equals to the first argument.

gRem03 :: (Float, Float) -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Example of the function gRem for the fRemFElem. It tries not to remove elements from the less than 6 elements OvertonesO and to remove all the elements in the given range with the width of the twice as many as the second Float in the first argument tuple and the centre in the first Float in the tuple. Similar to somewhat bandreject filter but with more complex behaviour for the sound to be more complex.

Working with two OvertonesO

fAddFElems :: OvertonesO -> (Float -> OvertonesO) -> (OvertonesO -> Float -> (Float -> OvertonesO) -> OvertonesO) -> Float -> OvertonesO Source #

Similar to fAddFElem, but instead of one element (Float,Float) it deals with a list of such elements that is OvertonesO.

fRemoveFElems :: OvertonesO -> (Float -> OvertonesO) -> (OvertonesO -> Float -> (Float -> OvertonesO) -> OvertonesO) -> Float -> OvertonesO Source #

Similar to fRemoveFElem, but instead of one element (Float,Float) it deals with a list of such elements that is OvertonesO.

fChangeFElems :: OvertonesO -> Float -> (Float -> OvertonesO -> Float -> (Float -> OvertonesO) -> OvertonesO) -> (Float -> OvertonesO) -> Float -> OvertonesO Source #

Similar to fChangeFElem, but use another form of the changing function, so it can deal with not only single element of the OvertonesO, but also with several ones.

freqsOverlapOvers :: OvertonesO -> OvertonesO -> Bool Source #

Binary predicate to check whether two given OvertonesO both have the elements with the same first element in the tuples. If True then this means that OvertonesO are at least partially overlaped by the first elements in the tuples (meaning frequencies).

elemsOverlapOvers :: OvertonesO -> OvertonesO -> Bool Source #

Similar to freqsOverlapOvers, but checks whether the whole tuples are the same instead of the first elements in the tuples are the same.

gAdds01 :: OvertonesO -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Example of the function gAdds for the fAddFElems. Partial function.

gAdds02 :: Float -> OvertonesO -> Float -> (Float -> OvertonesO) -> OvertonesO Source #

Can be used to produce an example of the function gAdds for the fAddFElems. Similar to gAdds01, but uses its first argument to renorm the result of the gAdds01 so that its maximum by absolute value amplitude equals to the first argument.