packages feed

mmsyn7ukr 0.13.0.1 → 0.14.0.0

raw patch · 6 files changed

+82/−19 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ SoXBasics: recB :: FilePath -> (Double, Double) -> IO ()
- Processing_mmsyn7ukr: tempS :: String -> IO (Double, Bool)
+ Processing_mmsyn7ukr: tempS :: String -> IO (Double, Double, Bool)

Files

ChangeLog.md view
@@ -204,3 +204,10 @@ ## 0.13.0.1 -- 2020-02-08  * Thirteenth version revised A. Fixed some issues with wrong calendar and spelling. ++## 0.14.0.0 -- 2020-02-08++* Fourteenth version. Fixed issue with cycling the 'beginProcessing' function because of the issue with the 'controlNoiseReduction' function+being called with default values. Added a new function 'recB' to the SoXBasics module. Reduced the size of the test file "y.wav". Changed the 'tempS' function, so+that now it returns alse the needed pause duration, which you can specify as a Double value after the '#' sign after the input duration ratio. By default,+it is equal to 0.5, that means the duration of the pause before the SoX actually will record a sound data is equal to 0.5 second.
Processing_mmsyn7ukr.hs view
@@ -70,7 +70,7 @@ ; return () }) (do        putStrLn "Something went unexpectedly, please, repeat the precedure again, be attentive to the data you provide as input! "        putStr "The needed files were NOT created (may be the sound was not at the moment of recording)! The process will be restarted "-       putStrLn "for the sound. Please, produce a sound during the first 3 seconds (after 0.5 second delay) or specify greater ratio or use \'sharp\' mode!"+       putStrLn "for the sound. Please, produce a sound during the first 3 seconds (after 0.5 second delay or whichever you specify), OR specify greater ratio, or use \'sharp\' mode!"        cleanTemp        produceSound (actsctrl, noiseLim) file) @@ -149,18 +149,18 @@     ; putStrLn $ "For example for 10 seconds record, please, specify " ++ show (10.0/duration0) ++ " as a next step ratio."     ; putStrLn "    *****"     ; putStrLn ""-    ; (longerK0,sharp) <- tempS soundUkr+    ; (longerK0,pause0,sharp) <- tempS soundUkr     ; let longerK = (read x3::Double)*longerK0-    ; putStrLn "Please, wait for 0.5 second and pronounce the sound representation for the "+    ; putStrLn $ "Please, wait for " ++ show pause0 ++ " seconds and pronounce the sound representation for the "     ; putStrLn ""     ; putStrLn $ "                                                             \"" ++ (if soundUkr /= "ь" then map toUpper soundUkr else soundUkr) ++ "\""     ; putStrLn ""     ; putStrLn " sound or whatever you would like to be substituted instead (be sensible, please)! "     ; if sharp-        then recA "x.wav" longerK+        then recB "x.wav" (longerK, pause0)         else if (compare longerK 3.0 == GT)-               then recA "x.wav" longerK-               else recA "x.wav" 3.0+               then recB "x.wav" (longerK, pause0)+               else recB "x.wav" (3.0, pause0)     ; 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. "     ; controlNoiseReduction actsctrl     ; norm "_x.wav"@@ -257,18 +257,18 @@ ; putStrLn "" ; (_, Just hout, _, _) <- createProcess (proc (fromJust . showE $ "soxi") ["-D", file]) { std_out = CreatePipe } ; x3 <- hGetContents hout-; (longerK0,sharp) <- tempS soundUkr+; (longerK0,pause0,sharp) <- tempS soundUkr ; let longerK = (read x3::Double)*longerK0-; putStrLn "Please, wait for 0.5 second and pronounce the sound representation for the "+; putStrLn $ "Please, wait for " ++ show pause0 ++ " seconds and pronounce the sound representation for the " ; putStrLn "" ; putStrLn $ "                                                             \"" ++ (if soundUkr /= "ь" then map toUpper soundUkr else soundUkr) ++ "\"" ; putStrLn "" ; putStrLn " sound or whatever you would like to be substituted instead (be sensible, please)! " ; if sharp-        then recA "x.wav" longerK+        then recB "x.wav" (longerK, pause0)         else if (compare longerK 3.0 == GT)-               then recA "x.wav" longerK-               else recA "x.wav" 3.0+               then recB "x.wav" (longerK, pause0)+               else recB "x.wav" (3.0, pause0) ; 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. " ; controlNoiseReduction actsctrl ; norm "_x.wav"@@ -346,8 +346,11 @@     then do       s2 <- onException (do               let s1 = take 1 actsctrl-                  sr = "0." ++ (filter isDigit . drop 1 $ actsctrl)-                  s  = read sr::Double in if s > 0.0 then return s else return 0.01) (return 0.5)+                  sr0 = filter isDigit . drop 1 $ actsctrl+              if null sr0+                then return 0.5+                else let sr = "0." ++ sr0+                         s  = read sr::Double in if s > 0.0 then return s else return 0.01) (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@@ -364,10 +367,11 @@             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+-- | Function to get the @(Double, Double, Bool)@ value. The first @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 a duration of the pause before SoX actually starts to+-- record the needed sound data (in seconds). The @Bool@ value specifies whether the program uses a \'sharp\' mode meaning that -- it does not check whether the resulting duration of the recording is at least 3 seconds long, so you can specify shorter durations.-tempS :: String -> IO (Double, Bool)+tempS :: String -> IO (Double, Double, Bool) tempS soundUkr = onException (do     putStrLn ""     putStr "IMPORTANT. Would you like to use a \'sharp\' mode for this sound representaiion? (Enter \'*\' as the first symbol in your next input to use the "@@ -375,16 +379,21 @@     putStr "but a recording duration is no more than the one specified by your entered ratio). For not using the \'sharp\' mode, "     putStrLn "enter your next input without the asterisk."     putStrLn ""+    putStrLn "IMPORTANT 2. After specifying the ratio you can input \'#\' sign and specify after it the duration (in seconds) of the needed pause before SoX will actually start recording of the sound data. The default one is 0.5 seconds if nothing is specified. This also provides backward compatibility of the program."+    putStrLn ""     putStrLn "In how many times do you think your sound representing "      putStrLn ""     putStrLn $ "                     \"" ++ (if soundUkr /= "ь" then map toUpper soundUkr else soundUkr) ++ "\""      putStrLn ""     putStrLn "will sound longer than the recently played one? Specify your input as a Double value without \'e\' notation (with the preceding asterisk sign for the \'sharp\' mode). "+    putStrLn ""     longivityZ <- getLine     let sharp0 = take 1 longivityZ+        sharp1 = drop 1 . dropWhile (/= '#') $ longivityZ+        sharp2 = if null sharp1 then 0.5 else let zzz0 = read (filter (\z -> isDigit z || z == '.') sharp1)::Double in if zzz0 /= 0.0 then zzz0 else 0.5     case sharp0 of-      "*" -> let long = read (drop 1 longivityZ)::Double in return (long,True)-      _   -> let long = read longivityZ::Double in return (long,False)) (do +      "*" -> let long = read (takeWhile (/= '#') . drop 1 $ longivityZ)::Double in return (long,sharp2,True)+      _   -> let long = read (takeWhile (/= '#') longivityZ)::Double in return (long,sharp2,False)) (do                 putStrLn "Please, specify again the valid values!"                tempS soundUkr) 
README.markdown view
@@ -234,3 +234,13 @@ command line argument "-t" and the program will only play the test sound with just that duration. Remember its duration -- it is the duration of the needed pause before you can start your recording of the every sound representation.++           ***** Specifying the Pause before SoX Actually Starts Recording *****+           ---------------------------------------------------------------------+           +You can specify the pause before SoX actually starts recording of the sound data+for every sound representation. For this, please, specify after the needed+ratio a '#' sign and after it the needed duration of the pause in seconds as a+Double value. The program will try to use it. If not specified or not properly+specified, the program uses a default one (compatible with the previous versions)+equal to 0.5 second pause.
SoXBasics.hs view
@@ -40,6 +40,7 @@   , silenceBoth   -- ** Recording   , recA+  , recB   -- ** Changing sample rate   , resampleA   -- ** Working with noise@@ -402,6 +403,42 @@         then return ()         else catchEnd (NotRecorded file)             | otherwise = catchEnd ExecutableNotProperlyInstalled++-- | Function 'recB' records audio file with the given name and duration in seconds. For Windows it uses a default audio device and \"-t waveaudio -d\" option +-- to the SoX. Unlike 'recA', the duration of the pause in seconds (before the SoX executable actually starts to record sound data after+-- an initialization of the sound recording device) is controlled by the second @Double@ function argument. +recB :: FilePath -> (Double, Double) -> IO ()+recB file (x, y) | isJust (showE "sox") && take 5 os == "mingw" = do +  (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) ["-t","waveaudio","-d","-b16", "-c1", "-esigned-integer", "-L", file, "trim", showFFloat Nothing y $ show 0, showFFloat Nothing x $ show 0] ""+  if code /= ExitSuccess+    then do+      e0 <- doesFileExist file+      if e0+        then do+          removeFile file+          catchEnd (NotRecorded file)+        else catchEnd (NotRecorded file)+    else do+      e1 <- doesFileExist file+      if e1+        then return ()+        else catchEnd (NotRecorded file)+                 | isJust (showE "rec") = do+  (code, _, _) <- readProcessWithExitCode (fromJust (showE "rec")) ["-b16", "-c1", "-esigned-integer", "-L", file, "trim", showFFloat Nothing y $ show 0, showFFloat Nothing x $ show 0] ""+  if code /= ExitSuccess+    then do+      e0 <- doesFileExist file+      if e0+        then do+          removeFile file+          catchEnd (NotRecorded file)+        else catchEnd (NotRecorded file)+    else do+      e1 <- doesFileExist file+      if e1+        then return ()+        else catchEnd (NotRecorded file)+                 | otherwise = catchEnd ExecutableNotProperlyInstalled  -- | 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 
mmsyn7ukr.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                mmsyn7ukr-version:             0.13.0.1+version:             0.14.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
y.wav view

binary file changed (22094 → 8044 bytes)