packages feed

mmsyn6ukr 0.5.2.0 → 0.6.0.0

raw patch · 4 files changed

+76/−57 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Main: genControl :: String -> (String, (String, String))
- Main: nSymbols :: String -> Int
+ UkrainianLControl: genControl :: String -> (String, (String, String))
+ UkrainianLControl: nSymbols :: String -> Int

Files

ChangeLog.md view
@@ -95,3 +95,8 @@  * Fifth version revised B. Added support for better pauses and therefore additional file "-.wav". Fixed issues with the conversion in case of punctuation separated words.  Added additional information about sound files. Deprecated (===) operator in favour of `elem` function.++## 0.6.0.0 -- 2019-12-18++* Sixth version. Changed the module structure.+
Main.hs view
@@ -9,26 +9,19 @@ -- especially for poets, translators and writers.  -- -module Main (-  main,-  -- * Control the program-  genControl,-  -- * Security and Limits-  nSymbols-) where+module Main where -import Data.Char (isSpace, isControl,isDigit)+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 (callProcess) import System.Directory (removeFile,findExecutable)-import qualified Data.Vector as V import Control.Exception (bracketOnError)-import CaseBi (getBFst') import EndOfExe (showE) import Melodics.Ukrainian (appendS16LEFile, convertToProperUkrainian)+import UkrainianLControl  {- -- Inspired by: https://mail.haskell.org/pipermail/beginners/2011-October/008649.html@@ -88,48 +81,3 @@                          putStrLn ""                          putStrLn "OR you can install SoX executable in the directory mentioned in the variable PATH and then run: "                          putStrLn "\"Path_to_the_SoX_executable\" -b16 -r22050 -c1 -e signed-integer -L \"name_of_the_file_in_raw_format_with_new._prefix\" \"name_of_the_file_in_raw_format_with_new._prefix\" in the terminal.")---- | Function that converts the first digit in the command line argument (starting the argument or being the second one after the letter character) given, --- which is a digit in the range @[0..9]@ (providing an ascending approximately exponential scale with a basis of 10 starting from 2 and ending at 1000000001), --- to the upper bound of number of symbols that the 'main' function of the @mmsyn6ukr@ executable reads from the 'System.IO.stdin' for sounding.--- The default resulting value (no input) is 31416. If there is another first command line argument then the program --- terminates with the informational message. Using the command line argument is done for the security reasons: --- because of performative writing to the resulting file(s) there is a need to limit the used memory. For most cases it is--- enough to use the default value. If you have enough resources and a large Ukrainian text amount then specify the higher values --- (5 or a greater one). -nSymbols :: String -> Int-nSymbols xs | null xs = 31416::Int-            | otherwise = getBFst' (31416::Int, V.generate 10 (\n -> (n, (10^n + 1)::Int))) (let temp = read xs::Int in if temp <= 9 && temp >= 0-                            then temp -                            else error "Please, specify a digit as a command line argument for the program!")---- | Function that prepares arguments for the controlling functions for the executable @mmsyn6ukr@. It takes a first command line argument and makes --- an analysis to produce a set of String. The first resulting String is an argument to 'nSymbols' function, the first in the inner tuple is an argument--- to the compression level for the comressed formats and the last one is the resulting file extension. The default value (no command line arguments) is--- @("", ("", ".wav"))@. Please, specify the command line argument (if needed) in the form \"ABC\""--- where A is either a letter \'f\', \'o\', \'w\' or a digit and B and C are both digits (or something equivalent, see below). --- --- Their meaning:--- --- A:--- --- \'f\' -> native FLAC format with compression from 0 (least) to 8 (best compression ratio) specified by the third characters; \'9\' is equivalent to \'8\'. This format is optional so, --- please, check whether it is supported by your SoX binaries. If no, install the SoX with support for the format. For more information, please, refer to the @sox@ documentation.--- --- \'o\' -> Ogg Vorbis format with compression from -1 (best) to 10 (least) specified by the characters after the first two characters. The default value is "-1". This format is optional --- so, please, check whether it is supported by your SoX binaries. If no, install the SoX with support for the format. For more information, please, refer to the @sox@ documentation.--- --- \'w\' -> WAV format with two options for bitrate - 11025 if the third character is less than '5' and greater than '0' and otherwise 22050 (the default one also for no command line arguments). --- --- If A is a digit, then it is used accordingly to 'nSymbols' function and SoX (if properly installed) quickly converts the .raw file to the default .wav with 22050 Hz bitrate.--- --- To obtain the best compression ratio, please specify something like \"o9-1\" or \"o5-1\" (or similar). For the best lossless compression - \"f98\" or \"f58\" (or similar). --- --- For more information, please, see the @sox@ manuals (e. g. for @soxformat@).-genControl :: String -> (String, (String, String))-genControl (x:xs) | x == 'f' = ([head xs], ("-C" ++ (if (compare (tail xs) "9" /= GT) && (compare (tail xs) "0" /= LT) then take 1 . tail $ xs else "8"), ".flac"))-                  | x == 'o' = ([head xs], ("-C" ++ (if ((compare (tail xs) "9" /= GT) && (compare (tail xs) "0" /= LT)) then take 1 . tail $ xs else if (tail xs == "10") then "10" else "-1"), ".ogg"))-                  | x == 'w' = ([head xs], ("-r" ++ (if ((compare (tail xs) "4" /= GT) && (compare (tail xs) "0" /= LT)) then "11025" else "22050"), ".wav"))-                  | isDigit x = ([x], ("", ".wav"))-                  | otherwise = ("", ("", ".wav"))-genControl [] = ("", ("", ".wav"))
+ UkrainianLControl.hs view
@@ -0,0 +1,66 @@+-- |+-- Module      :  UkrainianLControl+-- Copyright   :  (c) OleksandrZhabenko 2019+-- License     :  MIT+--+-- Maintainer  :  olexandr543@yahoo.com+--+-- A program and a library that can be used as a musical instrument synthesizer or for Ukrainian speech synthesis +-- especially for poets, translators and writers. +--++module UkrainianLControl (+  -- * Control the program+  genControl,+  -- * Security and Limits+  nSymbols+) where++import Data.Char (isDigit)+import qualified Data.Vector as V (generate)+import CaseBi (getBFst')++-- | Function that converts the first digit in the command line argument (starting the argument or being the second one after the letter character) given, +-- which is a digit in the range @[0..9]@ (providing an ascending approximately exponential scale with a basis of 10 starting from 2 and ending at 1000000001), +-- to the upper bound of number of symbols that the 'main' function of the @mmsyn6ukr@ executable reads from the 'System.IO.stdin' for sounding.+-- The default resulting value (no input) is 31416. If there is another first command line argument then the program +-- terminates with the informational message. Using the command line argument is done for the security reasons: +-- because of performative writing to the resulting file(s) there is a need to limit the used memory. For most cases it is+-- enough to use the default value. If you have enough resources and a large Ukrainian text amount then specify the higher values +-- (5 or a greater one). +nSymbols :: String -> Int+nSymbols xs | null xs = 31416::Int+            | otherwise = getBFst' (31416::Int, V.generate 10 (\n -> (n, (10^n + 1)::Int))) (let temp = read xs::Int in if temp <= 9 && temp >= 0+                            then temp +                            else error "Please, specify a digit as a command line argument for the program!")++-- | Function that prepares arguments for the controlling functions for the executable @mmsyn6ukr@. It takes a first command line argument and makes +-- an analysis to produce a set of String. The first resulting String is an argument to 'nSymbols' function, the first in the inner tuple is an argument+-- to the compression level for the comressed formats and the last one is the resulting file extension. The default value (no command line arguments) is+-- @("", ("", ".wav"))@. Please, specify the command line argument (if needed) in the form \"ABC\""+-- where A is either a letter \'f\', \'o\', \'w\' or a digit and B and C are both digits (or something equivalent, see below). +-- +-- Their meaning:+-- +-- A:+-- +-- \'f\' -> native FLAC format with compression from 0 (least) to 8 (best compression ratio) specified by the third characters; \'9\' is equivalent to \'8\'. This format is optional so, +-- please, check whether it is supported by your SoX binaries. If no, install the SoX with support for the format. For more information, please, refer to the @sox@ documentation.+-- +-- \'o\' -> Ogg Vorbis format with compression from -1 (best) to 10 (least) specified by the characters after the first two characters. The default value is "-1". This format is optional +-- so, please, check whether it is supported by your SoX binaries. If no, install the SoX with support for the format. For more information, please, refer to the @sox@ documentation.+-- +-- \'w\' -> WAV format with two options for bitrate - 11025 if the third character is less than '5' and greater than '0' and otherwise 22050 (the default one also for no command line arguments). +-- +-- If A is a digit, then it is used accordingly to 'nSymbols' function and SoX (if properly installed) quickly converts the .raw file to the default .wav with 22050 Hz bitrate.+-- +-- To obtain the best compression ratio, please specify something like \"o9-1\" or \"o5-1\" (or similar). For the best lossless compression - \"f98\" or \"f58\" (or similar). +-- +-- For more information, please, see the @sox@ manuals (e. g. for @soxformat@).+genControl :: String -> (String, (String, String))+genControl (x:xs) | x == 'f' = ([head xs], ("-C" ++ (if (compare (tail xs) "9" /= GT) && (compare (tail xs) "0" /= LT) then take 1 . tail $ xs else "8"), ".flac"))+                  | x == 'o' = ([head xs], ("-C" ++ (if ((compare (tail xs) "9" /= GT) && (compare (tail xs) "0" /= LT)) then take 1 . tail $ xs else if (tail xs == "10") then "10" else "-1"), ".ogg"))+                  | x == 'w' = ([head xs], ("-r" ++ (if ((compare (tail xs) "4" /= GT) && (compare (tail xs) "0" /= LT)) then "11025" else "22050"), ".wav"))+                  | isDigit x = ([x], ("", ".wav"))+                  | otherwise = ("", ("", ".wav"))+genControl [] = ("", ("", ".wav"))
mmsyn6ukr.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                mmsyn6ukr-version:             0.5.2.0+version:             0.6.0.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@@ -18,7 +18,7 @@ cabal-version:       >=1.10  library-  exposed-modules:     Paths_mmsyn6ukr, Main, Melodics.Ukrainian+  exposed-modules:     Paths_mmsyn6ukr, Main, Melodics.Ukrainian, UkrainianLControl   -- other-modules:       Melodics.Ukrainian   -- other-extensions:   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