mmsyn7ukr-common-0.3.0.0: Some common for mmsyn7ukr and mmsyn7ukr-array functionality using SoX.
Copyright(c) OleksandrZhabenko 2020 2024
LicenseMIT
Maintaineroleksandr.zhabenko@yahoo.com
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

Sound.SoXBasics1

Description

A program and a library that can be used as a simple basic interface to some SoX functionality. This module differs from the Sound.SoXBasics that the resulting files in it have possibly just the same name as the input ones. The functions try to replace the initial file with the processed one. There is no possibility using these functions to change the file extension. If you use this module and Sound.SoXBasics functionalities together, please, use qualified import to avoid misusage.

Synopsis

Produce sound

General processment functions

Amplitude modification

norm :: FilePath -> IO () Source #

Function norm applies a SoX normalization effect on the audio file. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

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

Function normL applies a SoX gain effect on the audio file with the maximum absolute dB value given by the Int argument. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

gainL :: FilePath -> Float -> IO () Source #

Function normL applies a SoX "gain -b [db-Value]" effect on the audio file with dB value given by the Float argument. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

quarterSinFade :: FilePath -> IO () Source #

Function quarterSinFade applies a fade effect by SoX to the audio file with "q" type. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

Adding silence

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

Function silenceBoth adds some silence to both ends of the audio. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

Changing sample rate

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

Function resampleA changes the sample rate for the recorded audio for further processing. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

Working with noise

noiseReduceB :: FilePath -> IO () Source #

Function noiseReduceB reduces with SoX a noise in the file given with the corresponding noise profile created with noiseProfB function. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

noiseReduceE :: FilePath -> IO () Source #

Function noiseReduceE reduces with SoX a noise in the file given with the corresponding noise profile created with noiseProfE function. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

noiseReduceBU :: FilePath -> Float -> IO () Source #

Function noiseReduceBU reduces with SoX a noise in the file given with the corresponding noise profile created with noiseProfBU function. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). The Float parameter is a number between 0 and 1 showing the level of reducing the noise (the greater number means that the function will reduce more intensively may be even aggressively so that for greater numbers it can remove some sensitive and important sound data as a noise). Internally this parameter is passed unchanged to the "sox" so that it uses it as an amount parameter for the "noisered" effect. Therefore, please, (as being stated in the SoX manual) experiment with the amount to get suitable results. While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

noiseReduceEU :: FilePath -> Float -> IO () Source #

Function noiseReduceEU reduces with SoX a noise in the file given with the corresponding noise profile created with noiseProfE function. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). The Float parameter is a number between 0 and 1 showing the level of reducing the noise (the greater number means that the function will reduce more intensively may be even aggressively so that for greater numbers it can remove some sensitive and important sound data as a noise). Internally this parameter is passed unchanged to the "sox" so that it uses it as an amount parameter for the "noisered" effect. Therefore, please, (as being stated in the SoX manual) experiment with the amount to get suitable results. While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

Filtering

sincA :: FilePath -> IO () Source #

Function sincA uses a "sinc" effect with -a 50 -I 0.07k-11k band-pass filter for the audio file given. While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

Volume amplification

volS :: FilePath -> Float -> IO () Source #

Function volS changes the given audio with the linear ratio for the amplitude so that the resulting amlitude is equal to the given Float parameter. The function must be used with the FilePath parameter containing no directories in its name (that means the file of the FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.

volS2 :: FilePath -> FilePath -> IO () Source #

Function volS2 changes the given audio (the first FilePath parameter, which must be normalized e. g. by the norm function before) with the linear ratio for the amplitude so that the resulting amlitude is equal to the maximum by absolute value amplitude for the file given by the second FilePath parameter. The function must be used with the first FilePath parameter containing no directories in its name (that means the file of the first FilePath parameter must be in the same directory where the function is called from). While being executed the function tries to replace the initial file with the resulting processed one and to clean the temporary files. If it is not successful the function exits with exception of the type FinalException and leaves the initial file without modification.