packages feed

mmsyn7h 0.8.0.0 → 0.8.1.0

raw patch · 3 files changed

+52/−46 lines, 3 filesdep ~mmsyn6ukrPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: mmsyn6ukr

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -133,3 +133,8 @@ ## 0.8.0.0 -- 2020-08-16  * Eighth version. Removed mmsyn7s from the dependencies, instead use a mmsyn6ukr version more than 0.8.0.0.++## 0.8.1.0 -- 2020-12-03++* Eighth version revised A. Fixed issues with being not compiled for some versions. Changed the dependency +boundaries.
MMSyn7h.hs view
@@ -26,18 +26,19 @@ import UkrainianLControl import qualified Data.Vector as V import qualified Data.ByteString.Lazy as B+import qualified Data.ByteString as BS import Data.List (isSuffixOf) import CaseBi (getBFst') import System.Info (os) import MMSyn6Ukr.Show7s (show7s) import Control.Exception.FinalException --- | Function that proposes and creates if accepted the sound record with the new \"voice\". It plays the newly created file once. Then it can delete +-- | Function that proposes and creates if accepted the sound record with the new \"voice\". It plays the newly created file once. Then it can delete -- the sound files in the current directory while being executed if you specify when prompted the text that starts with \"y\". -- If you enter as a first command line argument \"-h\", -- then the program only prints informational message. If you specify as a first command line argument \"-v\", then -- the program only prints its version number. If you specify something else, the first command line argument is being treated as--- a name for the resulting file voiced. If you specify further command line arguments +-- a name for the resulting file voiced. If you specify further command line arguments -- as a Ukrainian text, that contains only those sounds, which sound representations are in the current directory (you can create them by e. g. @mmsyn7ukr@ and @mmsyn7l@ -- programs in the same name packages), then the program will use only these sounds representations additionally to the default ones \"-.wav\", -- \"0.wav\" and \"1.wav\" and produce the sounding for the text.@@ -62,9 +63,9 @@           putStrLn ""           return (args, nameSF)) (\(args, nameSF) -> do             putStr "Notice, there was (may be) CmdLineArgument exception. To avoid it, please, specify the second command line argument (if needed) in the form \"ABC\""-            putStrLn $ " where A is either a letter \'f\', \'o\', \'w\' or a digit and B and C are both digits! The exception (may be) arose from the command line arguments " +            putStrLn $ " where A is either a letter \'f\', \'o\', \'w\' or a digit and B and C are both digits! The exception (may be) arose from the command line arguments "               ++ show args ++ " for the file: " ++ show nameSF ++ ". Please, check also whether the SoX was installed with the support for needed codec.")-              (\(args, nameSF) -> do +              (\(args, nameSF) -> do                 let arg = drop 1 . take 2 $ args                 if (not . null . drop 2 $ args)                   then do@@ -77,20 +78,20 @@                     withBinaryFile (nameSF ++ ".raw") AppendMode (appendS16LEFileList (convertToProperUkrainian ys, show7s xs))                     putStrLn "The .raw file was created by the program. It will be processed further. "                     let ts = fromJust (showE "sox") in do-                      _ <- readProcessWithExitCode ts (case fst ws of +                      _ <- readProcessWithExitCode ts (case fst ws of                              "" -> ["-r22050","-c1","-L","-esigned-integer","-b16", nameSF ++ ".raw", nameSF ++ snd ws]                              _  -> ["-r22050","-c1","-L","-esigned-integer","-b16", nameSF ++ ".raw", fst ws, nameSF ++ snd ws]) ""                       removeFile $ nameSF ++ ".raw"-                      if take 5 os == "mingw" -                        then do +                      if take 5 os == "mingw"+                        then do                           _ <- readProcessWithExitCode (fromJust . showE $ "sox") [nameSF ++ snd ws, "-t", "waveaudio", "-d"] ""                           return ()-                        else if isJust . showE $ "play" +                        else if isJust . showE $ "play"                                then do                                  _ <- readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ snd ws] ""                                  return ()                                else catchEnd ExecutableNotProperlyInstalled-                else do +                else do                   [xs, wws] <- mapM defineClean ([0,1]::[Int])                   if wws == "y" then do                     let ys = take (nSymbols (if null arg then [] else fst . genControl . head $ arg)) xs@@ -98,33 +99,33 @@                     putStrLn "The .raw file was created by the program. It will be processed further. "                     let ts = fromJust (showE "sox") in do                       let ws = snd . genControl . concat $ arg-                      _ <- readProcessWithExitCode ts ["-r22050","-c1","-L","-esigned-integer","-b16", nameSF ++ ".raw", +                      _ <- readProcessWithExitCode ts ["-r22050","-c1","-L","-esigned-integer","-b16", nameSF ++ ".raw",                              fst ws, nameSF ++ snd ws] ""                       removeFile $ nameSF ++ ".raw"-                      if take 5 os == "mingw" -                        then do +                      if take 5 os == "mingw"+                        then do                           _ <- readProcessWithExitCode (fromJust . showE $ "sox") [nameSF ++ snd ws, "-t", "waveaudio", "-d"] ""                           cleanCreatedSoundFs-                        else if isJust . showE $ "play" +                        else if isJust . showE $ "play"                                then do                                  _ <- readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ snd ws] ""                                  cleanCreatedSoundFs                                else catchEnd ExecutableNotProperlyInstalled-                  else do +                  else do                     let ws = snd . genControl . concat $ arg                         ys = take (nSymbols (if null arg then [] else fst . genControl . head $ arg)) xs                     withBinaryFile (nameSF ++ ".raw") AppendMode (appendS16LEFile (convertToProperUkrainian ys))                     putStrLn "The .raw file was created by the program. It will be processed further. "                     let ts = fromJust (showE "sox") in do-                      _ <- readProcessWithExitCode ts (case fst ws of +                      _ <- readProcessWithExitCode ts (case fst ws of                              "" -> ["-r22050","-c1","-L","-esigned-integer","-b16", nameSF ++ ".raw", nameSF ++ snd ws]                              _  -> ["-r22050","-c1","-L","-esigned-integer","-b16", nameSF ++ ".raw", fst ws, nameSF ++ snd ws]) ""                       removeFile $ nameSF ++ ".raw"-                      if take 5 os == "mingw" -                        then do +                      if take 5 os == "mingw"+                        then do                           _ <- readProcessWithExitCode (fromJust . showE $ "sox") [nameSF ++ snd ws, "-t", "waveaudio", "-d"] ""                           return ()-                        else if isJust . showE $ "play" +                        else if isJust . showE $ "play"                                then readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ snd ws] "" >> return ()                                else catchEnd ExecutableNotProperlyInstalled) @@ -132,7 +133,7 @@ giveInfo :: IO () giveInfo = do   dir <- getCurrentDirectory-  putStrLn "You are now in the directory: " +  putStrLn "You are now in the directory: "   putStrLn $ show dir   putStrLn ""   putStr "You could specify a name of the resulting file and then the control parameters for the output speech file as "@@ -148,7 +149,7 @@  -- | Used internally in the 'main7h' function for specifying whether clean the current directory from the sound files. defineClean :: Int -> IO String-defineClean x +defineClean x   | x == 0 = onException (do      putStrLn ""      putStr "The resulting file will be played just after it is created by the program. "@@ -169,22 +170,22 @@  -- | The function that actually produces a .raw file. The mapping table is given in the @Map.txt@ file, but the sound duration differs. appendS16LEFile ::  V.Vector String -> Handle -> IO ()-appendS16LEFile xs hdl | not (V.null xs) = +appendS16LEFile xs hdl | not (V.null xs) =   do-    dataList <- (V.mapM takeData . V.fromList) ["-.wav", "0.wav", "1.wav", "A.wav", "B.wav", "C.wav", "D.wav", "E.wav", "F.wav", "G.wav", "H.wav", -        "I.wav", "J.wav", "K.wav", "L.wav", "M.wav", "N.wav", "O.wav", "P.wav", "Q.wav", "R.wav", -          "S.wav", "T.wav", "U.wav", "V.wav", "W.wav", "X.wav", "Y.wav", "Z.wav", "a.wav", "b.wav", "c.wav", -            "d.wav", "e.wav", "f.wav"]-    V.mapM_ (\u -> -      if V.all (\z -> B.length z > 0) dataList +    dataList <- V.mapM takeData (V.fromList ["-.wav", "0.wav", "1.wav", "A.wav", "B.wav", "C.wav", "D.wav", "E.wav", "F.wav", "G.wav", "H.wav",+        "I.wav", "J.wav", "K.wav", "L.wav", "M.wav", "N.wav", "O.wav", "P.wav", "Q.wav", "R.wav",+          "S.wav", "T.wav", "U.wav", "V.wav", "W.wav", "X.wav", "Y.wav", "Z.wav", "a.wav", "b.wav", "c.wav",+            "d.wav", "e.wav", "f.wav"])+    V.mapM_ (\u ->+      if V.all (\z -> BS.length z > 0) dataList         then let rs =  tail . dropWhile (/= ' ') . takeWhile (/= '}') . show $ hdl in do           hClose hdl           closedHdl <- hIsClosed hdl-          if closedHdl -            then B.appendFile rs $ dataList V.! getBFst' (0, V.fromList [("-", 0), ("0", 1), ("1", 2), ("а", 3), ("б", 4), -                     ("в", 5), ("г", 6), ("д", 7), ("дж", 8), ("дз", 9), ("е", 10), ("ж", 11), ("з", 12), ("и", 13), -                        ("й", 14), ("к", 15), ("л", 16), ("м", 17), ("н", 18), ("о", 19), ("п", 20), ("р", 21), -                          ("с", 22), ("сь", 23), ("т", 24), ("у", 25), ("ф", 26), ("х", 27), ("ц", 28), ("ць", 29), ("ч", 30), +          if closedHdl+            then BS.appendFile rs $ dataList V.! getBFst' (0, V.fromList [("-", 0), ("0", 1), ("1", 2), ("а", 3), ("б", 4),+                     ("в", 5), ("г", 6), ("д", 7), ("дж", 8), ("дз", 9), ("е", 10), ("ж", 11), ("з", 12), ("и", 13),+                        ("й", 14), ("к", 15), ("л", 16), ("м", 17), ("н", 18), ("о", 19), ("п", 20), ("р", 21),+                          ("с", 22), ("сь", 23), ("т", 24), ("у", 25), ("ф", 26), ("х", 27), ("ц", 28), ("ць", 29), ("ч", 30),                             ("ш", 31), ("ь", 32), ("і", 33), ("ґ", 34)]) u             else catchEnd (DataFileNotClosed (show hdl))         else catchEnd (DataSoundFileNotRead "")) xs@@ -194,27 +195,27 @@ -- | The function that actually produces a .raw file. The mapping table is that one given in the @Map.txt@ file but not all sounds and files are present. -- The @[String]@ parameter is a sorted list of Ukrainian sounds to be used (for example, it can be obtained with @mmsyn7s@ executable from the same name package). appendS16LEFileList :: (V.Vector String, [String]) -> Handle -> IO ()-appendS16LEFileList (xs, yss) hdl | not (V.null xs) && not (null yss) = +appendS16LEFileList (xs, yss) hdl | not (V.null xs) && not (null yss) =   do     let intrm = map (getBFst' ("0.wav", V.fromList . zip ["а","б","в","г","д","дж","дз","е","ж","з","и","й","к","л","м","н","о","п","р","с",-                       "сь","т","у","ф","х","ц","ць","ч","ш","ь","і","ґ"] $ ["A.wav", "B.wav", "C.wav", "D.wav", "E.wav", "F.wav", "G.wav", "H.wav", -                         "I.wav", "J.wav", "K.wav", "L.wav", "M.wav", "N.wav", "O.wav", "P.wav", "Q.wav", "R.wav", -                           "S.wav", "T.wav", "U.wav", "V.wav", "W.wav", "X.wav", "Y.wav", "Z.wav", "a.wav", "b.wav", "c.wav", +                       "сь","т","у","ф","х","ц","ць","ч","ш","ь","і","ґ"] $ ["A.wav", "B.wav", "C.wav", "D.wav", "E.wav", "F.wav", "G.wav", "H.wav",+                         "I.wav", "J.wav", "K.wav", "L.wav", "M.wav", "N.wav", "O.wav", "P.wav", "Q.wav", "R.wav",+                           "S.wav", "T.wav", "U.wav", "V.wav", "W.wav", "X.wav", "Y.wav", "Z.wav", "a.wav", "b.wav", "c.wav",                              "d.wav", "e.wav", "f.wav"])) yss     dataList <- (V.mapM takeData . V.fromList) (["-.wav", "0.wav", "1.wav"] ++ intrm)-    V.mapM_ (\u -> -      if V.all (\z -> B.length z > 0) dataList +    V.mapM_ (\u ->+      if V.all (\z -> BS.length z > 0) dataList         then let rs =  tail . dropWhile (/= ' ') . takeWhile (/= '}') . show $ hdl in do           hClose hdl           closedHdl <- hIsClosed hdl-          if closedHdl -            then B.appendFile rs $ dataList V.! getBFst' (0, V.fromList $ [("-", 0), ("0", 1), ("1", 2)] ++ zip yss [3..]) u+          if closedHdl+            then BS.appendFile rs $ dataList V.! getBFst' (0, V.fromList $ [("-", 0), ("0", 1), ("1", 2)] ++ zip yss [3..]) u             else catchEnd (DataFileNotClosed (show hdl))         else catchEnd (DataSoundFileNotRead "")) xs     hClose hdl                                   | otherwise = return () --- | Function that removes all the sounds with ".raw", ".wav", ".ogg", ".flac" extensions in the current directory. It is used for +-- | Function that removes all the sounds with ".raw", ".wav", ".ogg", ".flac" extensions in the current directory. It is used for -- the security reasons. cleanCreatedSoundFs :: IO () cleanCreatedSoundFs = do
mmsyn7h.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                mmsyn7h-version:             0.8.0.0+version:             0.8.1.0 synopsis:            Produces a sound recording specified by the Ukrainian text. description:         A program and a library that are used with mmsyn7ukr (or separately) and are similar to mmsyn6ukr executable. The program uses the data files in the current directory instead of ones in the system defined directories. It reads Ukrainian text with the given by data files sounds. homepage:            https://hackage.haskell.org/package/mmsyn7h@@ -20,16 +20,16 @@   exposed-modules:     MMSyn7h, Main   -- other-modules:   -- other-extensions:-  build-depends:       base >=4.7 && <4.15, process >=1.4 && <1.9, vector >=0.11 && <0.14, bytestring >=0.10 && < 0.13, mmsyn2 >=0.1.8 && <1, directory >=1.2.5 && <1.5, mmsyn6ukr >=0.8 && <1, mmsyn3 >=0.1.5 && <1, mmsyn7s >=0.8 && <1, mmsyn7ukr >=0.17 && <1+  build-depends:       base >=4.7 && <4.15, process >=1.4 && <1.9, vector >=0.11 && <0.14, bytestring >=0.10 && < 0.13, mmsyn2 >=0.1.8 && <1, directory >=1.2.5 && <1.5, mmsyn6ukr >=0.9 && <1, mmsyn3 >=0.1.5 && <1, mmsyn7s >=0.8 && <1, mmsyn7ukr >=0.17 && <1   -- hs-source-dirs:   default-language:    Haskell2010   executable mmsyn7h   main-is:             Main.hs-  -- other-modules:+  other-modules:       MMSyn7h   -- other-extensions:-  build-depends:       base >=4.7 && <4.15, process >=1.4 && <1.9, vector >=0.11 && <0.14, bytestring >=0.10 && < 0.13, mmsyn2 >=0.1.8 && <1, directory >=1.2.5 && <1.5, mmsyn6ukr >=0.8 && <1, mmsyn3 >=0.1.5 && <1, mmsyn7s >=0.8 && <1, mmsyn7ukr >=0.17 && <1-  ghc-options:         -threaded  +  build-depends:       base >=4.7 && <4.15, process >=1.4 && <1.9, vector >=0.11 && <0.14, bytestring >=0.10 && < 0.13, mmsyn2 >=0.1.8 && <1, directory >=1.2.5 && <1.5, mmsyn6ukr >=0.9 && <1, mmsyn3 >=0.1.5 && <1, mmsyn7s >=0.8 && <1, mmsyn7ukr >=0.17 && <1+  ghc-options:         -threaded   -- hs-source-dirs:   default-language:    Haskell2010