packages feed

mmsyn6ukr 0.7.0.0 → 0.7.1.0

raw patch · 4 files changed

+50/−25 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Melodics.Executable: workWithInput :: String -> String -> IO ()
+ Melodics.Executable: workWithInput :: String -> Int -> IO ()

Files

ChangeLog.md view
@@ -135,3 +135,7 @@ * Seventh version. Changed the module structure (and some functions accordinly, too) to more logical and convenient for factorization and composition.  Added a new module Melodics.Executable with the most of the Main module processment functions. Changed the behaviour of the executable  into repeated so you can create many files with it during one runtime operation. ++## 0.7.1.0 -- 2020-05-12++* Seventh version revised A. Fixed issues with being not circled because of the semi-closed handles. 
Main.hs view
@@ -21,9 +21,12 @@ -- and tries to automatically convert it to the .wav, .ogg, or .flac file with the same parameters specified by the first command line argument -- (for more details see: 'genControl' function) using the system binary SoX (this is done for one circle of running, afterwards it is repeated  -- with the same command line arguments. To stop execution, please, interrupt the program e. g. with Ctrl + C on many Unix platforms). --- If it is not installed properly, the program makes ending informational message for the user. +-- So actually, it can create multiple sound files, all in the same format options specified by the first command line argument accordingly to +-- the 'genControl' function.+--+-- If SoX binaries are not installed properly, the program makes ending informational message for the user.  -- --- Command line argument is described in more details in the documentation for the 'Melodics.Ukrainian.nSymbols' function. +-- The command line argument is described in more details in the documentation for the 'Melodics.Ukrainian.nSymbols' function.  --  -- * Notification. -- 
Melodics/Executable.hs view
@@ -8,7 +8,13 @@ -- especially for poets, translators and writers.  -- -module Melodics.Executable where+module Melodics.Executable (+  circle+  , workWithInput+  , rawToSoundFile+  , printInfoF+)+where  import Data.Char (isSpace, isControl) import Data.Maybe (isJust,fromJust,fromMaybe)@@ -16,37 +22,49 @@ import System.IO.Unsafe (unsafePerformIO) import System.Process (callProcess) import System.Directory (removeFile,findExecutable)-import Control.Exception (bracketOnError)+import Control.Exception (onException) import EndOfExe (showE) import Melodics.Ukrainian (appendS16LEFile, convertToProperUkrainian) import UkrainianLControl  -- | Is used to repeat the cycle of creation of the sound files in the current directory for the @mmsyn6ukr@  executable.  circle :: String -> IO ()-circle zs = bracketOnError (do-  putStrLn "Please, specify the name of the resulting sound file. Please, do NOT use '}' character and space or control characters!"-  nameOfSoundFile <- getLine-  let nameSF = filter (\x -> not (isSpace x) && not (isControl x) && x /= '}') nameOfSoundFile-  return (zs, nameSF)) (\(zs, nameSF) -> do+circle zs = onException (mapM_ (workWithInput zs) [1..]) (do     putStr "Notice, there was (may be) CmdLineArgument exception. To avoid it, please, specify the command line argument (if needed) in the form \"ABC\""     putStr " 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 "-    putStrLn $ "the command line arguments " ++ show zs ++ " for the file: " ++ show nameSF ++ -       ". Please, check also whether the SoX was installed with the support for needed codec.") -        (\(zs, nameSF) -> workWithInput zs nameSF >> circle zs)+    putStrLn $ "the command line arguments " ++ show zs ++ ". Please, check also whether the SoX was installed with the support for needed codec.")   -- | Interactively creates sound files in the current directory for the Ukrainian text input. Is used internally in the 'circle'-workWithInput :: String -> String -> IO ()-workWithInput zs nameSF - | null nameSF = putStrLn "The program circles now because there is no valid file name provided to be created. "- | otherwise = do-     xs <- getContents-     let ys = take (nSymbols . fst . genControl $ zs) xs-     withBinaryFile (nameSF ++ ".raw") AppendMode (appendS16LEFile (convertToProperUkrainian ys))-     putStrLn "The .raw file was created by the program. If there is SoX installed then it will run further. "-     let ts = showE "sox" -     if isJust ts-       then rawToSoundFile zs nameSF (fromJust ts)-       else printInfoF+workWithInput :: String -> Int -> IO ()+workWithInput zs j = do+  [nameSF,ys] <- nameAndControl zs [1,2]+  withBinaryFile (nameSF ++ ".raw") AppendMode (appendS16LEFile (convertToProperUkrainian ys))+  putStrLn "The .raw file was created by the program. If there is SoX installed then it will run further. "+  let ts = showE "sox" +  if isJust ts+    then rawToSoundFile zs nameSF (fromJust ts)+    else printInfoF++recFileName :: IO String+recFileName = do +  putStrLn "Please, specify the name of the resulting sound file. Please, do NOT use '}' character and space or control characters!"+  nameOfSoundFile <- getLine+  let nameSF = filter (\x -> not (isSpace x) && not (isControl x) && x /= '}') nameOfSoundFile+  return nameSF+  +getCtrl :: String -> IO String+getCtrl zs = do+  xs <- getLine+  let ys = take (nSymbols . fst . genControl $ zs) xs+  return ys++recFNAndCtrl :: String -> Int -> IO String+recFNAndCtrl zs n+  | odd n = recFileName +  | otherwise = getCtrl zs++nameAndControl :: String -> [Int] -> IO [String]+nameAndControl zs = mapM (recFNAndCtrl zs)  -- | Converts RAW sound to the sound file of the needed format in the current directory accordingly to the 'genControl' for the first 'String' argument.  -- Is used internally in the 'workWithInput'.
mmsyn6ukr.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                mmsyn6ukr-version:             0.7.0.0+version:             0.7.1.0 synopsis:            A musical instrument synthesizer or a tool for Ukrainian language listening description:         A program can be used as a musical instrument synthesizer or for Ukrainian speech synthesis especially for poets and writers homepage:            https://hackage.haskell.org/package/mmsyn6ukr