-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A program and a library to create experimental music from a mono audio and a Ukrainian text -- -- It can also create a timbre for the notes. Uses SoX inside. @package dobutokO2 @version 0.21.0.0 -- | Maintainer : olexandr543@yahoo.com -- -- A program and a library to create experimental music from a mono audio -- and a Ukrainian text. module DobutokO.Sound.Functional -- | Is used to represent a sequence of intervals, each note being a -- Double value (its frequency in Hz). type SoundsO = Vector (Double, Double) -- | Is used to represent a set of obertones for the single sound, the -- first Double value is a frequency and the second one -- an -- amplitude. type ObertonesO = Vector (Double, Double) -- | Is used to represent a set of pairs of notes for each element of which -- the Double values (notes frequencies in Hz) are somewhat -- musically connected one with another.. type NotePairs = Vector (Double, Double) -- | Vector of musical notes in Hz. notes :: Vector Double -- | Function returns either the nearest two musical notes if frequency is -- higher than one for C0 and lower than one for B8 or the nearest note -- duplicated in a tuple. neighbourNotes :: Double -> Vector Double -> (Double, Double) -- | Returns the closest note to the given frequency in Hz. closestNote :: Double -> Double -- | Returns a pure quint lower than the given note. pureQuintNote :: Double -> Double -- | For the given frequency of the note it generates a Vector of -- the tuples, each one of which contains the harmonics' frequency and -- amplitude. oberTones :: Double -> ObertonesO -- | Returns a Vector of tuples with the lowest and highest -- frequencies for the notes in the sets consisting of n -- consequential notes (including semi-tones). An Int parameter -- defines this n. It can be 2, 3, 4, 6, 9, or 12 (the last one -- is for default octaves, see octavesT). So for different valid -- n you obtain doubles, triples and so on. The function being -- applied returns a Vector of such sets with their respective -- lowest and highest frequencies. nkyT :: Int -> NotePairs -- | Similarly to whichOctave returns a Maybe number -- (actually frequency) for the n-th elements set of notes (see -- nkyT). An Int parameter defines that n. whichEnka :: Int -> Double -> Maybe Int -- | Returns an analogous note in the higher n-th elements set (its -- frequency in Hz) (see nkyT). An Int parameter defines -- this n. enkuUp :: Int -> Double -> Double -- | Returns an analogous note in the lower n-th elements set (its -- frequency in Hz) (see nkyT). An Int parameter defines -- this n. enkuDown :: Int -> Double -> Double -- | Similarly to liftInOctaveV returns a Vector -- Double (actually frequencies) for the n-th elements set of -- notes (see nkyT) instead of octaves. A second Int -- parameter defines that n. liftInEnkuV :: Int -> Int -> Vector Double -> Vector Double -- | Similarly to liftInOctave returns a Maybe number -- (actually frequency) for the n-th elements set of notes (see -- nkyT). A second Int parameter defines that n. liftInEnku :: Int -> Int -> Double -> Maybe Double -- | Returns a Vector of tuples with the lowest and highest -- frequencies for the notes in the octaves. octavesT :: NotePairs -- | Combines (mixes) all "test*" files in the given directory. The files -- should be similar in parameters and must be sound files for SoX to -- work on them properly. Afterwards, the function deletes these combined -- files. mixTest :: IO () -- | Gets Vector of Int frequencies from the given -- FilePath using SoX. The frequencies are "rough" according to -- the SoX documentation and the duration is too small so they can be -- definitely other than expected ones. Is used as a source of variable -- numbers (somewhat close each to another in their order but not -- neccessarily). . freqsFromFile :: FilePath -> Int -> IO (Vector Int) -- | Gets an "end.wav" file from the intermediate "result*.wav" files in -- the current directory. If it is not successful, produces the -- notification message and exits without error. If you would like to -- create the file if there are too many intermediate ones, please, run -- "dobutokO2 8" or "dobutokO2 80" in the current directory. endFromResult :: IO () -- | For the given frequency it generates a musical sound with a timbre. -- The main component of the sound includes the lower pure quint, which -- can be in the same octave or in the one with the number lower by one. -- Please, check before executing whether there is no "x.wav", "test*", -- "result*" and "end.wav" files in the current directory, because they -- can be overwritten. oberSoXSynth :: Double -> IO () -- | Similar to oberSoXSynth2DN but instead of oberTones -- function, it uses volatile function f::Double -> Vector -- (Double, Double) with somewhat sophisticated mechanism to -- normalize the resulting Vector elements (Double, -- Double). The last one is an experimental feature, so it is your -- responsibility to provide a function so that it does not lead to -- clipping. In such a case, the result of application of the -- convertToProperUkrainian to the String parameter must -- not be empty. Int argument is an index of the element to -- be taken from the intervalsFromString applied to the -- String argument. To obtain compatible with versions prior to -- 0.20.0.0 behaviour, use for the Int 0. -- -- Be aware that the result can be rather unpredictable (the program can -- even obtain segmentation fault) for not very suitable function. But -- for a lot of functions this works well. -- -- It is recommended to fully simplify the computation for "f" function -- before using it in the oberSoXSynth2FDN. oberSoXSynth2FDN :: (Double -> ObertonesO) -> (Double, Double) -> Int -> String -> IO () -- | Similar to oberSoXSynth2DN but instead of oberTones -- function, it uses volatile function f::Double -> Vector -- (Double, Double) with somewhat sophisticated mechanism to -- normalize the resulting Vector elements (Double, -- Double). The last one is experimental feature, so it is your -- responsibility to provide a function so that it does not lead to -- clipping. In such a case, the result of application of the -- convertToProperUkrainian to the String parameter must -- not be empty. The function also tries to perform filtering to -- avoid possible beating. The third Double parameter in the tuple -- is used as a limit for frequencies difference in Hz to be filtered out -- from the resulting sound. It is considered to be from the range -- [0.1..10.0]. An Int parameter is used to define the -- needed interval. To obtain compatible with versions prior to 0.20.0.0 -- behaviour, use for the Int 0. -- -- Be aware that the result can be rather unpredictable (the program can -- even obtain segmentation fault) for not very suitable function. But -- for a lot of functions this works well. -- -- It is recommended to fully simplify the computation for "f" function -- before using it in the oberSoXSynth2FDN_B. oberSoXSynth2FDN_B :: (Double -> ObertonesO) -> (Double, Double, Double) -> Int -> String -> IO () -- | Similar to oberSoXSynth2FDN but it does not make any -- normalizing transformations with the Vector argument. To be -- used properly, it is needed that every second element in the tuple in -- the Vector argument must be in the range [-1.0..1.0] and every -- first element must be in between 16.351597831287414 and -- 7902.132820097988 (Hz). An Int parameter is used to define an -- interval. To obtain compatible with versions prior to 0.20.0.0 -- behaviour, use for the Int 0. -- -- Be aware that the result can be rather unpredictable (the program can -- even obtain segmentation fault) for not very suitable function. But -- for a lot of functions this works well. -- -- It is recommended to fully simplify the computation for "f" function -- before using it in the oberSoXSynth2FDN_S. oberSoXSynth2FDN_S :: (Double -> ObertonesO) -> (Double, Double) -> Int -> String -> IO () -- | Similar to oberSoXSynth2FDN_S but additionally the program -- filters out from the resulting Vector after "f" application -- values that are smaller by absolute value than 0.001. An Int -- parameter is used to define an interval. To obtain compatible with -- versions prior to 0.20.0.0 behaviour, use for the Int 0. -- -- Be aware that the result can be rather unpredictable (the program can -- even obtain segmentation fault) for not very suitable function. But -- for a lot of functions this works well. -- -- It is recommended to fully simplify the computation for "f" function -- before using it in the oberSoXSynth2FDN_Sf. oberSoXSynth2FDN_Sf :: (Double -> ObertonesO) -> (Double, Double) -> Int -> String -> IO () -- | Similar to oberSoXSynth2FDN_S but additionally the program -- filters out from the resulting Vector after "f" application -- values that are smaller than the third Double parameter by an -- absolute value in the triple of Double's. An Int -- parameter is used to define an interval. To obtain compatible with -- versions prior to 0.20.0.0 behaviour, use for the Int 0. -- -- Be aware that the result can be rather unpredictable (the program can -- even obtain segmentation fault) for not very suitable function. But -- for a lot of functions this works well. -- -- It is recommended to fully simplify the computation for "f" function -- before using it in the oberSoXSynth2FDN_Sf3. oberSoXSynth2FDN_Sf3 :: (Double -> ObertonesO) -> (Double, Double, Double) -> Int -> String -> IO () -- | Uses additional Int parameters. The first one is a number of -- enka (see nkyT). The second one defines, to which n-th elements -- set (see nkyT) belongs the obtained higher notes in the -- intervals. To obtain reasonable results, please, use for the first one -- 2, 3, 4, 6, 9, or 12. The first String parameter is used to -- produce durations of the notes. The second one is used to define -- intervals. A Double parameter is a basic sound duration, it -- defines tempo of the melody in general. oberSoXSynthGen2FDN :: FilePath -> Int -> Int -> (Double -> ObertonesO) -> Double -> String -> String -> IO () -- | Uses additional Int parameters. The first one is a number of -- enka (see nkyT). The second one defines, to which n-th elements -- set (see nkyT) belongs the obtained higher notes in the -- intervals. To obtain reasonable results, please, use for the first one -- 2, 3, 4, 6, 9, or 12. The first String parameter is used to -- produce durations of the notes. The second one is used to define -- intervals. The first Double parameter is a basic sound -- duration, it defines tempo of the melody in general. The second one is -- a limit for frequencies difference in Hz to be filtered out from the -- resulting sound. It is considered to be from the range -- [0.1..10.0]. oberSoXSynthGen2FDN_B :: FilePath -> Int -> Int -> (Double -> ObertonesO) -> Double -> Double -> String -> String -> IO () -- | Similar to oberSoXSynthGen2FDN, but instead of -- oberSoXSynth2FDN uses oberSoXSynth2FDN_S function. oberSoXSynthGen2FDN_S :: FilePath -> Int -> Int -> (Double -> ObertonesO) -> Double -> String -> String -> IO () -- | Similar to oberSoXSynthGen2FDN_S, but instead of -- oberSoXSynth2FDN_S uses oberSoXSynth2FDN_Sf function. oberSoXSynthGen2FDN_Sf :: FilePath -> Int -> Int -> (Double -> ObertonesO) -> Double -> String -> String -> IO () -- | Similar to oberSoXSynthGen2FDN_S, but instead of -- oberSoXSynth2FDN_S uses oberSoXSynth2FDN_Sf3 function. oberSoXSynthGen2FDN_Sf3 :: FilePath -> Int -> Int -> (Double -> ObertonesO) -> Double -> Double -> String -> String -> IO () -- | Function to get from the number of semi-tones and a note a -- Maybe note for the second lower note in the interval if any. If -- there is no need to obtain such a note, then the result is -- Nothing. dNote :: Int -> Double -> Maybe Double -- | Can generates multiple notes with their respective obertones that are -- played simultaneously (e. g. it can be just one note with obertones, -- an interval with obertones, an accord with obertones etc.). This -- allows to get a rather complex or even comlicated behaviour to obtain -- expressive and rich sound. soundGenF3 :: Vector (Double -> Double) -> Vector Double -> Vector Int -> (Double -> ObertonesO) -> (Double, Double, Double) -> Int -> String -> IO () -- | Similar to oberSoXSynthGen2FDN, but instead of -- oberSoXSynth2FDN uses oberSoXSynth2FDN_S function. oberSoXSynthGen2FDN_SG :: FilePath -> Int -> Int -> (Double -> ObertonesO) -> Double -> String -> String -> ((Double -> ObertonesO) -> (Double, Double) -> Int -> String -> IO ()) -> IO () -- | Similar to oberSoXSynthGen2FDN_S, but instead of -- oberSoXSynth2FDN_S uses oberSoXSynth2FDN_Sf3 function. oberSoXSynthGen2FDN_Sf3G :: FilePath -> Int -> Int -> (Double -> ObertonesO) -> Double -> Double -> String -> String -> ((Double -> ObertonesO) -> (Double, Double, Double) -> Int -> String -> IO ()) -> IO () -- | Creates part of the needed "test*.wav" files in the current directory. partialTest_k :: ObertonesO -> Int -> String -> IO () -- | Additional function to prepend zeroes to the given String. The -- number of them are just that one to fulfill the length to the given -- Int parameter. prependZeroes :: Int -> String -> String nOfZeroesLog :: Int -> Maybe Int -- | Is a minimal number of decimal places that are just enough to -- represent a length of the Vector given. For an empty -- returns 0. numVZeroesPre :: Vector a -> Int -- | Function is used to generate a rhythm of the resulting file 'end.wav' -- from the Ukrainian text and a number of sounds either in the syllables -- or in the words without vowels. syllableStr :: Int -> String -> [Int] -- | Function is used to get numbers of intervals from a Ukrainian -- String. It is used internally in the -- uniqOberSoXSynthN4 function. intervalsFromString :: String -> Vector Int vStrToVInt :: Vector String -> Vector Int strToInt :: String -> Int -- | Generates a Vector of ObertonesO that represents the -- melody. The order of elements of the vector is the order of the -- melody. doubleVecFromVecOfDouble :: (Double -> ObertonesO) -> Double -> Vector (Maybe Double) -> Vector ObertonesO helpF1 :: Vector (Double -> Double) -> Vector Double -> Vector Int -> Vector (Maybe Double) helpF0 :: Int -> String -- | Maintainer : olexandr543@yahoo.com -- -- A program and a library to create experimental music from a mono audio -- and a Ukrainian text. module DobutokO.Sound -- | Function to create a melody for the given arguments. String is -- used to provide a rhythm. The main component of the sound includes the -- lower pure quint, which can be in the same octave or in the one with -- the number lower by one. The first Double argument from the -- range [0.01..1.0] is used as a maximum amplitude for obertones. If it -- is set to 1.0 the obertones amplitudes are just the maximum ones, -- otherwise they are multiplied by the parameter and this results in -- their becoming more silent ones. The second Double argument is -- a basic sound duration. The default one is 0.5 (second). Please, check -- before executing whether there is no "x.wav", "test*", "result*" files -- in the current directory, because they can be overwritten. oberSoXSynthN :: Int -> Double -> Double -> String -> Vector Double -> IO () -- | For the given frequency of the note and a Ukrainian text it generates -- a Vector of the tuples, each one of which contains the -- harmonics' frequency and amplitude. The String is used to -- produce the signs for harmonics coefficients. oberTones2 :: Double -> String -> ObertonesO -- | For the given frequency it generates a musical sound with a timbre. -- The main component of the sound includes the lower pure quint, which -- can be in the same octave or in the one with the number lower by one. -- Please, check before executing whether there is no "x.wav", "test*", -- "result*" files in the current directory, because they can be -- overwritten. The String argument is used to define signs of the -- harmonics coefficients for obertones. oberSoXSynth2 :: Double -> String -> IO () -- | Function to create a melody for the given arguments. String is -- used to provide a rhythm. The main component of the sound includes the -- lower pure quint, which can be in the same octave or in the one with -- the number lower by one. The first Double argument from the -- range [0.01..1.0] is used as a maximum amplitude for obertones. If it -- is set to 1.0 the obertones amplitudes are just the maximum ones, -- otherwise they are multiplied by the parameter and this results in -- their becoming more silent ones. The second Double argument is -- a basic sound duration. The default one is 0.5 (second). Please, check -- before executing whether there is no "x.wav", "test*", "result*" files -- in the current directory, because they can be overwritten. oberSoXSynthN2 :: Int -> Double -> Double -> String -> String -> Vector Double -> IO () -- | Function to create a melody for the given arguments. String is -- used to provide a rhythm. The main component of the sound includes the -- lower pure quint, which can be in the same octave or in the one with -- the number lower by one. The first Double argument from the -- range [0.01..1.0] is used as a maximum amplitude for obertones. If it -- is set to 1.0 the obertones amplitudes are just the maximum ones, -- otherwise they are multiplied by the parameter and this results in -- their becoming more silent ones. The second Double argument is -- a basic sound duration. The default one is 0.5 (second). Please, check -- before executing whether there is no "x.wav", "test*", "result*" files -- in the current directory, because they can be overwritten. The third -- String argument is used to define the intervals for the notes -- if any. The third Double parameter basically is used to define -- in how many times the volume for the second lower note is less than -- the volume of the main note. If it is rather great, it can signal that -- the volume for the second note obertones are greater than for the main -- note obetones. The last one is experimental feature. oberSoXSynthN3 :: Int -> Double -> Double -> Double -> String -> String -> String -> Vector Double -> IO () -- | Similar to oberSoXSynth except that takes not necessarily pure -- lower quint note as the second one, but the one specified by the -- String parameter as an argument to dNote. If you begin -- the String with space characters, or "сь", or "ць", or dash, or -- apostrophe, or soft sign, than there will be no interval and the sound -- will be solely one with its obertones. oberSoXSynthDN :: Double -> String -> IO () -- | Similar to oberSoXSynthDN except that the resulting duration is -- specified by the second Double parameter in seconds. For -- oberSoXSynthDN it is equal to 0.5. oberSoXSynth2DN :: Double -> Double -> String -> IO () -- | Similar to oberSoXSynthN, but uses a sound file to obtain the -- information analogous to Vector in the latter one. Besides, the -- function lifts the frequencies to the octave with the given by -- Int parameter number (better to use from the range [1..8]). The -- first Double argument from the range [0.01..1.0] is used as a -- maximum amplitude for obertones. If it is set to 1.0 the obertones -- amplitudes are just maximum ones, otherwise they are multiplied by the -- parameter and this results in their becoming more silent ones. The -- second Double argument is a basic sound duration. The default -- one is 0.5 (second). Please, check before executing whether there is -- no "x.wav", "test*", "result*" and "end.wav" files in the current -- directory, because they can be overwritten. -- -- For better usage the FilePath should be a filepath for the .wav -- file. oberSoXSynthNGen :: FilePath -> Int -> Double -> Double -> String -> IO () -- | Similar to oberSoXSynthN2, but uses a sound file to obtain the -- information analogous to Vector in the latter one. Besides, the -- function lifts the frequencies to the octave with the given by -- Int parameter number (better to use from the range [1..8]). The -- first Double argument from the range [0.01..1.0] is used as a -- maximum amplitude for obertones. If it is set to 1.0 the obertones -- amplitudes are just maximum ones, otherwise they are multiplied by the -- parameter and this results in their becoming more silent ones. The -- second Double argument is a basic sound duration. The default -- one is 0.5 (second). Please, check before executing whether there is -- no "x.wav", "test*", "result*" and "end.wav" files in the current -- directory, because they can be overwritten. -- -- For better usage the FilePath should be a filepath for the .wav -- file. The second String argument is used to define signs of the -- harmonics coefficients in the generated sounds. oberSoXSynthNGen2 :: FilePath -> Int -> Double -> Double -> String -> String -> IO () -- | Similar to oberSoXSynthN2, but uses a sound file to obtain the -- information analogous to Vector in the latter one. Besides, the -- function lifts the frequencies to the octave with the given by -- Int parameter number (better to use from the range [1..8]). The -- first Double argument from the range [0.01..1.0] is used as a -- maximum amplitude for obertones. If it is set to 1.0 the obertones -- amplitudes are just maximum ones, otherwise they are multiplied by the -- parameter and this results in their becoming more silent ones. The -- second Double argument is a basic sound duration. The default -- one is 0.5 (second). Please, check before executing whether there is -- no "x.wav", "test*", "result*" and "end.wav" files in the current -- directory, because they can be overwritten. -- -- For better usage the FilePath should be a filepath for the .wav -- file. The second String argument is used to define signs of the -- harmonics coefficients in the generated sounds. The third -- String argument is used to define the intervals for the notes -- if any. The third Double parameter basically is used to define -- in how many times the volume for the second lower note is less than -- the volume of the main note. If it is rather great, it can signal that -- the volume for the second note obertones are greater than for the main -- note obetones. The last one is experimental feature. oberSoXSynthNGen3 :: FilePath -> Int -> Double -> Double -> Double -> String -> String -> String -> IO () -- | For the given frequency of the note it generates a Vector of -- the tuples, each one of which contains the harmonics' frequency and -- amplitude. For every given String structure of the uniqueness -- (see the documentation for mmsyn7s package and its -- Syllable module) it produces the unique timbre. uniqOberTonesV :: Double -> String -> ObertonesO -- | For the given frequency and a Ukrainian text it generates a musical -- sound with the timbre obtained from the Ukrainian text (see the -- documentation for mmsyn7s package). The timbre for another -- given text usually differs, but can be the same. The last one is only -- if the uniqueness structure and length are the same for both -- String. Otherwise, they differs. This gives an opportunity to -- practically and quickly synthesize differently sounding intervals. The -- main component of the sound includes the lower pure quint, which can -- be in the same octave or in the one with the number lower by one. -- Please, check before executing whether there is no "x.wav", "test*", -- "result*" files in the current directory, because they can be -- overwritten. uniqOberSoXSynth :: Double -> String -> IO () -- | Function to create a melody for the given arguments. The first -- String is used to provide a rhythm. The second one -- to -- provide a timbre. The timbre for another given text usually differs, -- but can be the same. This gives an opportunity to practically and -- quickly synthesize differently sounding intervals. The first -- Double argument from the range [0.01..1.0] is used as a maximum -- amplitude for obertones. If it is set to 1.0 the obertones amplitudes -- are just maximum ones, otherwise they are multiplied by the parameter -- and this results in their becoming more silent ones. The main -- component of the sound is in the given octave with a number given by -- Int parameter. Besides, another main component of the sound -- includes the lower pure quint, which can be in the same octave or in -- the one with the number lower by one. The second Double -- argument is a basic sound duration. The default one is 0.5 (second). -- Please, check before executing whether there is no "x.wav", "test*", -- "result*" files in the current directory, because they can be -- overwritten. uniqOberSoXSynthN :: Int -> Double -> Double -> String -> String -> Vector Double -> IO () -- | For the given frequency of the note it generates a Vector of -- the tuples, each one of which contains the harmonics' frequency and -- amplitude. For every given first String argument structure of -- the uniqueness (see the documentation for mmsyn7s package and -- its Syllable module) it produces the unique timbre. The second -- String is used to produce the signs for harmonics coefficients. uniqOberTonesV2 :: Double -> String -> String -> ObertonesO -- | For the given frequency and a Ukrainian text it generates a musical -- sound with the timbre obtained from the Ukrainian text (see the -- documentation for mmsyn7s package). The timbre for another -- given text usually differs, but can be the same. The last one is only -- if the uniqueness structure and length are the same for both -- String. Otherwise, they differs. This gives an opportunity to -- practically and quickly synthesize differently sounding intervals. The -- main component of the sound includes the lower pure quint, which can -- be in the same octave or in the one with the number lower by one. -- Please, check before executing whether there is no "x.wav", "test*", -- "result*" files in the current directory, because they can be -- overwritten. The second String argument is used to define signs -- for the harmonics coefficients for obertones. uniqOberSoXSynth2 :: Double -> String -> String -> IO () -- | Function to create a melody for the given arguments. The first -- String is used to provide a rhythm. The second one -- to -- provide a timbre. The timbre for another given text usually differs, -- but can be the same. This gives an opportunity to practically and -- quickly synthesize differently sounding intervals. The first -- Double argument from the range [0.01..1.0] is used as a maximum -- amplitude for obertones. If it is set to 1.0 the obertones amplitudes -- are just maximum ones, otherwise they are multiplied by the parameter -- and this results in their becoming more silent ones. The main -- component of the sound is in the given octave with a number given by -- Int parameter. Besides, another main component of the sound -- includes the lower pure quint, which can be in the same octave or in -- the one with the number lower by one. The second Double -- argument is a basic sound duration. The default one is 0.5 (second). -- Please, check before executing whether there is no "x.wav", "test*", -- "result*" files in the current directory, because they can be -- overwritten. The third String argument is used to define signs -- of the harmonics coefficients in the generated sounds. uniqOberSoXSynthN3 :: Int -> Double -> Double -> String -> String -> String -> Vector Double -> IO () -- | Function to create a melody for the given arguments. The first -- String is used to provide a rhythm. The second one -- to -- provide a timbre. The timbre for another given text usually differs, -- but can be the same. This gives an opportunity to practically and -- quickly synthesize differently sounding intervals. The first -- Double argument from the range [0.01..1.0] is used as a maximum -- amplitude for obertones. If it is set to 1.0 the obertones amplitudes -- are just maximum ones, otherwise they are multiplied by the parameter -- and this results in their becoming more silent ones. The main -- component of the sound is in the given octave with a number given by -- Int parameter. Besides, another main component of the sound -- includes the lower pure quint, which can be in the same octave or in -- the one with the number lower by one. The second Double -- argument is a basic sound duration. The default one is 0.5 (second). -- Please, check before executing whether there is no "x.wav", "test*", -- "result*" files in the current directory, because they can be -- overwritten. The third String argument is used to define signs -- of the harmonics coefficients in the generated sounds. The fourth -- String argument is used to define the intervals for the notes -- if any. The third Double parameter basically is used to define -- in how many times the volume for the second lower note is less than -- the volume of the main note. If it is rather great, it can signal that -- the volume for the second note obertones are greater than for the main -- note obetones. The last one is experimental feature. uniqOberSoXSynthN4 :: Int -> Double -> Double -> Double -> String -> String -> String -> String -> Vector Double -> IO () -- | Similar to uniqOberSoXSynthN, but uses a sound file to obtain -- the information analogous to Vector in the latter one. Besides, -- the function lifts the frequencies to the octave with the given by -- Int parameter number (better to use from the range [1..8]). The -- first Double argument from the range [0.01..1.0] is used as a -- maximum amplitude for obertones. If it is set to 1.0 the obertones -- amplitudes are just the maximum ones, otherwise they are multiplied by -- the parameter and this results in their becoming more silent ones. The -- second Double argument is a basic sound duration. The default -- one is 0.5 (second). Please, check before executing whether there is -- no "x.wav", "test*", "result*" and "end.wav" files in the current -- directory, because they can be overwritten. -- -- For better usage the FilePath should be a filepath for the .wav -- file. uniqOberSoXSynthNGen :: FilePath -> Int -> Double -> Double -> String -> String -> IO () -- | Similar to uniqOberSoXSynthN, but uses a sound file to obtain -- the information analogous to Vector in the latter one. Besides, -- the function lifts the frequencies to the octave with the given by -- Int parameter number (better to use from the range [1..8]). The -- first Double argument from the range [0.01..1.0] is used as a -- maximum amplitude for obertones. If it is set to 1.0 the obertones -- amplitudes are just the maximum ones, otherwise they are multiplied by -- the parameter and this results in their becoming more silent ones. The -- second Double argument is a basic sound duration. The default -- one is 0.5 (second). Please, check before executing whether there is -- no "x.wav", "test*", "result*" and "end.wav" files in the current -- directory, because they can be overwritten. -- -- For better usage the FilePath should be a filepath for the .wav -- file. The third String argument is used to define signs of the -- harmonics coefficients in the generated sounds. uniqOberSoXSynthNGen3 :: FilePath -> Int -> Double -> Double -> String -> String -> String -> IO () -- | Similar to uniqOberSoXSynthN, but uses a sound file to obtain -- the information analogous to Vector in the latter one. Besides, -- the function lifts the frequencies to the octave with the given by -- Int parameter number (better to use from the range [1..8]). The -- first Double argument from the range [0.01..1.0] is used as a -- maximum amplitude for obertones. If it is set to 1.0 the obertones -- amplitudes are just the maximum ones, otherwise they are multiplied by -- the parameter and this results in their becoming more silent ones. The -- second Double argument is a basic sound duration. The default -- one is 0.5 (second). Please, check before executing whether there is -- no "x.wav", "test*", "result*" and "end.wav" files in the current -- directory, because they can be overwritten. -- -- For better usage the FilePath should be a filepath for the .wav -- file. The third String argument is used to define signs of the -- harmonics coefficients in the generated sounds. The fourth -- String argument is used to define the intervals for the notes -- if any. The third Double parameter basically is used to define -- in how many times the volume for the second lower note is less than -- the volume of the main note. If it is rather great, it can signal that -- the volume for the second note obertones are greater than for the main -- note obetones. The last one is an experimental feature. uniqOberSoXSynthNGen4 :: FilePath -> Int -> Double -> Double -> Double -> String -> String -> String -> String -> IO () -- | Returns an analogous note in the higher octave (its frequency in Hz). octaveUp :: Double -> Double -- | Returns an analogous note in the lower octave (its frequency in Hz). octaveDown :: Double -> Double -- | Function can be used to determine to which octave (in the American -- notation for the notes, this is a number in the note written form, e. -- g. for C4 this is 4) the frequency belongs (to be more exact, the -- closest note for the given frequency -- see closestNote taking -- into account its lower pure quint, which can lay in the lower by 1 -- octave). If it is not practical to determine the number, then the -- function returns Nothing. whichOctave :: Double -> Maybe Int -- | Function lifts the given frequency to the given number of the octave -- (in American notation, from 0 to 8). This number is an Int -- parameter. The function also takes into account the lower pure quint -- for the closest note. If it is not practical to determine the number, -- then the function returns Nothing. liftInOctave :: Int -> Double -> Maybe Double -- | Function lifts the Vector of Double representing -- frequencies to the given octave with the Int number. Better to -- use numbers in the range [1..8]. The function also takes into account -- the lower pure quint for the obtained note behaviour. If it is not -- practical to determine the octave, the resulting frequency is omitted -- from the resulting Vector. liftInOctaveV :: Int -> Vector Double -> Vector Double dviykyTA :: NotePairs triykyTA :: NotePairs chetvirkyTA :: NotePairs p'yatirkyTA :: NotePairs shistkyTA :: NotePairs simkyTA :: NotePairs visimkyTA :: NotePairs dev'yatkyTA :: NotePairs desyatkyTA :: NotePairs odynadtsyatkyTA :: NotePairs octavesTA :: NotePairs -- | Similar to oberSoXSynthNGen, but uses additional second -- Int parameter. It defines, to which n-th elements set (see -- nkyT) belongs the obtained higher notes in the intervals. If -- that parameter equals to 12, then the function is practically -- equivalent to oberSoXSynthNGen. To obtain its modifications, -- please, use 2, 3, 4, 6, or 9. oberSoXSynthNGenE :: FilePath -> Int -> Int -> Double -> Double -> String -> IO () -- | Similar to oberSoXSynthNGen2, but uses additional second -- Int parameter. It defines, to which n-th elements set (see -- nkyT) belongs the obtained higher notes in the intervals. If -- that parameter equals to 12, then the function is practically -- equivalent to oberSoXSynthNGen2. To obtain its modifications, -- please, use 2, 3, 4, 6, or 9. oberSoXSynthNGen2E :: FilePath -> Int -> Int -> Double -> Double -> String -> String -> IO () -- | Similar to oberSoXSynthNGen3, but uses additional second -- Int parameter. It defines, to which n-th elements set (see -- nkyT) belongs the obtained higher notes in the intervals. If -- that parameter equals to 12, then the function is practically -- equivalent to oberSoXSynthNGen3. To obtain its modifications, -- please, use 2, 3, 4, 6, or 9. oberSoXSynthNGen3E :: FilePath -> Int -> Int -> Double -> Double -> Double -> String -> String -> String -> IO () -- | Similar to uniqOberSoXSynthNGen, but uses additional second -- Int parameter. It defines, to which n-th elements set (see -- nkyT) belongs the obtained higher notes in the intervals. If -- that parameter equals to 12, then the function is practically -- equivalent to uniqOberSoXSynthNGen. To obtain its -- modifications, please, use 2, 3, 4, 6, or 9. uniqOberSoXSynthNGenE :: FilePath -> Int -> Int -> Double -> Double -> String -> String -> IO () -- | Similar to uniqOberSoXSynthNGen3, but uses additional second -- Int parameter. It defines, to which n-th elements set (see -- nkyT) belongs the obtained higher notes in the intervals. If -- that parameter equals to 12, then the function is practically -- equivalent to uniqOberSoXSynthNGen3. To obtain its -- modifications, please, use 2, 3, 4, 6, or 9. uniqOberSoXSynthNGen3E :: FilePath -> Int -> Int -> Double -> Double -> String -> String -> String -> IO () -- | Similar to uniqOberSoXSynthNGen4, but uses additional second -- Int parameter. It defines, to which n-th elements set (see -- nkyT) belongs the obtained higher notes in the intervals. If -- that parameter equals to 12, then the function is practically -- equivalent to uniqOberSoXSynthNGen4. To obtain its -- modifications, please, use 2, 3, 4, 6, or 9. uniqOberSoXSynthNGen4E :: FilePath -> Int -> Int -> Double -> Double -> Double -> String -> String -> String -> String -> IO () -- | Additional function to produce signs from the given String of -- the Ukrainian text. Ukrainian vowels and voiced consonants gives "+" -- sign (+1), voiceless and sonorous consonants gives "-" sign (-1). -- Voiceless2 gives "0". Other symbols are not taken into account. signsFromString :: Int -> String -> Vector Int -- | Maintainer : olexandr543@yahoo.com -- -- A program and a library to create experimental music from a mono audio -- and a Ukrainian text. module DobutokO.Sound.ParseList parseTup :: String -> [String] parseTupV :: String -> Vector String containsExt :: [String] -> Bool containsExtV :: Vector String -> Bool -- | Predicate to check whether a Vector does not contain round -- parentheses or dash (a minus sign) as its elements. Is used internally -- in the parseStoLInts function to avoid lists with negative -- elements. canBePreParseV :: Vector String -> Bool -- | Notification. Uses an Int limitation to avoid infinite lists. -- All arguments must be not negative. parseV :: Int -> Vector String -> Maybe [Int] -- | From the 0.19.0.0 version. Can be used to parse also into infinite -- lists. parseVInf :: Vector String -> Maybe [Int] -- | Parses a String being a list of Ints written with Haskell -- rules, e. g. "[1..]", "[2,4..45]", "[3,5,6,7,8,3]" etc. into a list of -- Int. If it is not possible or list is empty, returns []. -- Preceding whitespaces are ignored. An Int argument is used as a -- delimiter to avoid infinite lists. parseStoLInts :: Int -> String -> [Int] -- | Maintainer : olexandr543@yahoo.com -- -- A program and a library to create experimental music from a mono audio -- and a Ukrainian text. module DobutokO.Sound.IntermediateF -- | Gets sizes of the "result*.wav" files in the current directory. getFileRSizes :: IO (Vector Integer) -- | Similar to getFileRSizes, but sizes are Int, not -- Integer. For most cases it is more memory efficient. getFileRSizesS :: IO (Vector Int) -- | Variant of getFileRSizes function. getFileRSizesS2 :: IO (Vector Int) -- | Gets Vector of tuples of the pairs of "result*.wav" files and -- their respective sizes. getFileRTuples :: IO (Vector (FilePath, Integer)) -- | Gets Vector of the filenames for "result*.wav" files in the -- current directory. listVDirectory :: IO (Vector FilePath) -- | Function-predicate to check whether a file corresponding to its -- String argument is considered as one of higher quality and -- therefore can be used to replace the not so suitable ones while -- processing. isHighQ :: String -> Bool -- | Function-predicate to check whether a file corresponding to its -- String argument is needed to be replaced while processing. shouldBeReplaced :: String -> Bool -- | Gets an index of the Vector element corresponding to the -- String generated by playAndMark function. indexesFromMrk :: String -> Int -- | During function evaluation you can listen to the sound files and mark -- them with "1" and "0". The first one means that the sound is -- considered of higher quality and is intended to be used as a -- replacement for the worse sounds markd by "0". The function returns a -- Vector of specially formatted String that represents -- only those files that are connected with the replacement procedure. playAndMark :: Vector FilePath -> IO (Vector String) -- | Function playAndMark applied to all the "result*.wav" files in -- the current directory. playAMrk :: IO (Vector String) -- | Process the sound corresponding to the first element in the first -- argument. Returns a tail of the first element of the first -- command line argument. Replaces (if specified) the sound with a -- sequence of (or just one, or made no replacement at all) sounds -- considered of higher quality. pAnR1 :: Vector String -> IO (Vector String) -- | Process the sounds consequently corresponding to the elements in the -- first argument. Replaces (if specified) the sounds with a sequence of -- (or just one, or made no replacement at all) sounds considered of -- higher quality for every sound needed. pAnR2 :: Vector String -> IO () -- | Marks the needed files as of needed to be replaced or those ones -- considered of higher quality that will replace the needed ones. Then -- actually replaces them as specified. Uses internally playAMrk -- and pAnR2 functions. pAnR_ :: IO () -- | Parser to the result of listVDirectory function to get the -- needed information. infoFromV :: Vector String -> [(Vector Int, Vector String)] -- | Used to obtain parameters for processment. internalConv :: ([String], [String]) -> (Vector Int, Vector String) -- | Axiliary function to get a String of consequent digits in the -- name of the "result*.wav" file. ixFromRes :: String -> String -- | Given an index of the element in the listVDirectory output -- returns a tuple of the boundaries of the indexes usable for playback. -- Note: index0 is probably from [0..], l1 is necessarily from [0..]. -- Interesting case is: 0 <= index0 < l1. ixInterv :: Int -> IO (Int, Int) -- | IO checkbox whether to add the sound played to the sequence of -- sounds that will replace the needed one. thisOne :: IO Bool -- | Plays a sequence of sounds in the interval of them obtained by -- ixInterv function. playSeqAR :: Int -> IO () -- | Plays a sequence of consequential sounds in the melody in the interval -- of them obtained by ixInterv function for each element index -- from Vector of indexes. playSeqARV :: Vector Int -> IO () -- | Plays a sequence of sounds considered of higher quality. playSeqARV2 :: Vector String -> IO () -- | Plays a sound file considered to be of higher quality and then you -- define whether to use the played sound to replace that one considered -- to be replaced. playCollect1Dec :: Vector String -> Int -> IO Bool -- | The same as playSeqARV2, but additionally collects the -- resulting Bool values and then returns them. It is used to -- define, which sounds from those of higher quality will replace those -- ones considered to be replaced. playCollectDec :: Vector String -> IO (Vector Bool) -- | Actually replaces the file represented by FilePath argument -- with no (then there is no replacement at all), or with just one, or -- with a sequence of sounds being considered of higher quality to form a -- new melody. If the lengths of the second and the third arguments -- differs from each other then the function uses as these arguments -- truncated vectors of the minimal of the two lengths. replaceWithHQs :: FilePath -> Vector Bool -> Vector FilePath -> IO () -- | A predicate to decide whether an element a belongs to the odd -- number of the lists of a in the Vector. isOddAsElem :: Eq a => a -> Vector [a] -> Bool -- | All [a] must be finite. To obtain Just a0 as a -- result, at least one of the [a] must be not empty and -- Vector must have finite length. If Vector is -- empty or all [a] are null (the vector has finite -- length), then the result is Nothing. Otherwise, it will run -- infinitely just until it runs over the available memory. maxLinV :: Ord a => Vector [a] -> Maybe a -- | All [a] must be finite. To obtain Just a0 as a -- result, at least one of the [a] must be not empty and -- Vector must have finite length. If Vector is -- empty or all [a] are null (the vector has finite -- length), then the result is Nothing. Otherwise, it will run -- infinitely just until it runs over the available memory. minLinV :: Ord a => Vector [a] -> Maybe a -- | Applied to list of [a] where a is an instance for Ord -- class gives a sorted in the ascending order Vector of -- a, each of them being unique. doubleLtoV :: Ord a => [[a]] -> Vector a -- | Filters Int elements in a list so that they are limited with -- the first two Int arguments of the function as a lower and a -- higher bounds. filterToBnds :: Int -> Int -> [Int] -> [Int] -- | Takes a filename to be applied a SoX "reverb" effect with parameters -- of list of String (the second argument). Produces the temporary -- new file with the name ((name-of-the-file) ++ "reverb.wav"), which -- then is removed. Please, remember that for the mono audio the after -- applied function file is stereo with 2 channels. -- -- Besides, you can specify other SoX effects after reverberation in a -- list of String. The syntaxis is that every separate literal -- must be a new element in the list. If you plan to create again mono -- audio in the end of processment, then probably use reverb1E -- funcion instead. If you would like to use instead of "reverb" its -- modification "reverb -w" effect (refer to SoX documentation), then -- probably it is more convenient to use reverbWE function. -- Please, check by yourself whether you have enough permissions to read -- and write to the FilePath-specified file and to the containing -- it directory. The function is not intended to be used in otherwise -- cases. reverbE :: FilePath -> [String] -> IO () -- | The same as reverbE, but uses "reverb -w" effect instead of -- "reverb". The name of the temporary file is ((name-of-the-file) ++ -- "reverbW.wav"). Please, for more information, refer to SoX -- documentation. Please, check by yourself whether you have enough -- permissions to read and write to the FilePath-specified file -- and to the containing it directory. The function is not intended to be -- used in otherwise cases. reverbWE :: FilePath -> [String] -> IO () -- | The same as reverbE, but at the end file is being mixed to -- obtain mono audio. The name of the temporary file is -- ((name-of-the-file) ++ "reverb1.wav"). Please, check by yourself -- whether you have enough permissions to read and write to the -- FilePath-specified file and to the containing it directory. The -- function is not intended to be used in otherwise cases. reverb1E :: FilePath -> [String] -> IO () -- | The same as reverbWE, but at the end file is being mixed to -- obtain mono audio. The name of the temporary file is -- ((name-of-the-file) ++ "reverbW1.wav"). Please, check by yourself -- whether you have enough permissions to read and write to the -- FilePath-specified file and to the containing it directory. The -- function is not intended to be used in otherwise cases. reverbW1E :: FilePath -> [String] -> IO () -- | Takes a filename to be applied a SoX chain of effects (or just one) as -- list of String (the second argument). Produces the temporary -- new file with the name ((name-of-the-file) ++ "effects.wav"), which -- then is removed. -- -- The syntaxis is that every separate literal for SoX must be a new -- element in the list. If you plan to create again mono audio in the end -- of processment, then probably use soxE1 function instead. -- Please, for more information, refer to SoX documentation. Please, -- check by yourself whether you have enough permissions to read and -- write to the FilePath-specified file and to the containing it -- directory. The function is not intended to be used in otherwise cases. soxE :: FilePath -> [String] -> IO () -- | The same as soxE, but at the end file is being mixed to obtain -- mono audio. Please, check by yourself whether you have enough -- permissions to read and write to the FilePath-specified file -- and to the containing it directory. The function is not intended to be -- used in otherwise cases. soxE1 :: FilePath -> [String] -> IO () -- | Function takes a FilePath for the new recorded file (if it -- already exists then it is overwritten) and a list of String. -- The last one is sent to SoX rec or something equivalent as its -- arguments after the filename. If you plan just afterwards to produce -- mono audio, it's simpler to use rec1E function instead. Please, -- check by yourself whether you have enough permissions to read and -- write to the FilePath-specified file and to the containing it -- directory. The function is not intended to be used in otherwise cases. -- Function is adopted and changed recA function. recE :: FilePath -> [String] -> IO () -- | Function takes a FilePath for the new recorded file (if it -- already exists then it is overwritten) and a list of String. -- The last one is sent to SoX rec or something equivalent as its -- arguments after the filename. Please, check by yourself whether you -- have enough permissions to read and write to the -- FilePath-specified file and to the containing it directory. The -- function is not intended to be used in otherwise cases. Function is -- adopted and changed recA function. rec1E :: FilePath -> [String] -> IO () -- | Plays a FilePath file with a SoX further effects specified by -- the list of String. It can be e. g. used to (safely) test the -- result of applying some SoX effects and only then to use soxE -- or some similar functions to actually apply them. Please, check by -- yourself whether you have enough permissions to read the -- FilePath-specified file and the containing it directory. The -- function is not intended to be used in otherwise cases. Function is -- adopted and changed playA function. playE :: FilePath -> [String] -> IO () -- | Maintainer : olexandr543@yahoo.com -- -- A program and a library to create experimental music from a mono audio -- and a Ukrainian text. module DobutokO.Sound.Executable -- | Function that actually makes processing in the dobutokO2 -- executable. Please, check before executing whether there is no -- "x.wav", "test*", "result*" and "end.wav" files in the current -- directory, because they can be overwritten. dobutokO2 :: IO () -- | Function records and processes the sound data needed to generate the -- "end.wav" file in the dobutokO2 function. Please, check before -- executing whether there is no "x.wav" file in the current directory, -- because it can be overwritten. recAndProcess :: FilePath -> Int -> IO String -- | Used to obtain one multiline specially formatted textual input and do -- the full processment for the sound. The function generates obertones -- using additional String and allows maximum control over the -- parameters. Besides, all the needed information it obtains from the -- singular formatted input, which can be ended with a keyboard keys -- combination that means an end of input (e. g. for Unices, that is -- probably Ctrl + D). '@' are separators for the input parts for their -- respective parts. For more information about the format of the single -- input, see: -- -- 'https://drive.google.com/open?id=10Z_GRZR4TKoL5KXfqPm-t-4humuHN0O4' -- -- The file is also provided with the package as text.dat.txt. The last -- two or three inputs (an input just here means a textual input between -- two '@') can be omitted, the program will work also but with less -- control for the user possible. dobutokO2H7 :: Bool -> String -> FilePath -> IO () -- | Actually works as pAnR_ function. dobutokO2H9 :: Bool -> String -> FilePath -> IO () -- | Maintainer : olexandr543@yahoo.com -- -- A program and a library to create experimental music from a mono audio -- and a Ukrainian text. module Main main :: IO ()