mmsyn7ukr 0.11.0.0 → 0.12.0.0
raw patch · 8 files changed
+412/−230 lines, 8 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Processing_mmsyn7ukr: controlNoiseReduction :: String -> IO ()
+ SoXBasics: noiseReduceBU :: FilePath -> Double -> IO ()
+ SoXBasics: noiseReduceEU :: FilePath -> Double -> IO ()
+ SoXBasics1: noiseReduceBU :: FilePath -> Double -> IO ()
+ SoXBasics1: noiseReduceEU :: FilePath -> Double -> IO ()
Files
- ChangeLog.md +6/−0
- Main.hs +1/−1
- Processing_mmsyn7ukr.hs +97/−61
- README +0/−166
- README.markdown +188/−0
- SoXBasics.hs +54/−0
- SoXBasics1.hs +64/−0
- mmsyn7ukr.cabal +2/−2
ChangeLog.md view
@@ -170,3 +170,9 @@ * Eleventh version. Changed the structure of modules. The module FinalException is now Control.Exception.FinalException. Added new contstuctors to the module. Now the FinalException datatype includes all the needed exceptions for mmsyn7 series of program.++## 0.12.0.0 -- 2020-01-29++* Twelfth version. Added the possibility to control the amount (level) of noise reduction (if any) by the first command line parameter. For this,+added new functions noiseReduceBU and noiseReduceEU to the SoXBasics and SoXBasics1 modules and changed the behaviour of the Main function. Fixed issue with+the wrongly treated first command line parameter in the produceSound2 function. Changed README to README.markdown. Some documentation improvement.
Main.hs view
@@ -36,5 +36,5 @@ putStr "list-of-produced-sound-representations (if any) -- a list of sound representations, which the program will try to produce while being executed. " putStrLn "The default one (if not specified) is a full range of needed sound representations. " "-v" -> do- putStrLn "mmsyn7ukr version: 0.11.0.0"+ putStrLn "mmsyn7ukr version: 0.12.0.0" _ -> main7ukr args
Processing_mmsyn7ukr.hs view
@@ -22,6 +22,7 @@ , produceSound3 , produceSound4 , beginProcessing+ , controlNoiseReduction -- * Additional functions , tempS , showCoef@@ -44,6 +45,7 @@ import System.IO import System.Info (os) import System.Environment (getProgName)+import System.Exit import SoXBasics import CaseBi (getBFst') import ReplaceP (replaceP, replaceP4)@@ -75,56 +77,52 @@ -- | Function 'produceSound3' is used internally in the 'produceSound2' function. produceSound3 :: (String, String) -> (FilePath, FilePath) -> String -> (Int, Double) -> Double -> IO ()-produceSound3 (actsctrl, noiseLim) (file, file1) soundUkr (noiseMax, duration0) lim0 = case actsctrl of- "-1" -> - do- lim1 <- durationA "8_x.wav"- if lim1 <= 0.0- then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)- else do - resampleA "8_x.wav" (22050::Int)- produceSound4 (file, file1) "38_x.wav"- "0" -> - do- lim1 <- durationA "8_x.wav"- if lim1 <= 0.0- then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)- else do - resampleA "8_x.wav" (22050::Int)- produceSound4 (file, file1) "38_x.wav"- "1" -> - do- alterVadB "8_x.wav" lim0 noiseMax (duration0*0.04)- lim1 <- durationA "8_x.wav"- if lim1 <= 0.0- then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)- else do - alterVadE "8_x.wav" lim1 noiseMax (duration0*0.04)- resampleA "8_x.wav" (22050::Int)- produceSound4 (file, file1) "38_x.wav"- "2" ->- do- alterVadB "8_x.wav" lim0 noiseMax (duration0*0.04)- lim1 <- durationA "8_x.wav"- if lim1 <= 0.0- then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)- else do - alterVadE "8_x.wav" lim1 noiseMax (duration0*0.04)- sincA "8_x.wav"- resampleA "4.8_x.wav" (22050::Int)- produceSound4 (file, file1) "34.8_x.wav"- _ ->- do- alterVadB "8_x.wav" lim0 noiseMax (duration0*0.04)- lim1 <- durationA "8_x.wav"- if lim1 <= 0.0- then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)- else do - alterVadE "8_x.wav" lim1 noiseMax (duration0*0.1)- sincA "8_x.wav"- resampleA "4.8_x.wav" (22050::Int)- quarterSinFade "34.8_x.wav"- produceSound4 (file, file1) "434.8_x.wav"+produceSound3 (actsctrl, noiseLim) (file, file1) soundUkr (noiseMax, duration0) lim0 = if actsctrl == "-1"+ then do+ lim1 <- durationA "8_x.wav"+ if lim1 <= 0.0+ then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)+ else do + resampleA "8_x.wav" (22050::Int)+ produceSound4 (file, file1) "38_x.wav"+ else case (take 1 actsctrl) of+ "0" -> do+ lim1 <- durationA "8_x.wav"+ if lim1 <= 0.0+ then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)+ else do + resampleA "8_x.wav" (22050::Int)+ produceSound4 (file, file1) "38_x.wav"+ "1" -> do+ alterVadB "8_x.wav" lim0 noiseMax (duration0*0.04)+ lim1 <- durationA "8_x.wav"+ if lim1 <= 0.0+ then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)+ else do + alterVadE "8_x.wav" lim1 noiseMax (duration0*0.04)+ resampleA "8_x.wav" (22050::Int)+ produceSound4 (file, file1) "38_x.wav"+ "2" -> do+ alterVadB "8_x.wav" lim0 noiseMax (duration0*0.04)+ lim1 <- durationA "8_x.wav"+ if lim1 <= 0.0+ then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)+ else do + alterVadE "8_x.wav" lim1 noiseMax (duration0*0.04)+ sincA "8_x.wav"+ resampleA "4.8_x.wav" (22050::Int)+ produceSound4 (file, file1) "34.8_x.wav"+ _ -> do+ alterVadB "8_x.wav" lim0 noiseMax (duration0*0.04)+ lim1 <- durationA "8_x.wav"+ if lim1 <= 0.0+ then beginProcessing (file, file1) soundUkr (actsctrl, noiseLim)+ else do + alterVadE "8_x.wav" lim1 noiseMax (duration0*0.1)+ sincA "8_x.wav"+ resampleA "4.8_x.wav" (22050::Int)+ quarterSinFade "34.8_x.wav"+ produceSound4 (file, file1) "434.8_x.wav" -- | Function 'produceSound4' is used internally in the 'produceSound3' function for amplification -- up/down to the maximum level of the first @FilePath@ parameter in the tuple. The second one gives @@ -162,16 +160,20 @@ then recA "x.wav" longerK else recA "x.wav" 3.0 ; putStrLn "The file is recorded and now will be automatically processed. You will be notificated with the text message in the terminal about the creation of the needed file. Please, wait a little. "- ; if actsctrl == "-1"- then do- _ <- readProcessWithExitCode (fromJust (showE "sox")) ["x.wav", "_x.wav", "noisered", "nx0.wav.b.prof"] ""- return ()- else renameFile "x.wav" "_x.wav"+ ; controlNoiseReduction actsctrl ; norm "_x.wav" ; lim0 <- durationA "8_x.wav" ; putStrLn "" ; putStrLn "If you specified as a first command line argument one of the numbers below the program behaves as follows: "- ; putStrLn "-1 -> the program does not reduce noise, it only resamples the audio to the needed 22050 Hz and adjusts the amplitude;"+ ; putStrLn "-1 -> the program does not reduce noise, it only resamples the audio to the needed 22050 Hz and adjusts the amplitude."+ ; putStrLn ""+ ; putStr "If you specified something else then the program will reduce the noise using the created noise profile. If the first character is one of the "+ ; putStr "following, then the program will do the following actions besides. After the first character (without any spaces) you can specify "+ ; putStr "the level of noise reduction by 2 next digits. They are treated by the program as a fractional part of the number \"0.\" ++ \"...\" "+ ; putStr "so that the last number is passed to the SoX as an amount parameter in the \"noisered\" effect (the greater number gives more aggressive "+ ; putStrLn "noise reduction with the default one equal to 0.5. For more information, please, refer to the SoX documentation. "+ ; putStrLn ""+ ; putStrLn "Therefore, if you specify as a first symbol in the first command line argument one of the following numbers, then the program will behave: " ; putStrLn "0 -> after the noise reduction the program only resample the audio to the needed 22050 Hz and adjusts the amlitude; " ; putStrLn "1 -> after the noise reduction the program additionally to the 0-processing truncates the silence from the beginning and end of the audio to the level given by the second command line parameter; " ; putStrLn "2 -> after the noise reduction the program additionally to the 1-processing applies a double band-reject filter to the audio (SoX \"sinc\" effect); "@@ -229,16 +231,20 @@ then recA "x.wav" longerK else recA "x.wav" 3.0 ; putStrLn "The file is recorded and now will be automatically processed. You will be notificated with the text message in the terminal about the creation of the needed file. Please, wait a little. "-; if actsctrl /= "-1"- then do- _ <- readProcessWithExitCode (fromJust (showE "sox")) ["x.wav", "_x.wav", "noisered", "nx0.wav.b.prof"] ""- return ()- else renameFile "x.wav" "_x.wav"+; controlNoiseReduction actsctrl ; norm "_x.wav" ; lim0 <- durationA "8_x.wav" ; putStrLn "" ; putStrLn "If you specified as a first command line argument one of the numbers below the program behaves as follows: " ; putStrLn "-1 -> the program does not reduce noise, it only resamples the audio to the needed 22050 Hz and adjusts the amplitude;"+; putStrLn ""+; putStr "If you specified something else then the program will reduce the noise using the created noise profile. If the first character is one of the "+; putStr "following, then the program will do the following actions besides. After the first character (without any spaces) you can specify "+; putStr "the level of noise reduction by 2 next digits. They are treated by the program as a fractional part of the number \"0.\" ++ \"...\" "+; putStr "so that the last number is passed to the SoX as an amount parameter in the \"noisered\" effect (the greater number gives more aggressive "+; putStrLn "noise reduction with the default one equal to 0.5. For more information, please, refer to the SoX documentation. "+; putStrLn ""+; putStrLn "Therefore, if you specify as a first symbol in the first command line argument one of the following numbers, then the program will behave: " ; putStrLn "0 -> after the noise reduction the program only resamples the audio to the needed 22050 Hz and adjusts the amlitude; " ; putStrLn "1 -> after the noise reduction the program additionally to the 0-processing truncates the silence from the beginning and end of the audio to the level given by the second command line parameter; " ; putStrLn "2 -> after the noise reduction the program additionally to the 1-processing applies a double band-reject filter to the audio (SoX \'sinc\' effect); "@@ -255,6 +261,36 @@ ; let noiseMax = getBFst' (2::Int, V.fromList [("0", 0::Int), ("1", 1::Int), ("2", 2::Int), ("3", 3::Int)]) noiseLim ; produceSound3 (actsctrl, noiseLim) (file, file1) soundUkr (noiseMax, duration0) lim0 ; cleanTemp }++-- | Function 'controlNoiseReduction' is used in the 'produceSound2' and 'beginProcessing' functions to reduce the noise with the created by the+-- 'tempeRa' noise profile. If you specified something else than \"-1\" as a first command line argument, then the program will reduce the noise+-- using the created noise profile. +-- If the first character is one of the following, then the program will do the following actions besides. After the first character+-- (without any spaces) you can specify the level of noise reduction by 2 next digits. They are treated by the program as a fractional part+-- of the number \"0.\" ++ \"...\" so that the last number is passed to the SoX as an amount parameter in the \"noisered\" effect+-- (the greater number gives more aggressive noise reduction with the default one equal to 0.5. For more information, please, refer to the SoX documentation. +controlNoiseReduction :: String -> IO ()+controlNoiseReduction actsctrl = if actsctrl /= "-1"+ then do+ s2 <- onException (do+ let s1 = take 1 actsctrl+ sr = "0." ++ (filter isDigit . drop 1 $ actsctrl)+ s = read sr::Double in return s) (return 0.5)+ (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) ["x.wav", "_x.wav", "noisered", "nx0.wav.b.prof", showFFloat (Just 4) s2 $ show 0] ""+ if code /= ExitSuccess + then do+ e1 <- doesFileExist $ "_x.wav"+ if e1+ then do+ removeFile $ "_x.wav"+ catchEnd (NotCreatedWithEffect "noisered")+ else catchEnd (NotCreatedWithEffect "noisered")+ else do + e2 <- doesFileExist $ "_x.wav"+ if e2 + then return ()+ else catchEnd (InitialFileNotChanged "x.wav")+ else renameFile "x.wav" "_x.wav" -- | Function to get the @(Double, Bool)@ value. The @Double@ value shows in how many times you expect that your sound representation -- will be longer than the one provided by the @mmsyn6ukr@ package. The second one specifies whether the program uses a \'sharp\' mode meaning that
− README
@@ -1,166 +0,0 @@-A program and a library that can be used as a simple -basic interface to some SoX functionality or for producing -the approximately Ukrainian speech with your own recorded -voice (actually it produces the needed sound representations).--The program starts with Caution to be responsible for usage -and to use it personally. Then the program guides you -through the creating and using your Ukrainian "voice". -Please, use it carefully. After the execution you can-execute mmsyn7h program to produce some records with your -newly created "voice". During the execution of the last one-you can choose whether to remove (clean) -all the created sound files in the current directory for -security reasons. If the programs terminate by interruption (or -generally) it is a good practice to remove the current -directory sound files manually.-- ***** CAUTION! *****--"The possession of great power necessarily implies-great responsibility."-- (William Lamb)--The program mmsyn7ukr produces the "voice" represented as an ordered -set of sounds each of which corresponds (represents) one of the -Ukrainian sounds so that using them together by mmsyn7h program -(https://hackage.haskell.org/package/mmsyn7h) can be a background -for sound synthesis. If you pronounce sounds as the appropriate -Ukrainian ones, close to proper Ukrainian speech with your own -voice. This program approximates your voice with a sequence -of recorded separate sounds with your control over the -duration of the sounds. They are then precessed by the SoX -binaries already installed in the system to produce the -needed sounds and then you can pronounce some Ukrainian text -with your recorded "voice" using mmsyn7h program. In-between -you can do some additional processing as you need. Moreover, -you can substitute whatever sounds you like (consider being -sensible) instead of your own voice.--Be aware that if somebody can get access to the sounds of -your voice or to the recorded speech (except you) then this -possibility itself creates security issues and concerns. So, -please, do NOT give access to such records to anybody else -except you.--In such a case, the program is for personal usage of every -user ONLY!--Being given as an advice in such a case, run the program -in the empty directory with the current user permissions to write, -read and search and provide some proofs and evidence that nobody else -can even read the files in the directory. May be, it is better -to execute the program being in the directory located in the RAM, -then consequently wait until the program ends and then reboot -the computer. --If the program ends earlier, you must then remove -(better wipe) the directory contents. No other users should -have access to the computer after you have begun to run the -program and have not deleted (or better wiped) the contents -of the directory. Please, be aware, that there are possibilities -to read sensitive information from the drives after you have -deleted the files in a usual way. You can use wiping for better -security. Besides, if somebody can get access to the memory of -the computer or to the directory contents where you run the -program or (may be) to the temporary files created by SoX or -to the drive where you run the program (not in the RAM, or may -be in it) then your voice can be stolen and / or used -inappropriately. Use all possible precautions and measures to -avoid the situation. --Be aware also that the given by the program technology (or -documentation for it in any form) of the voice processing can -be improved so there is NO guarantees that the given technology -or its successors cannot be used in violating your voice identity -to produce from some available voice records the voice for the -inappropriate usage. Therefore, better is to prove your identity not -only with the solely voice itself but with some additional -independent sources and measures. --The author of the program accordingly to the LICENSE (MIT) does not -response for any possible issues, but by this notification tries to -intent you to be aware of some possible issues.-- ***** Command Line Arguments *****--If you specify as a first command line argument one of the numbers below-the program behaves as follows:- -1 -> the program does not reduce noise, it only resamples- the audio to the needed 22050 Hz and adjusts the amplitude;- 0 -> after the noise reduction the program only resample - the audio to the needed 22050 Hz and adjusts the amlitude; - 1 -> after the noise reduction the program additionally - to the 0-processing truncates the silence from the beginning - and end of the audio to the level given by the second - command line parameter; - 2 -> after the noise reduction the program additionally to - the 1-processing applies a double band-reject filter to - the audio (SoX "sinc" effect); - 3 -> after the noise reduction the program additionally to - the 2-processing applies fade-in and fade-out effects to - the audio; - _ -> is the same as 3. --If you specify as a second command line argument one of the numbers below-the program behaves as follows: - 0 -> the maximum amplitude, starting from which the file will - not be trimmed for the first command line argument greater - of 1, is 0.01; - 1 -> the maximum amplitude, starting from which the file - will not be trimmed for the first command line argument - greater of 1, is 0.02; - 2 -> the maximum amplitude, starting from which the file - will not be trimmed for the first command line argument - greater of 1, is 0.04; - 3 -> the maximum amplitude, starting from which the file - will not be trimmed for the first command line argument - greater of 1, is 0.08; - _ -> the maximum amplitude, starting from which the file - will not be trimmed for the first command line argument - greater of 1, is 0.04; --If you specify the third command line argument, it must be a list -of Strings that can be obtained by executing the mmsyn7s program -(https://hackage.haskell.org/package/mmsyn7s). The program will create -just that non-silent representations for the Ukrainian sounds, -which are given. The list must be sorted.-- ***** More Information *****--You can create a sound in either a 'sharp' mode or in a usual mode.-The first one means that the program does not check whether the-specified duration for recording the initial sound data-is greater than 3 seconds. In such a case the duration can be-much smaller. This mode needs more mastership in interacting with a-program. For speech synthesis (as an advice) use this mode for-the very short sounds (like the sound representation for "ь")-or for the sounds, you can articulate for a long time continually-(for example, vowels and some consonants). The 'sharp' mode delegates-the responsibility for the sound to much broader extent to the user,-so for a beginning it is not recommended (though you can give it a try).--At the beginning the program also creates a noise profile (once per execution).-It is now used to reduce the noise level for the recorded sound representations.-It uses the default SoX noise reducing settings with a hope that for you they can-be sufficient. If you see that the program removes some sensitive and-important sound data from the recorded by it sound representations,-then you can specify as a first command line argument "-1". The program-in such a case will create a noise profile as usual, but will not reduce-the noise at all.-- ***** Ukrainian Localization *****--Please, before using the program check that uk_UA.UTF8 localization is-present in your system as one of the system locales. Otherwise,-the program will possibly (in some cases surely) cycle. In such a case,-you can terminate it in a usual way by sending interruption signals.-- ***** SoXBasics and SoXBasics1 *****--The library have two similar modules with partially overlapping function names-(so it is recommended to import them qualified). SoXBasics1 functions after-creation of the resulting file try to replace by it the initial one and to clean-the space from the temporary files. This can be helpful in writing sequentially-applied functions but needs somewhat more resources.
+ README.markdown view
@@ -0,0 +1,188 @@+A program and a library that can be used as a simple +basic interface to some [SoX](https://sourceforge.net/projects/sox/)+functionality or for producing +the approximately Ukrainian speech with your own recorded +voice (actually it produces the needed sound representations).++The program starts with CAUTION to be responsible for usage +and to use it personally. Then the program guides you +through the creating and using your Ukrainian "voice". +Please, use it carefully. After the execution you can+execute mmsyn7h program to produce some records with your +newly created "voice". During the execution of the last one+you can choose whether to remove (clean) +all the created sound files in the current directory for +security reasons. If the programs terminate by interruption (or +generally) it is a good practice to remove the current +directory sound files manually.++ ***** CAUTION! *****+ --------------------++"The possession of great power necessarily implies+great responsibility."++ (William Lamb)++The program mmsyn7ukr produces the "voice" represented as an ordered +set of sounds each of which corresponds (represents) one of the +Ukrainian sounds so that using them together by+[mmsyn7h program](https://hackage.haskell.org/package/mmsyn7h)+can be a background for sound synthesis.+If you pronounce sounds as the appropriate +Ukrainian ones, close to proper Ukrainian speech with your own +voice. This program approximates your voice with a sequence +of recorded separate sounds with your control over the +duration of the sounds. They are then precessed by the SoX +binaries already installed in the system to produce the +needed sounds and then you can pronounce some Ukrainian text +with your recorded "voice" using mmsyn7h program. In-between +you can do some additional processing as you need. Moreover, +you can substitute whatever sounds you like (consider being +sensible) instead of your own voice.++Be aware that if somebody can get access to the sounds of +your voice or to the recorded speech (except you) then this +possibility itself creates security issues and concerns. So, +please, do NOT give access to such records to anybody else +except you.++In such a case, the program is for personal usage of every +user ONLY!++Being given as an advice in such a case, run the program +in the empty directory with the current user permissions to write, +read and search and provide some proofs and evidence that nobody else +can even read the files in the directory. May be, it is better +to execute the program being in the directory located in the RAM, +then consequently wait until the program ends and then reboot +the computer. ++If the program ends earlier, you must then remove +(better wipe) the directory contents. No other users should +have access to the computer after you have begun to run the +program and have not deleted (or better wiped) the contents +of the directory. Please, be aware, that there are possibilities +to read sensitive information from the drives after you have +deleted the files in a usual way. You can use wiping for better +security. Besides, if somebody can get access to the memory of +the computer or to the directory contents where you run the +program or (may be) to the temporary files created by SoX or +to the drive where you run the program (not in the RAM, or may +be in it) then your voice can be stolen and / or used +inappropriately. Use all possible precautions and measures to +avoid the situation. ++Be aware also that the given by the program technology (or +documentation for it in any form) of the voice processing can +be improved so there is NO guarantees that the given technology +or its successors cannot be used in violating your voice identity +to produce from some available voice records the voice for the +inappropriate usage. Therefore, better is to prove your identity not +only with the solely voice itself but with some additional +independent sources and measures. ++The author of the program accordingly to the LICENSE (MIT) does not +response for any possible issues, but by this notification tries to +intent you to be aware of some possible issues.++ ***** Command Line Arguments *****+ ----------------------------------++If you specify as a first command line argument one of the numbers below+the program behaves as follows:+ -1 -> the program does not reduce noise, it only resamples+ the audio to the needed 22050 Hz and adjusts the amplitude.++If you specified something else then the program will reduce the noise+using the created noise profile. If the first character is one of the +following, then the program will do the following actions besides.+After the first character (without any spaces) you can specify +the level of noise reduction by 2 next digits. They are treated+by the program as a fractional part of the number "0." ++ "..." +so that the last number is passed to the sox as an amount parameter+in the "noisered" effect (the greater number gives more aggressive +noise reduction with the default one equal to 0.5.+For more information, please, refer to the SoX documentation. ++Therefore, if you specify as a first symbol in the first+command line argument one of the next numbers, then+the program will behave as follows: + 0 -> after the noise reduction the program only resample + the audio to the needed 22050 Hz and adjusts the amlitude; + 1 -> after the noise reduction the program additionally + to the 0-processing truncates the silence from the beginning + and end of the audio to the level given by the second + command line parameter; + 2 -> after the noise reduction the program additionally to + the 1-processing applies a double band-reject filter to + the audio (SoX "sinc" effect); + 3 -> after the noise reduction the program additionally to + the 2-processing applies fade-in and fade-out effects to + the audio; + _ -> is the same as 3. ++If you specify as a second command line argument one of the numbers below+the program behaves as follows: + 0 -> the maximum amplitude, starting from which the file will + not be trimmed for the first command line argument greater + of 1, is 0.01; + 1 -> the maximum amplitude, starting from which the file + will not be trimmed for the first command line argument + greater of 1, is 0.02; + 2 -> the maximum amplitude, starting from which the file + will not be trimmed for the first command line argument + greater of 1, is 0.04; + 3 -> the maximum amplitude, starting from which the file + will not be trimmed for the first command line argument + greater of 1, is 0.08; + _ -> the maximum amplitude, starting from which the file + will not be trimmed for the first command line argument + greater of 1, is 0.04; ++If you specify the third command line argument, it must be a list +of Strings that can be obtained by executing the+[mmsyn7s program](https://hackage.haskell.org/package/mmsyn7s).+The program will create just that non-silent representations for+the Ukrainian sounds, which are given. The list must be sorted.++ ***** More Information *****+ ----------------------------++You can create a sound in either a 'sharp' mode or in a usual mode.+The first one means that the program does not check whether the+specified duration for recording the initial sound data+is greater than 3 seconds. In such a case the duration can be+much smaller. This mode needs more mastership in interacting with a+program. For speech synthesis (as an advice) use this mode for+the very short sounds (like the sound representation for "ь")+or for the sounds, you can articulate for a long time continually+(for example, vowels and some consonants). The 'sharp' mode delegates+the responsibility for the sound to much broader extent to the user,+so for a beginning it is not recommended (though you can give it a try).++At the beginning the program also creates a noise profile (once per execution).+It is now used to reduce the noise level for the recorded sound representations.+It uses the default SoX noise reducing settings with a hope that for you they can+be sufficient. If you see that the program removes some sensitive and+important sound data from the recorded by it sound representations,+then you can specify as a first command line argument "-1". The program+in such a case will create a noise profile as usual, but will not reduce+the noise at all.++ ***** Ukrainian Localization *****+ ----------------------------------++Please, before using the program check that uk_UA.UTF8 localization is+present in your system as one of the system locales. Otherwise,+the program will possibly (in some cases surely) cycle. In such a case,+you can terminate it in a usual way by sending interruption signals.++ ***** SoXBasics and SoXBasics1 *****+ ------------------------------------++The library have two similar modules with partially overlapping function names+(so it is recommended to import them qualified). SoXBasics1 functions after+creation of the resulting file try to replace by it the initial one and to clean+the space from the temporary files. This can be helpful in writing sequentially+applied functions but needs somewhat more resources.
SoXBasics.hs view
@@ -47,6 +47,8 @@ , noiseProfE , noiseReduceB , noiseReduceE+ , noiseReduceBU+ , noiseReduceEU -- ** Filtering , sincA -- ** Volume amplification@@ -511,6 +513,58 @@ noiseReduceE file = if isJust (showE "sox") then do (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "_." ++ file, "noisered", file ++ ".e.prof"] ""+ if code /= ExitSuccess + then do+ e1 <- doesFileExist $ "_." ++ file+ if e1+ then do+ removeFile $ "_." ++ file+ catchEnd (NotCreatedWithEffect "noisered")+ else catchEnd (NotCreatedWithEffect "noisered")+ else do + e2 <- doesFileExist $ "_." ++ file+ if e2 + then return ()+ else catchEnd (InitialFileNotChanged file)+ else catchEnd ExecutableNotProperlyInstalled++-- | 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 @Double@ 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. +noiseReduceBU :: FilePath -> Double -> IO ()+noiseReduceBU file amount = if isJust (showE "sox")+ then do+ (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "_" ++ file, "noisered", file ++ ".b.prof", showFFloat (Just 4) amount $ show 0] ""+ if code /= ExitSuccess + then do+ e1 <- doesFileExist $ "_" ++ file+ if e1+ then do+ removeFile $ "_" ++ file+ catchEnd (NotCreatedWithEffect "noisered")+ else catchEnd (NotCreatedWithEffect "noisered")+ else do + e2 <- doesFileExist $ "_" ++ file+ if e2 + then return ()+ else catchEnd (InitialFileNotChanged file)+ else catchEnd ExecutableNotProperlyInstalled++-- | Function 'noiseReduceEU' reduces with SoX a noise in the file given with the corresponding noise profile created with 'noiseProfEU' 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 @Double@ 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. +noiseReduceEU :: FilePath -> Double -> IO ()+noiseReduceEU file amount = if isJust (showE "sox") + then do+ (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "_." ++ file, "noisered", file ++ ".e.prof", showFFloat (Just 4) amount $ show 0] "" if code /= ExitSuccess then do e1 <- doesFileExist $ "_." ++ file
SoXBasics1.hs view
@@ -29,6 +29,8 @@ -- ** Working with noise , noiseReduceB , noiseReduceE+ , noiseReduceBU+ , noiseReduceEU -- ** Filtering , sincA -- ** Volume amplification@@ -274,6 +276,68 @@ renameFile ("_." ++ file) file else catchEnd (InitialFileNotChanged file) else catchEnd ExecutableNotProperlyInstalled++-- | 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 @Double@ 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.+noiseReduceBU :: FilePath -> Double -> IO ()+noiseReduceBU file amount = if isJust (showE "sox")+ then do+ (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "_" ++ file, "noisered", file ++ ".b.prof", showFFloat (Just 4) amount $ show 0] ""+ if code /= ExitSuccess + then do+ e1 <- doesFileExist $ "_" ++ file+ if e1+ then do+ removeFile $ "_" ++ file+ catchEnd (NotCreatedWithEffect "noisered")+ else catchEnd (NotCreatedWithEffect "noisered")+ else do + e2 <- doesFileExist $ "_" ++ file+ if e2 + then do+ removeFile file+ renameFile ("_" ++ file) file+ else catchEnd (InitialFileNotChanged file)+ else catchEnd ExecutableNotProperlyInstalled++-- | 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 @Double@ 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 -> Double -> IO ()+noiseReduceEU file amount = if isJust (showE "sox") + then do+ (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "_." ++ file, "noisered", file ++ ".e.prof", showFFloat (Just 4) amount $ show 0] ""+ if code /= ExitSuccess + then do+ e1 <- doesFileExist $ "_." ++ file+ if e1+ then do+ removeFile $ "_." ++ file+ catchEnd (NotCreatedWithEffect "noisered")+ else catchEnd (NotCreatedWithEffect "noisered")+ else do + e2 <- doesFileExist $ "_." ++ file+ if e2 + then do+ removeFile file+ renameFile ("_." ++ file) file+ else catchEnd (InitialFileNotChanged file)+ else catchEnd ExecutableNotProperlyInstalled++ -- | Function 'volS' changes the given audio with the linear ratio for the amplitude so that the resulting amlitude is equal to the given @Double@ 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
mmsyn7ukr.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn7ukr-version: 0.11.0.0+version: 0.12.0.0 synopsis: A simple basic interface to some SoX functionality or to produce a voice that can be used by mmsyn7h description: A program and a library that can be used as a simple basic interface to some SoX functionality or to produce your voice in Ukrainian (if you pronounce the sounds properly) represented by the separate sounds or something special like soft sign. homepage: https://hackage.haskell.org/package/mmsyn7ukr@@ -13,7 +13,7 @@ copyright: (c) Oleksandr Zhabenko 2019-2020 category: Language build-type: Simple-extra-source-files: ChangeLog.md, README+extra-source-files: ChangeLog.md, README.markdown cabal-version: >=1.10 library