mmsyn7h 0.4.0.0 → 0.4.0.1
raw patch · 4 files changed
+27/−42 lines, 4 files
Files
- ChangeLog.md +5/−0
- MMSyn7h.hs +17/−40
- README +4/−1
- mmsyn7h.cabal +1/−1
ChangeLog.md view
@@ -32,3 +32,8 @@ * Fourth version. Added the possibility to work with not the full set of Ukrainian sounds representations, but with some of them. The program now can use more command line arguments. Added new functions and dependencies.++## 0.4.0.1 -- 2020-01-10++* Fourth version revised A. Fixed an issue with the more than three command line arguments. The program now plays the file in such a+case and does not remove any resulting sound files.
MMSyn7h.hs view
@@ -29,9 +29,10 @@ import System.Info (os) import MMSyn7s (show7s) --- | Function that proposes and creates if accepted the sound record with the new \"voice\". Besides it can play the newly created file once and can delete --- the sound files in the current directory. If you specify the second command line argument \"s\" and then a list of @String@ represented the Ukrainian sounds, --- then the program will use only these sounds representations additionally to the default ones \"-.wav\", \"0.wav\" and \"1.wav\".+-- | 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 if you specified only one command line argument. If you specify the second command line argument \"s\" +-- and then a list of @String@ represented the Ukrainian sounds, then the program will use only these sounds representations additionally +-- to the default ones \"-.wav\", \"0.wav\" and \"1.wav\". main7h :: IO () main7h = bracketOnError (do dir <- getCurrentDirectory@@ -54,48 +55,24 @@ if (not . null . drop 2 $ args) && ((concat . drop 1 . take 2 $ args) == "s") then do putStrLn ""- putStr "The resulting file will be played just after it is created by the program. To remove all the created sound files from the directory, "- putStrLn "please, specify now the first character in the input as \"0\". Otherwise, the program will not remove any records (if they are not overwritten). "- putStrLn ""- putStrLn "Now enter the Ukrainian text."+ putStr "The resulting file will be played just after it is created by the program. " putStrLn ""- xs <- getContents- if take 1 xs == "0" then do- let ys = take (nSymbols (if null arg then [] else fst . genControl . head $ arg)) (drop 1 xs) in - withBinaryFile (nameSF ++ ".raw") AppendMode (appendS16LEFileList (convertToProperUkrainian ys, show7s . unwords . drop 2 $ args))- 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", - fst ws, nameSF ++ snd ws] ""- removeFile $ nameSF ++ ".raw"- if take 5 os == "mingw" - then do - _ <- readProcessWithExitCode (fromJust . showE $ "sox") [nameSF ++ snd ws, "-t", "waveaudio", "-d"] ""- cleanCreatedSoundFs- else if isJust . showE $ "play" - then do- _ <- readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ snd ws] ""- cleanCreatedSoundFs- else error "SoX play is not installed properly in the system. Please, install it properly and execute the program again."- else do - let ws = snd . genControl . concat $ arg- let ys = take (nSymbols (if null arg then [] else fst . genControl . head $ arg)) xs in - withBinaryFile (nameSF ++ ".raw") AppendMode (appendS16LEFileList (convertToProperUkrainian ys, show7s . unwords . drop 2 $ args))- 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 + let xs = unwords . drop 2 $ args+ ws = snd . genControl . concat $ arg+ ys = take (nSymbols (if null arg then [] else fst . genControl . head $ arg)) xs in + 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 "" -> ["-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" + removeFile $ nameSF ++ ".raw"+ if take 5 os == "mingw" then do - _ <- readProcessWithExitCode (fromJust . showE $ "sox") [nameSF ++ snd ws, "-t", "waveaudio", "-d"] ""- cleanCreatedSoundFs+ _ <- readProcessWithExitCode (fromJust . showE $ "sox") [nameSF ++ snd ws, "-t", "waveaudio", "-d"] "" >> return () else if isJust . showE $ "play" then do- _ <- readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ snd ws] ""- cleanCreatedSoundFs+ _ <- readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ snd ws] "" >> return () else error "SoX play is not installed properly in the system. Please, install it properly and execute the program again." else do putStrLn ""@@ -125,7 +102,7 @@ else error "SoX play is not installed properly in the system. Please, install it properly and execute the program again." else do let ws = snd . genControl . concat $ arg- let ys = take (nSymbols (if null arg then [] else fst . genControl . head $ arg)) xs in + ys = take (nSymbols (if null arg then [] else fst . genControl . head $ arg)) xs in 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
README view
@@ -5,8 +5,11 @@ needed files and to produce them by some other means (e. g. by mmsyn7ukr). Besides, you can remove the created by mmsyn7ukr and mmsyn7h files-while the last one is running. +while the last one is running, if you specified just one command line +argument. If you specify the second command line argument "s" and then a list of @String@ represented the Ukrainian sounds, then the program will use only these sounds representations additionally to the default ones "-.wav", "0.wav" and "1.wav".+In such a case the program will not delete the created resulting +sound files.
mmsyn7h.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn7h-version: 0.4.0.0+version: 0.4.0.1 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