word-note-sox-0.1.0.0: SoX for algorithmic composition with groups of notes liken to words
Copyright(c) Oleksandr Zhabenko 2019-2024
LicenseMIT
Maintaineroleksandr.zhabenko@yahoo.com
Safe HaskellNone
LanguageHaskell2010

Composition.Sound.SoX

Description

Some functionality that is primarily implemented using String and Process in the algorithmic-composition-basic and related packages. Is rewritten and groupped to be probably more suitable for concurrent and asynchronous usage.

Synopsis

Documentation

soxE :: FilePath -> SoXEffects -> IO () Source #

Takes a filename to be applied a SoX chain of effects as list of String (the second argument). Produces the temporary new file with the name ((name-of-the-file) ++ ("effects.wav" OR "effects.flac") -- the type is preserved), which then is removed.

The syntaxis is that every separate literal for SoX must be a new element in the list. Please, for more information, refer to SoX documentation. Please, check by yourself whether you have enough permissions to work with the corresponding FilePaths.

fadeEnds :: FilePath -> IO () Source #

Applies "fade q" effect to both ends of the supported by SoX sound file FilePath so that concatenating them consequently after such application leads to no clipping. Otherwise, the clipping exists if not prevented by may be some other means. For more information, please, refer to the SoX documentation.

fadeEndsMilN :: Int -> FilePath -> IO () Source #

Applies "fade q" effect to both ends of the supported by SoX sound file FilePath so that concatenating them consequently after such application leads to no clipping. Otherwise, the clipping exists if not prevented by may be some other means. The duration of the changes are usually smaller than for fadeEnds function and is equal to 0.001 * n sec (where n is in range [1..10]). For more information, please, refer to the SoX documentation.

fadeEndsTMN :: Char -> Float -> Float -> FilePath -> IO () Source #

Applies "fade" effect (the type is specified by the Char argument, for more information, please, refer to the SoX documentation) to the both ends of the sound with header (supported by SoX). The Float arguments specify the percentages of the length of the sound that is faded-in and faded-out respectively. Otherwise, the function returns an error.

fadeEndsTMB :: Char -> Float -> FilePath -> IO () Source #

Variant of the fadeEndsTMN with the both equal percentages specified by the Float argument. It must be in the range (0..50]. Otherwise, the function returns error.

getMaxAG :: ULencode -> FilePath -> (Int, Int) -> IO ByteString Source #

Function getMaxAG returns a maximum amplitude of the sound in the file in the given lower and upper bounds represented as a tuple of Int values.

getMinAG :: ULencode -> FilePath -> (Int, Int) -> IO ByteString Source #

Function getMinAG returns a minimum amplitude of the sound in the file in the given lower and upper bounds represented as a tuple of Int values.

selMaxAbsG :: ULencode -> FilePath -> (Int, Int) -> IO (ByteString, Bool) Source #

Function selMaxAbsG returns a maximum by absolute value amplitude of the sound and allows by its second value in the tuple determine whether it is a maximum or minimum. Bool True corresponds to maximum value, False - to minimum value.

data ULencode Source #

Constructors

W 
UL1 
UL0 
UL 

Instances

Instances details
Show ULencode Source # 
Instance details

Defined in Composition.Sound.SoX

Eq ULencode Source # 
Instance details

Defined in Composition.Sound.SoX

Ord ULencode Source # 
Instance details

Defined in Composition.Sound.SoX

SoundFileExts ULencode Source # 
Instance details

Defined in Composition.Sound.SoX

class SoundFileExts a where Source #

Minimal complete definition

getExts

Instances

Instances details
SoundFileExts ULencode Source # 
Instance details

Defined in Composition.Sound.SoX

soxOpG1 :: ULencode -> [String] -> FilePath -> [String] -> [String] -> IO (ExitCode, ByteString, ByteString) Source #

The variant of the soxOpG that is used if the second file is not used (or in the situation where some other file is used, too, e. g. with the .prof extension). For the functions in the module, this corresponds to the "-n" second file argument.

durationAG :: ULencode -> FilePath -> IO Float Source #

Function durationAG returns a duration of the audio file in seconds.

durationA :: FilePath -> IO Float Source #

A variant of the durationAG with the first argument being W.

upperBndG :: ULencode -> FilePath -> IO Int Source #

Function upperBndG returns a maximum number of samples for use in other functions.

selMaxAbs :: FilePath -> (Int, Int) -> IO (ByteString, Bool) Source #

A variant of the selMaxAbsG with the first argument being W.

maxAbs :: (ByteString, ByteString) -> (ByteString, Bool) Source #

Function maxAbs allows to choose a maximum by absolute value if the values are written as ByteString. Bool True corresponds to maximum value, False - to minimum value