packages feed

mmsyn7l 0.8.0.0 → 0.9.0.0

raw patch · 5 files changed

+44/−46 lines, 5 filesdep +mmsyn2-arraydep +mmsyn7ukr-commondep −mmsyn2dep −mmsyn7ukrdep −vectorPVP ok

version bump matches the API change (PVP)

Dependencies added: mmsyn2-array, mmsyn7ukr-common

Dependencies removed: mmsyn2, mmsyn7ukr, vector

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -89,3 +89,7 @@ ## 0.8.0.0 -- 2020-08-16  * Eighth version. Changed the dependency of mmsyn7ukr bounds.++## 0.9.0.0 -- 2021-02-15++* Ninth version. Removed vector-related dependencies. Some code improvements.
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2020 OleksandrZhabenko+Copyright (c) 2020-2021 OleksandrZhabenko  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
MMSyn7l.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  MMSyn7l--- Copyright   :  (c) OleksandrZhabenko 2020+-- Copyright   :  (c) OleksandrZhabenko 2020-2021 -- License     :  MIT -- Stability   :  Experimental -- Maintainer  :  olexandr543@yahoo.com@@ -15,18 +15,19 @@ import qualified Data.List as L (sort,isPrefixOf,isSuffixOf) import System.Directory import Data.Char (toUpper, isDigit)-import qualified SoXBasics as SB-import qualified SoXBasics1 as SB1-import qualified Data.Vector as V+import qualified Sound.SoXBasics as SB+import qualified Sound.SoXBasics1 as SB1+--import qualified Data.Vector as V+import Data.Maybe (isJust) import Control.Exception (onException)-import CaseBi (getBFst')-import Control.Exception.FinalException+import CaseBi.Arr (getBFstL')+import Sound.Control.Exception.FinalException import System.Process import System.Exit (ExitCode(ExitSuccess)) import EndOfExe (showE) import Data.Maybe (fromJust) import Numeric-+import System.Info (os)  -- | Function 'changeVolume' is used to change the amplitude of the sound.  -- For the proper proceeding you specify a @String@, which consists of 4 @@ -62,10 +63,11 @@ -- (to get it, specify 1).  changeVolume ::  Int -> FilePath -> IO () changeVolume n file = do-  SB.playA file+  case (take 5 os == "mingw") of { True -> if isJust (showE "sox") then readProcessWithExitCode (fromJust (showE "sox"))+    [file, "-t", "waveaudio", "-d"] "" >> return () else catchEnd ExecutableNotProperlyInstalled ; ~rrr -> if isJust (showE "play") then readProcessWithExitCode (fromJust (showE "play")) [file] "" >> return () else catchEnd ExecutableNotProperlyInstalled } -- Is taken from the mmsyn7ukr package as playA.   case n of    1 -> do -    let sound = getBFst' ("е", V.fromList . zip ["A.wav", "B.wav", "C.wav", "D.wav", "E.wav", "F.wav", "G.wav", "H.wav", +    let sound = getBFstL' "е" (zip ["A.wav", "B.wav", "C.wav", "D.wav", "E.wav", "F.wav", "G.wav", "H.wav",           "I.wav", "J.wav", "K.wav", "L.wav", "M.wav", "N.wav", "O.wav", "P.wav", "Q.wav", "R.wav",            "S.wav", "T.wav", "U.wav", "V.wav", "W.wav", "X.wav", "Y.wav", "Z.wav", "a.wav", "b.wav", "c.wav",              "d.wav", "e.wav", "f.wav"] $ ["а","б","в","г","д","дж","дз", "е","ж","з","и","й","к","л","м","н","о","п","р",@@ -172,18 +174,19 @@ adjustVolRes args = do   dir <- listDirectory "."   let dirV0 = L.sort . filter (L.isPrefixOf "result") $ dir-      dirV = V.fromList dirV0       first0 = concat . take 1 $ args       last0  = concat . take 1 . drop 1 $ args-      idxAllN = V.length dirV - 1+      idxAllN = length dirV0 - 1   onException (do {      let first1 = read first0::Int         last1 = read last0::Int         first2 = min (abs first1) (abs last1)         last2 = max (abs first1) (abs last1)-        first = if compare first2 idxAllN == GT then 0 else first2+        first+         | first2 > idxAllN = 0+         | otherwise = first2         l =  if compare last2 idxAllN == GT then idxAllN - first + 1 else last2 - first + 1-     ; V.mapM_ (changeVolume 1) (V.unsafeSlice first l dirV)+     ; mapM_ (changeVolume 1) . take l . drop first $ dirV0      ; putStrLn ""      ; putStrLn "Now you have changed (or left unchanged) the amplitudes for the needed \"result*.wav\" sound files." }) (do          error "Please, specify a right numbers for the first and last files to be adjusted starting count from 0.")@@ -233,7 +236,7 @@ fadeEndsTMN c per1 per2 file   | compare per1 0 == GT && compare per2 0 == GT && compare (per1 + per2) 100 /= GT = do     d0 <- SB.durationA file-    soxE file ["fade", getBFst' ("l", V.fromList [('h',"h"),('p',"p"),('q',"q"),('t',"t")]) c, showFFloat (Just 4) (d0 * per1 / 100.0) "","-0.0", +    soxE file ["fade", getBFstL' "l" [('h',"h"),('p',"p"),('q',"q"),('t',"t")] c, showFFloat (Just 4) (d0 * per1 / 100.0) "","-0.0",        showFFloat (Just 4) (d0 * per2 / 100.0) ""]  | otherwise = error "MMSyn7l.fadeEndsTMN: the percentages sum is out of the (0..100] range. " @@ -266,8 +269,8 @@ wavToFlac :: String -> FilePath -> IO () wavToFlac ys file = do   let (ts,zs) = splitAt 2 . init $ ys-  (code,_,herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file,getBFst' ("-r22050",V.fromList . zip ["11","16", "17", "19", "32", "44", "48",-     "80", "96"] $ ["-r11025","-r16000","-r176400","-r192000","-r32000","-r44100","-r48000","-r8000","-r96000"]) ts, if zs == "2" then "-b24"+  (code,_,herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file,getBFstL' "-r22050" (zip ["11","16", "17", "19", "32", "44", "48",+     "80", "96"] ["-r11025","-r16000","-r176400","-r192000","-r32000","-r44100","-r48000","-r8000","-r96000"]) ts, if zs == "2" then "-b24"        else "-b16",take (length file - 3) file ++ "flac"] ""   case code of     ExitSuccess -> removeFile file@@ -282,8 +285,8 @@ flacToWav :: String -> FilePath -> IO () flacToWav ys file = do   let (ts,zs) = splitAt 2 . init $ ys-  (code,_,herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file,getBFst' ("-r22050",V.fromList . zip ["11","16", "17", "19", "32", "44", "48",-     "80", "96"] $ ["-r11025","-r16000","-r176400","-r192000","-r32000","-r44100","-r48000","-r8000","-r96000"]) ts, if zs == "2" then "-b24"+  (code,_,herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file,getBFstL' "-r22050" (zip ["11","16", "17", "19", "32", "44", "48",+     "80", "96"] ["-r11025","-r16000","-r176400","-r192000","-r32000","-r44100","-r48000","-r8000","-r96000"]) ts, if zs == "2" then "-b24"        else "-b16",take (length file - 4) file ++ "wav"] ""   case code of     ExitSuccess -> removeFile file@@ -300,12 +303,8 @@ f2w file = let (zs,ts) = splitAt (length file - 5) file in if ts == ".flac" then zs ++ ".wav" else error "You give not a FLAC file! "  wOrf :: FilePath -> String-wOrf file =-  let (_,us) = splitAt (length file - 4) file in-    case us of-     ".wav" -> "w"-     "flac" -> "f"-     _      -> error "You give neither a WAV nor a FLAC file! "+wOrf file = let us = drop (length file - 4) file in case us of { ".wav" -> "w" ; "flac" -> "f" ;+  ~bbb -> error "You give neither a WAV nor a FLAC file! " }  cfw2wf :: FilePath -> FilePath cfw2wf file@@ -314,14 +313,9 @@  | otherwise = error "You give neither a WAV nor a FLAC file! "  efw2 :: FilePath -> String-efw2 file- | wOrf file == "w" = ".wav"- | wOrf file == "f" = ".flac"- | otherwise = error "You give neither a WAV nor a FLAC file! "+efw2 file = let us = drop (length file - 4) file in case us of { ".wav" -> ".wav" ; "flac" -> ".flac" ;+  ~bbb -> error "You give neither a WAV nor a FLAC file! " }  efw2vv :: FilePath -> String-efw2vv file- | wOrf file == "w" = ".flac"- | wOrf file == "f" = ".wav"- | otherwise = error "You give neither a WAV nor a FLAC file! "- +efw2vv file = let us = drop (length file - 4) file in case us of { ".wav" -> ".flac" ; "flac" -> ".wav" ;+  ~bbb -> error "You give neither a WAV nor a FLAC file! " }
Main.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  Main--- Copyright   :  (c) OleksandrZhabenko 2020+-- Copyright   :  (c) OleksandrZhabenko 2020-2021 -- License     :  MIT -- Stability   :  Experimental -- Maintainer  :  olexandr543@yahoo.com@@ -14,10 +14,10 @@  import Control.Exception (onException) import MMSyn7l (changeVolume,adjustVolRes)-import qualified Data.Vector as V-import CaseBi (getBFst')+--import qualified Data.Vector as V+import CaseBi.Arr (getBFstL') import System.Environment (getArgs)-import ReplaceP (replaceP, replaceP4)+import Parser.ReplaceP (replaceP, replaceP4)  -- | The main and the only one function in the module. If you specify a one command line argument, which can be obtained by running @mmsyn7s@ program -- with the needed to be sounded (with sound representations) Ukrainian text (please, refer to: https://hackage.haskell.org/package/mmsyn7s).@@ -50,15 +50,15 @@       putStrLn "given sound representations. If not specified, the program modifies the amplitudes for all non-pause Ukrainian sounds representations."       putStrLn ""     ("-v":_)  -> do-      putStrLn "mmsyn7l version: 0.8.0.0"+      putStrLn "mmsyn7l version: 0.9.0.0"       putStrLn ""     ("-r":_)  -> adjustVolRes . drop 1 $ args     _         ->  do       putStrLn "Now you can change the amplitude of the needed sound representations of the Ukrainian sounds (or something similar). "       putStrLn ""       let wss = read (replaceP4 . show $ (read  (replaceP . show . take 1 $ args)::[String]))::[String]-      mapM_ (changeVolume 1) . map (getBFst' ("0.wav", V.fromList . zip ["а","б","в","г","д","дж","дз","е","ж","з","и","й","к","л","м","н","о","п","р","с",-        "сь","т","у","ф","х","ц","ць","ч","ш","ь","і","ґ"] $ ["A.wav", "B.wav", "C.wav", "D.wav", "E.wav", "F.wav", "G.wav", "H.wav", "I.wav", "J.wav", +      mapM_ (changeVolume 1) . map (getBFstL' "0.wav" (zip ["а","б","в","г","д","дж","дз","е","ж","з","и","й","к","л","м","н","о","п","р","с",+        "сь","т","у","ф","х","ц","ць","ч","ш","ь","і","ґ"] ["A.wav", "B.wav", "C.wav", "D.wav", "E.wav", "F.wav", "G.wav", "H.wav", "I.wav", "J.wav",            "K.wav", "L.wav", "M.wav", "N.wav", "O.wav", "P.wav", "Q.wav", "R.wav", "S.wav", "T.wav", "U.wav", "V.wav", "W.wav", "X.wav", "Y.wav", "Z.wav",              "a.wav", "b.wav", "c.wav", "d.wav", "e.wav", "f.wav"])) $ wss       putStrLn ""
mmsyn7l.cabal view
@@ -2,13 +2,13 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                mmsyn7l-version:             0.8.0.0+version:             0.9.0.0 synopsis:            Modifies the amplitudes of the Ukrainian sounds representations created by mmsyn7ukr package. description:         A program and a library to modify the amplitudes of the Ukrainian sounds representations created by mmsyn7ukr package or somehow otherwise. homepage:            https://hackage.haskell.org/package/mmsyn7l license:             MIT license-file:        LICENSE-author:              (c) OleksandrZhabenko 2020+author:              (c) OleksandrZhabenko 2020-2021 maintainer:          olexandr543@yahoo.com -- copyright: category:            Sound@@ -20,14 +20,14 @@   exposed-modules:     Main, MMSyn7l   -- other-modules:   -- other-extensions:-  build-depends:       base >=4.7 && <4.15, mmsyn7ukr >=0.17 && <1, vector >=0.11 && <0.14, mmsyn2 >=0.1.8 && <1, directory >=1.2.7 && <2, process >=1.4 && <1.9, mmsyn3 >=0.1.5 && <1+  build-depends:       base >=4.7 && <4.15, mmsyn7ukr-common >=0.1.1 && <1, mmsyn2-array >=0.1.1 && <1, directory >=1.2.7 && <2, process >=1.4 && <1.9, mmsyn3 >=0.1.5 && <1   -- hs-source-dirs:   default-language:    Haskell2010  executable mmsyn7l   main-is:             Main.hs-  -- other-modules:+  other-modules:       MMSyn7l   -- other-extensions:-  build-depends:       base >=4.7 && <4.15, mmsyn7ukr >=0.17 && <1, vector >=0.11 && <0.14, mmsyn2 >=0.1.8 && <1, directory >=1.2.7 && <2, process >=1.4 && <1.9, mmsyn3 >=0.1.5 && <1+  build-depends:       base >=4.7 && <4.15, mmsyn7ukr-common >=0.1.1 && <1, mmsyn2-array >=0.1.1 && <1, directory >=1.2.7 && <2, process >=1.4 && <1.9, mmsyn3 >=0.1.5 && <1   -- hs-source-dirs:   default-language:    Haskell2010