mmsyn6ukr 0.4.0.6 → 0.4.1.0
raw patch · 3 files changed
+29/−11 lines, 3 filesdep +directoryPVP ok
version bump matches the API change (PVP)
Dependencies added: directory
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Main.hs +22/−8
- mmsyn6ukr.cabal +3/−3
ChangeLog.md view
@@ -66,3 +66,7 @@ ## 0.4.0.6 -- 2019-12-06 * Fourth version revised F. Fixed an issue with the documentation for Main.main function.++## 0.4.1.0 -- 2019-12-06++* Fourth version revised G. Improved the documentation for the Main.main function. Added the possibility to automatically delete the unneeded .raw file.
Main.hs view
@@ -9,15 +9,17 @@ -- especially for poets, translators and writers. -- - module Main ( main ) where +import Data.Char (isSpace, isControl) import Data.Maybe (isJust,fromJust) import System.IO+import System.IO.Unsafe (unsafePerformIO) import System.Environment (getArgs)-import System.Process+import System.Process (callProcess)+import System.Directory (removeFile,findExecutable) import EndOfExe (showE) import Paths_mmsyn6ukr import Melodics.Ukrainian (appendS16LEFile, nSymbols, convertToProperUkrainian)@@ -32,23 +34,35 @@ -- -- Command line argument is described in more details in the documentation for the 'Melodics.Ukrainian.nSymbols' function. -- --- ** Notification.+-- * Notification. -- -- Please, notice that successful usage of the SoX installed in the system prior to the @mmsyn6ukr@ leads to approximately doubling -- the size of used space in the storage for the resulting files because it adds a header to the .raw file and writes down additionally -- the raw data to form a .wav file. Also notice that the size of the largest data file representing a symbol or their combination is 6792 bytes (with 44-byte --- header included). So, if you expect to create sounding for n symbols of the Ukrainian text, provide at least 2 * (6792 - 44) * n + 44 = 13496 * n + 44 (bytes) --- of the additional space in the storage (in reality it can occupy much less because other data files are less in size).+-- header included). So, if you expect to create sounding for @n@ symbols of the Ukrainian text, provide at least @2 * (6792 - 44) * n + 44 = 13496 * n + 44@ (bytes) +-- of the additional space in the storage (in reality it can occupy much less because other data files are less in size). Afterwards, you can delete +-- the .raw file (this will approximately halve the occupied space by the resulting file) and manually compress the .wav file +-- (e. g. FLAC compression with the best ratio gives approxumately halving the size). Therefore, the resulting file +-- for the @mmsyn6ukr@ executable run prior to such operations without command line arguments is expected to be less than about @10^7@ bytes that is about 100 MB +-- (for 31416 symbols Ukrainian text).+ main :: IO () main = do args <- getArgs- putStrLn "Please, specify the name of the resulting sound file! Please, do NOT use '}' character and space characters!"+ 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 xs <- getContents let ys = take (nSymbols (let zs = take 1 args in if null zs then [] else head zs)) xs in - withBinaryFile (nameOfSoundFile ++ ".raw") AppendMode (appendS16LEFile (convertToProperUkrainian ys))+ withBinaryFile (nameSF ++ ".raw") AppendMode (appendS16LEFile (convertToProperUkrainian ys)) let ts = showE "sox" in if isJust ts- then callCommand $ fromJust ts ++ " -r22050 -c1 -L -e signed-integer -b16 " ++ nameOfSoundFile ++ ".raw " ++ nameOfSoundFile ++ ".wav"+ then do + callProcess (fromJust . unsafePerformIO . findExecutable . fromJust $ ts) [" -r22050 -c1 -L -e signed-integer -b16 ", nameSF ++ ".raw ", nameSF ++ ".wav"]+ putStrLn "Would you like to remove a .raw file? (Enter \'y\' to remove. Otherwise, it will not be removed by the program)."+ removeF <- getChar+ if removeF == 'y' + then removeFile $ nameSF ++ ".raw"+ else return () else do putStr "You have a resulting file in a raw PCM format with bitrate 22050 Hz and 1 channel (mono) in the .raw format. " putStr "You can further process it by yourself manually, otherwise, please, install FFMpeg or LibAV executables in the directory mentioned in the variable PATH"
mmsyn6ukr.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: mmsyn6ukr-version: 0.4.0.6+version: 0.4.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@@ -21,7 +21,7 @@ exposed-modules: Paths_mmsyn6ukr, Main, Melodics.Ukrainian -- other-modules: Melodics.Ukrainian -- other-extensions:- build-depends: base >=4.7 && <4.13, process >=1.4 && <1.8, mmsyn3 >=0.1.3.0 && <1, vector >=0.11 && <0.14, bytestring >=0.10 && <0.12, mmsyn2 >=0.1.6.1 && <1, mmsyn5 >=0.4 && <1+ build-depends: base >=4.7 && <4.13, process >=1.4 && <1.8, mmsyn3 >=0.1.3.0 && <1, directory >= 1 && < 1.4, vector >=0.11 && <0.14, bytestring >=0.10 && <0.12, mmsyn2 >=0.1.6.1 && <1, mmsyn5 >=0.4 && <1 -- hs-source-dirs: default-language: Haskell2010 @@ -29,6 +29,6 @@ main-is: Main.hs -- other-modules: -- other-extensions:- build-depends: base >=4.7 && <4.13, process >=1.4 && <1.8, mmsyn3 >=0.1.3.0 && <1, vector >=0.11 && <0.14, bytestring >=0.10 && <0.12, mmsyn2 >=0.1.6.1 && <1, mmsyn5 >=0.4 && <1+ build-depends: base >=4.7 && <4.13, process >=1.4 && <1.8, mmsyn3 >=0.1.3.0 && <1, directory >= 1 && < 1.4, vector >=0.11 && <0.14, bytestring >=0.10 && <0.12, mmsyn2 >=0.1.6.1 && <1, mmsyn5 >=0.4 && <1 -- hs-source-dirs: default-language: Haskell2010