packages feed

dobutokO2 0.17.1.0 → 0.18.0.0

raw patch · 3 files changed

+118/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ DobutokO.Sound.IntermediateF: playE :: FilePath -> [String] -> IO ()
+ DobutokO.Sound.IntermediateF: rec1E :: FilePath -> [String] -> IO ()
+ DobutokO.Sound.IntermediateF: recE :: FilePath -> [String] -> IO ()

Files

CHANGELOG.md view
@@ -167,3 +167,8 @@  * Seventeenth version revised A. Fixed issues with being not compiled and duplicate export in 'DobutokO.Sound.IntermediateF'. Added two new functions 'soxE' and 'soxE1'. ++## 0.18.0.0 -- 2020-03-26++* Eighteenth version. Added three new funcions to the DobutokO.Sound.IntermediateF module for recording and playing of the files.+Some documentation improvements.
DobutokO/Sound/IntermediateF.hs view
@@ -49,20 +49,26 @@   -- *** Generalized   , soxE   , soxE1+  -- *** Playing and recording+  , recE+  , rec1E+  , playE ) where  import Control.Concurrent (myThreadId,forkIO,threadDelay,killThread) import qualified Data.List as L (sort) import Control.Exception (onException)+import Control.Exception.FinalException (FinalException (NotRecorded,ExecutableNotProperlyInstalled),catchEnd) import Data.List (isPrefixOf,isSuffixOf,(\\)) import Data.Char (isDigit,isSpace) import qualified Data.Vector as V  import System.Directory-import SoXBasics (playA,durationA)+import SoXBasics (playA,durationA,recA) import EndOfExe (showE) import System.Process (readProcessWithExitCode)-import Data.Maybe (fromJust)+import Data.Maybe (fromJust,isJust) import System.Exit (ExitCode (ExitSuccess))+import System.Info (os)  -- | Gets sizes of the \"result\*.wav\" files in the current directory.  getFileRSizes :: IO (V.Vector Integer)@@ -290,7 +296,8 @@ -- Besides, you can specify other SoX effects after reverberation in a list of 'String'. The syntaxis is that every separate literal must be -- a new element in the list. If you plan to create again mono audio in the end of processment, then probably use 'reverb1E' funcion instead.  -- If you would like to use instead of \"reverb\" its modification \"reverb -w\" effect (refer to SoX documentation), then probably it is more--- convenient to use 'reverbWE' function.+-- convenient to use 'reverbWE' function. Please, check by yourself whether you have enough permissions to read and write to the 'FilePath'-specified+-- file and to the containing it directory. The function is not intended to be used in otherwise cases. reverbE :: FilePath -> [String] -> IO () reverbE file arggs = do   (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) ([file,file ++ "reverb.wav","reverb"] ++ arggs) ""@@ -301,6 +308,8 @@        putStrLn $ "DobutokO.Sound.IntermediateF.reverbE: file \"" ++ file ++ "\" has not been successful. The file has not been changed at all. "  -- | The same as 'reverbE', but at the end file is being mixed to obtain mono audio. The name of the temporary file is ((name-of-the-file) ++ \"reverb1.wav\").+-- Please, check by yourself whether you have enough permissions to read and write to the 'FilePath'-specified+-- file and to the containing it directory. The function is not intended to be used in otherwise cases. reverb1E :: FilePath -> [String] -> IO () reverb1E file arggs = do   (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) ([file,file ++ "reverb1.wav","reverb"] ++ arggs ++ ["channels","1"]) ""@@ -312,6 +321,8 @@  -- | The same as 'reverbE', but uses \"reverb -w\" effect instead of \"reverb\". The name of the temporary file is -- ((name-of-the-file) ++ \"reverbW.wav\"). Please, for more information, refer to SoX documentation.+-- Please, check by yourself whether you have enough permissions to read and write to the 'FilePath'-specified+-- file and to the containing it directory. The function is not intended to be used in otherwise cases. reverbWE :: FilePath -> [String] -> IO () reverbWE file arggs = do   (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) ([file,file ++ "reverbW.wav","reverb","-w"] ++ arggs) ""@@ -321,7 +332,9 @@        removeFile $ file ++ "reverbW.wav"        putStrLn $ "DobutokO.Sound.IntermediateF.reverbWE: file \"" ++ file ++ "\" has not been successful. The file has not been changed at all. " --- | The same as 'reverbWE', but at the end file is being mixed to obtain mono audio. The name of the temporary file is ((name-of-the-file) ++ \"reverbW1.wav\").+-- | The same as 'reverbWE', but at the end file is being mixed to obtain mono audio. The name of the temporary file is ((name-of-the-file)+-- ++ \"reverbW1.wav\"). Please, check by yourself whether you have enough permissions to read and write to the 'FilePath'-specified+-- file and to the containing it directory. The function is not intended to be used in otherwise cases. reverbW1E :: FilePath -> [String] -> IO () reverbW1E file arggs = do   (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) ([file,file ++ "reverbW1.wav","reverb","-w"] ++ arggs ++ ["channels","1"]) ""@@ -336,6 +349,8 @@ -- -- The syntaxis is that every separate literal for SoX must be a new element in the list. If you plan to create again mono audio in the end of processment,  -- then probably use 'soxE1' function instead. Please, for more information, refer to SoX documentation.+-- Please, check by yourself whether you have enough permissions to read and write to the 'FilePath'-specified+-- file and to the containing it directory. The function is not intended to be used in otherwise cases. soxE :: FilePath -> [String] -> IO () soxE file arggs = do   (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) ([file,file ++ "effects.wav"] ++ arggs) ""@@ -345,7 +360,9 @@        removeFile $ file ++ "effects.wav"        putStrLn $ "DobutokO.Sound.IntermediateF.soxE: file \"" ++ file ++ "\" has not been successful. The file has not been changed at all. " --- | The same as 'soxE', but at the end file is being mixed to obtain mono audio. +-- | The same as 'soxE', but at the end file is being mixed to obtain mono audio.+-- Please, check by yourself whether you have enough permissions to read and write to the 'FilePath'-specified+-- file and to the containing it directory. The function is not intended to be used in otherwise cases. soxE1 :: FilePath -> [String] -> IO () soxE1 file arggs = do   (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) ([file,file ++ "effects.wav"] ++ arggs ++ ["channels","1"]) ""@@ -354,3 +371,92 @@     _ -> do        removeFile $ file ++ "effects.wav"        putStrLn $ "DobutokO.Sound.IntermediateF.soxE1: file \"" ++ file ++ "\" has not been successful. The file has not been changed at all. "++-- | Function takes a 'FilePath' for the new recorded file (if it already exists then it is overwritten) and a list of 'String'. The last one is+-- sent to SoX rec or something equivalent as its arguments after the filename. If you plan just afterwards to produce mono audio, it's simpler to use+-- 'rec1E' function instead. Please, check by yourself whether you have enough permissions to read and write to the 'FilePath'-specified+-- file and to the containing it directory. The function is not intended to be used in otherwise cases.+-- Function is adopted and changed 'SoXBasics.recA' function.+recE :: FilePath -> [String] -> IO ()+recE file arggs | isJust (showE "sox") && take 5 os == "mingw" = do +  (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) (["-t","waveaudio","-d", file] ++ arggs)""+  if code /= ExitSuccess+    then do+      e0 <- doesFileExist file+      if e0+        then do+          removeFile file+          catchEnd (NotRecorded file)+        else catchEnd (NotRecorded file)+    else do+      e1 <- doesFileExist file+      if e1+        then return ()+        else catchEnd (NotRecorded file)+                 | isJust (showE "rec") = do+  (code, _, _) <- readProcessWithExitCode (fromJust (showE "rec")) ([file] ++ arggs) ""+  if code /= ExitSuccess+    then do+      e0 <- doesFileExist file+      if e0+        then do+          removeFile file+          catchEnd (NotRecorded file)+        else catchEnd (NotRecorded file)+    else do+      e1 <- doesFileExist file+      if e1+        then return ()+        else catchEnd (NotRecorded file)+                 | otherwise = catchEnd ExecutableNotProperlyInstalled++-- | Function takes a 'FilePath' for the new recorded file (if it already exists then it is overwritten) and a list of 'String'. The last one is+-- sent to SoX rec or something equivalent as its arguments after the filename. Please, check by yourself whether you have enough permissions+-- to read and write to the 'FilePath'-specified file and to the containing it directory. The function is not intended to be used in otherwise cases.+-- Function is adopted and changed 'SoXBasics.recA' function.+rec1E :: FilePath -> [String] -> IO ()+rec1E file arggs | isJust (showE "sox") && take 5 os == "mingw" = do +  (code, _, _) <- readProcessWithExitCode (fromJust (showE "sox")) (["-t","waveaudio","-d", file] ++ arggs ++ ["channels","1"])""+  if code /= ExitSuccess+    then do+      e0 <- doesFileExist file+      if e0+        then do+          removeFile file+          catchEnd (NotRecorded file)+        else catchEnd (NotRecorded file)+    else do+      e1 <- doesFileExist file+      if e1+        then return ()+        else catchEnd (NotRecorded file)+                 | isJust (showE "rec") = do+  (code, _, _) <- readProcessWithExitCode (fromJust (showE "rec")) ([file] ++ arggs ++ ["channels","1"]) ""+  if code /= ExitSuccess+    then do+      e0 <- doesFileExist file+      if e0+        then do+          removeFile file+          catchEnd (NotRecorded file)+        else catchEnd (NotRecorded file)+    else do+      e1 <- doesFileExist file+      if e1+        then return ()+        else catchEnd (NotRecorded file)+                 | otherwise = catchEnd ExecutableNotProperlyInstalled++-- | Plays a 'FilePath' file with a SoX further effects specified by the list of 'String'. It can be e. g. used to (safely) test the result of applying+-- some SoX effects and only then to use 'soxE' or some similar functions to actually apply them.+-- Please, check by yourself whether you have enough permissions to read the 'FilePath'-specified+-- file and the containing it directory. The function is not intended to be used in otherwise cases.+-- Function is adopted and changed 'SoXBasics.playA' function.+playE :: FilePath -> [String] -> IO ()+playE file arggs | take 5 os == "mingw" = +  if isJust (showE "sox") +    then readProcessWithExitCode (fromJust (showE "sox")) ([file, "-t", "waveaudio", "-d"] ++ arggs) "" >> return ()+    else catchEnd ExecutableNotProperlyInstalled+                 | otherwise = if isJust (showE "play") +  then readProcessWithExitCode (fromJust (showE "play")) ([file] ++ arggs) "" >> return ()+  else catchEnd ExecutableNotProperlyInstalled
dobutokO2.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                dobutokO2-version:             0.17.1.0+version:             0.18.0.0 synopsis:            A program and a library to create experimental music from a mono audio and a Ukrainian text description:         It can also create a timbre for the notes. Uses SoX inside. homepage:            https://hackage.haskell.org/package/dobutokO2@@ -11,7 +11,7 @@ author:              OleksandrZhabenko maintainer:          olexandr543@yahoo.com -- copyright:-category:            Sound+category:            Sound, Music, Language build-type:          Simple extra-source-files:  CHANGELOG.md, README.markdown, text.dat.txt cabal-version:       >=1.10