mmsyn7h 0.2.2.1 → 0.3.0.0
raw patch · 4 files changed
+32/−14 lines, 4 files
Files
- ChangeLog.md +4/−0
- MMSyn7h.hs +26/−12
- Main.hs +1/−1
- mmsyn7h.cabal +1/−1
ChangeLog.md view
@@ -19,3 +19,7 @@ ## 0.2.2.1 -- 2019-12-28 * Second version revised C. Some minor documentation improvements.++## 0.3.0.0 -- 2020-01-05++* Third version. Added support for Windows playing the resulting file. Fixed an issue with the deprecated documentation.
MMSyn7h.hs view
@@ -1,6 +1,6 @@ -- | -- Module : MMSyn7h--- Copyright : (c) OleksandrZhabenko 2019+-- Copyright : (c) OleksandrZhabenko 2019-2020 -- License : MIT -- -- Maintainer : olexandr543@yahoo.com@@ -13,11 +13,11 @@ module MMSyn7h where import Data.Char (isSpace, isControl)-import Data.Maybe (isJust,fromJust)+import Data.Maybe (isJust, fromJust) import System.IO import System.Environment (getArgs) import System.Process (readProcessWithExitCode)-import System.Directory (removeFile, listDirectory)+import System.Directory (removeFile, listDirectory, getCurrentDirectory) import Control.Exception (bracketOnError) import EndOfExe (showE) import Melodics.Ukrainian (convertToProperUkrainian, takeData)@@ -26,14 +26,18 @@ import qualified Data.ByteString.Lazy as B import Data.List (isSuffixOf) import CaseBi (getBFst')+import System.Info (os) --- | Function that proposes and creates if accepted the sound record with the new \"voice\". Besides it can play the newly created file once. It is used in the--- 'createAndPlayFs' function internally and recursively.+-- | Function that proposes and creates if accepted the sound record with the new \"voice\". Besides it can play the newly created file once. main7h :: IO () main7h = bracketOnError (do+ dir <- getCurrentDirectory+ putStrLn "You are now in the directory: " + putStrLn $ show dir+ putStrLn "" putStrLn "Please, specify the arguments to control the output speech file! " putStrLn "See https://hackage.haskell.org/package/mmsyn6ukr-0.6.2.0/docs/UkrainianLControl.html#v:genControl for more information."- putStrLn "You can specify e. g. \"o9-1\" or \"o5-1\" or other option."+ putStrLn "You can specify e. g. \"o9-1\" or \"o5-1\" (and the most compressed audio in the .ogg format will be produced) or other option." arg <- getArgs let args = take 1 arg in do putStrLn "Please, specify the name of the resulting sound file! Please, do NOT use '}' character and space or control characters!"@@ -59,11 +63,15 @@ _ <- readProcessWithExitCode ts ["-r22050","-c1","-L","-esigned-integer","-b16", nameSF ++ ".raw", fst ws, nameSF ++ snd ws] "" removeFile $ nameSF ++ ".raw"- if isJust . showE $ "play"+ if take 5 os == "mingw" then do - _ <- readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ snd ws] ""+ _ <- readProcessWithExitCode (fromJust . showE $ "sox") [nameSF ++ snd ws, "-t", "waveaudio", "-d"] "" cleanCreatedSoundFs- else error "SoX play is not installed properly in the system. Please, install it properly and execute the program again."+ 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 $ args let ys = take (nSymbols (let zs = take 1 args in if null zs then [] else fst . genControl . head $ zs)) xs in @@ -74,9 +82,15 @@ "" -> ["-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 isJust . showE $ "play"- then 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.")+ 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." -- | 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 ()
Main.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Main--- Copyright : (c) OleksandrZhabenko 2019+-- Copyright : (c) OleksandrZhabenko 2019-2020 -- License : MIT -- -- Maintainer : olexandr543@yahoo.com
mmsyn7h.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn7h-version: 0.2.2.1+version: 0.3.0.0 synopsis: A program and a library that 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