mmsyn7h 0.1.0.0 → 0.2.0.0
raw patch · 4 files changed
+24/−6 lines, 4 files
Files
- ChangeLog.md +3/−0
- Main.hs +18/−5
- README +2/−0
- mmsyn7h.cabal +1/−1
ChangeLog.md view
@@ -4,3 +4,6 @@ * First version. Released on an unsuspecting world. +## 0.2.0.0 -- 2019-12-25++* Second version. Changed the behaviour of the program.
Main.hs view
@@ -18,13 +18,14 @@ import System.IO import System.Environment (getArgs) import System.Process (readProcessWithExitCode)-import System.Directory (removeFile)+import System.Directory (removeFile, listDirectory) import Control.Exception (bracketOnError) import EndOfExe (showE) import Melodics.Ukrainian (convertToProperUkrainian, takeData) import UkrainianLControl import qualified Data.Vector as V import qualified Data.ByteString.Lazy as B+import Data.List (isSuffixOf) import CaseBi (getBFst') {-@@ -54,10 +55,13 @@ 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 putStrLn ""- putStrLn "If you would like to play the resulting file just after it is created by the program, please, begin the input from the symbol \'1\'. "- putStrLn "In all other cases the file will not be played after creation."+ 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 as 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."+ putStrLn "" xs <- getContents- if take 1 xs == "1" then do+ if take 1 xs == "0" then do let ys = take (nSymbols (let zs = take 1 args in if null zs then [] else fst . genControl . head $ zs)) (drop 1 xs) in withBinaryFile (nameSF ++ ".raw") AppendMode (appendS16LEFile (convertToProperUkrainian ys)) putStrLn "The .raw file was created by the program. It will be processed further. "@@ -66,7 +70,9 @@ fst . snd . genControl . concat $ args, nameSF ++ (snd . snd . genControl . concat $ args)] "" removeFile $ nameSF ++ ".raw" if isJust . showE $ "play"- then void (readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ (snd . snd . genControl . concat $ args)] "")+ then do + _ <- readProcessWithExitCode (fromJust . showE $ "play") [nameSF ++ (snd . snd . genControl . concat $ args)] ""+ cleanCreatedSoundFs else error "SoX play is not installed properly in the system. Please, install it properly and execute the program again." else do let ys = take (nSymbols (let zs = take 1 args in if null zs then [] else fst . genControl . head $ zs)) xs in @@ -101,3 +107,10 @@ else error "Data sound file is not read!") 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 +-- the security reasons.+cleanCreatedSoundFs :: IO ()+cleanCreatedSoundFs = do+ dirCs <- listDirectory "."+ let remFs = concatMap (\ys -> filter (\zs -> ys `isSuffixOf` zs) dirCs) [".raw", ".wav", ".ogg", ".flac"] in mapM_ removeFile remFs
README view
@@ -3,3 +3,5 @@ sound files in the current directory. This allows to change the 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+during the latter one running.
mmsyn7h.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn7h-version: 0.1.0.0+version: 0.2.0.0 synopsis: A program that is used in mmsyn7ukr and is similar to mmsyn6ukr executable. description: A program that is used in mmsyn7ukr and is similar to mmsyn6ukr executable. It 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