dobutokO2-0.22.1.0: A program and a library to create experimental music from a mono audio and a Ukrainian text

Copyright(c) OleksandrZhabenko 2020
LicenseMIT
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

DobutokO.Sound.IntermediateF

Contents

Description

Maintainer : olexandr543@yahoo.com

A program and a library to create experimental music from a mono audio and a Ukrainian text.

Synopsis

Basic functions to work with intermediate files "result*wav"

getFileRSizes :: IO (Vector Integer) Source #

Gets sizes of the "result*.wav" files in the current directory.

getFileRSizesS :: IO (Vector Int) Source #

Similar to getFileRSizes, but sizes are Int, not Integer. For most cases it is more memory efficient.

getFileRSizesS2 :: IO (Vector Int) Source #

Variant of getFileRSizes function.

getFileRTuples :: IO (Vector (FilePath, Integer)) Source #

Gets Vector of tuples of the pairs of "result*.wav" files and their respective sizes.

listVDirectory :: IO (Vector FilePath) Source #

Gets Vector of the filenames for "result*.wav" files in the current directory.

isHighQ :: String -> Bool Source #

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.

shouldBeReplaced :: String -> Bool Source #

Function-predicate to check whether a file corresponding to its String argument is needed to be replaced while processing.

indexesFromMrk :: String -> Int Source #

Gets an index of the Vector element corresponding to the String generated by playAndMark function.

Functions to edit the melody by editing the intermediate files "result*wav"

playAndMark :: Vector FilePath -> IO (Vector String) Source #

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.

playAMrk :: IO (Vector String) Source #

Function playAndMark applied to all the "result*.wav" files in the current directory.

pAnR1 :: Vector String -> IO (Vector String) Source #

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.

pAnR2 :: Vector String -> IO () Source #

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.

pAnR_ :: IO () Source #

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.

Additional functions

Get information

infoFromV :: Vector String -> [(Vector Int, Vector String)] Source #

Parser to the result of listVDirectory function to get the needed information.

internalConv :: ([String], [String]) -> (Vector Int, Vector String) Source #

Used to obtain parameters for processment.

ixFromRes :: String -> String Source #

Axiliary function to get a String of consequent digits in the name of the "result*.wav" file.

ixInterv :: Int -> IO (Int, Int) Source #

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.

thisOne :: IO Bool Source #

IO checkbox whether to add the sound played to the sequence of sounds that will replace the needed one.

Process and Edit

playSeqAR :: Int -> IO () Source #

Plays a sequence of sounds in the interval of them obtained by ixInterv function.

playSeqARV :: Vector Int -> IO () Source #

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.

playSeqARV2 :: Vector String -> IO () Source #

Plays a sequence of sounds considered of higher quality.

playCollect1Dec :: Vector String -> Int -> IO Bool Source #

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.

playCollectDec :: Vector String -> IO (Vector Bool) Source #

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.

replaceWithHQs :: FilePath -> Vector Bool -> Vector FilePath -> IO () Source #

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.

isOddAsElem :: Eq a => a -> Vector [a] -> Bool Source #

A predicate to decide whether an element a belongs to the odd number of the lists of a in the Vector.

maxLinV :: Ord a => Vector [a] -> Maybe a Source #

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 Source #

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.

doubleLtoV :: Ord a => [[a]] -> Vector a Source #

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.

filterToBnds :: Int -> Int -> [Int] -> [Int] Source #

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.

SoX effects application

With "reverb" as the first

reverbE :: FilePath -> [String] -> IO () Source #

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.

reverbWE :: FilePath -> [String] -> IO () Source #

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.

reverb1E :: FilePath -> [String] -> IO () Source #

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.

reverbW1E :: FilePath -> [String] -> IO () Source #

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.

Generalized

soxE :: FilePath -> [String] -> IO () Source #

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.

soxE1 :: FilePath -> [String] -> IO () Source #

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.

Playing and recording

recE :: FilePath -> [String] -> IO () Source #

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.

rec1E :: FilePath -> [String] -> IO () Source #

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.

playE :: FilePath -> [String] -> IO () Source #

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.