dobutokO2 0.13.0.0 → 0.14.0.0
raw patch · 6 files changed
+146/−133 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +7/−0
- DobutokO/Sound.hs +12/−85
- DobutokO/Sound/Executable.hs +62/−3
- DobutokO/Sound/Functional.hs +47/−43
- README.markdown +17/−1
- dobutokO2.cabal +1/−1
CHANGELOG.md view
@@ -135,3 +135,10 @@ * Thirteenth version. Fixed issues connected with that SoX is by default for some distributions unable to work with a quantity of given files significantly more than 1000. This led to that the program and functions could not work properly with some big amounts of data or sound data source files of some sizes. Now the program and library work with them in a much more stable manner using temporary additional files. Some documentation, code and export improvements.++## 0.14.0.0 -- 2020-03-19++* Fourteenth version. Fixed issues connected with unneeded empty extensionless intermediate files in the current directory. Added the possibility to create+the resulting "end.wav" file and to clean the disk space from "result*" files by adding two new first command line options "8" and "80". Please, use the last+one with a special attention. See README.markdown for more information. Fixed issues with negative frequencies and durations possible in the+DobutokO.Sound.Functional functions. Added some more error messages to make debugging easier.
DobutokO/Sound.hs view
@@ -368,20 +368,7 @@ paths0 <- listDirectory "." let paths = sort . filter (isPrefixOf "test") $ paths0 _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result0" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""- mapM_ removeFile paths- if j /= 0 && j `rem` 700 == 0- then do- path1s <- listDirectory "."- let path2s = sort . filter (isPrefixOf "result0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (path2s ++ ["result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"]) ""- case code of- ExitSuccess -> mapM_ removeFile path2s- _ -> do- exi <- doesFileExist $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- if exi then removeFile $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- else putStr ""- else putStr ""- ) vec0+ mapM_ removeFile paths) vec0 | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in if abs ampL1 < 0.01 then oberSoXSynthN n 0.01 time3 zs vec0 else oberSoXSynthN n ampL1 time3 zs vec0@@ -418,19 +405,7 @@ let paths = sort . filter (isPrefixOf "test") $ paths0 _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result0" ++ prependZeroes zeroN (show j) ++ ".wav","vol", "0.3"]) ""- mapM_ removeFile paths- if j /= 0 && j `rem` 700 == 0- then do- path1s <- listDirectory "."- let path2s = sort . filter (isPrefixOf "result0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (path2s ++ ["result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"]) ""- case code of- ExitSuccess -> mapM_ removeFile path2s- _ -> do- exi <- doesFileExist $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- if exi then removeFile $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- else putStr ""- else putStr "") vec0+ mapM_ removeFile paths) vec0 | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in if abs ampL1 < 0.01 then oberSoXSynthN2 n 0.01 time3 zs tts vec0 else oberSoXSynthN2 n ampL1 time3 zs tts vec0 @@ -479,19 +454,7 @@ paths0 <- listDirectory "." let paths = sort . filter (isPrefixOf "test") $ paths0 _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result0" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""- mapM_ removeFile paths- if j /= 0 && j `rem` 700 == 0- then do- path1s <- listDirectory "."- let path2s = sort . filter (isPrefixOf "result0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (path2s ++ ["result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"]) ""- case code of- ExitSuccess -> mapM_ removeFile path2s- _ -> do- exi <- doesFileExist $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- if exi then removeFile $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- else putStr ""- else putStr "") vec0+ mapM_ removeFile paths) vec0 | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in if abs ampL1 < 0.01 then oberSoXSynthN3 n 0.01 time3 dAmpl zs tts vs vec0 else oberSoXSynthN3 n ampL1 time3 dAmpl zs tts vs vec0@@ -520,7 +483,7 @@ let paths3 = sort . filter (isPrefixOf "result") $ path2s (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (paths3 ++ ["end.wav"]) "" case code of- ExitSuccess -> mapM_ removeFile paths3+ ExitSuccess -> putStrLn "The final file \"end.wav\" was successfully created. You can now manually change or delete \"result*\" files in the directory. " _ -> do exi <- doesFileExist "end.wav" if exi then removeFile "end.wav"@@ -552,7 +515,7 @@ let paths3 = sort . filter (isPrefixOf "result") $ path2s (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (paths3 ++ ["end.wav"]) "" case code of- ExitSuccess -> mapM_ removeFile paths3+ ExitSuccess -> putStrLn "The final file \"end.wav\" was successfully created. You can now manually change or delete \"result*\" files in the directory. " _ -> do exi <- doesFileExist "end.wav" if exi then removeFile "end.wav"@@ -588,7 +551,7 @@ let paths3 = sort . filter (isPrefixOf "result") $ path2s (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (paths3 ++ ["end.wav"]) "" case code of- ExitSuccess -> mapM_ removeFile paths3+ ExitSuccess -> putStrLn "The final file \"end.wav\" was successfully created. You can now manually change or delete \"result*\" files in the directory. " _ -> do exi <- doesFileExist "end.wav" if exi then removeFile "end.wav"@@ -706,19 +669,7 @@ paths0 <- listDirectory "." let paths = sort . filter (isPrefixOf "test") $ paths0 _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result0" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""- mapM_ removeFile paths- if j /= 0 && j `rem` 700 == 0- then do- path1s <- listDirectory "."- let path2s = sort . filter (isPrefixOf "result0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (path2s ++ ["result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"]) ""- case code of- ExitSuccess -> mapM_ removeFile path2s- _ -> do- exi <- doesFileExist $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- if exi then removeFile $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- else putStr ""- else putStr "") vec0+ mapM_ removeFile paths) vec0 | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in if abs ampL1 < 0.01 then uniqOberSoXSynthN n 0.01 time3 zs wws vec0 else uniqOberSoXSynthN n ampL1 time3 zs wws vec0@@ -758,19 +709,7 @@ paths0 <- listDirectory "." let paths = sort . filter (isPrefixOf "test") $ paths0 _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result0" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""- mapM_ removeFile paths- if j /= 0 && j `rem` 700 == 0- then do- path1s <- listDirectory "."- let path2s = sort . filter (isPrefixOf "result0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (path2s ++ ["result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"]) ""- case code of- ExitSuccess -> mapM_ removeFile path2s- _ -> do- exi <- doesFileExist $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- if exi then removeFile $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- else putStr ""- else putStr "") vec0+ mapM_ removeFile paths) vec0 | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in if abs ampL1 < 0.01 then uniqOberSoXSynthN3 n 0.01 time3 zs wws tts vec0 else uniqOberSoXSynthN3 n ampL1 time3 zs wws tts vec0 @@ -824,19 +763,7 @@ paths0 <- listDirectory "." let paths = sort . filter (isPrefixOf "test") $ paths0 _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result0" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""- mapM_ removeFile paths- if j /= 0 && j `rem` 700 == 0- then do- path1s <- listDirectory "."- let path2s = sort . filter (isPrefixOf "result0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (path2s ++ ["result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"]) ""- case code of- ExitSuccess -> mapM_ removeFile path2s- _ -> do- exi <- doesFileExist $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- if exi then removeFile $ "result-" ++ prependZeroes zeroN (show (j `quot` 700)) ++ ".wav"- else putStr ""- else putStr "") vec0+ mapM_ removeFile paths) vec0 | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in if abs ampL1 < 0.01 then uniqOberSoXSynthN4 n 0.01 time3 dAmpl zs wws tts vs vec0 else uniqOberSoXSynthN4 n ampL1 time3 dAmpl zs wws tts vs vec0 @@ -887,7 +814,7 @@ let paths3 = sort . filter (isPrefixOf "result") $ path2s (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (paths3 ++ ["end.wav"]) "" case code of- ExitSuccess -> mapM_ removeFile paths3+ ExitSuccess -> putStrLn "The final file \"end.wav\" was successfully created. You can now manually change or delete \"result*\" files in the directory. " _ -> do exi <- doesFileExist "end.wav" if exi then removeFile "end.wav"@@ -920,7 +847,7 @@ let paths3 = sort . filter (isPrefixOf "result") $ path2s (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (paths3 ++ ["end.wav"]) "" case code of- ExitSuccess -> mapM_ removeFile paths3+ ExitSuccess -> putStrLn "The final file \"end.wav\" was successfully created. You can now manually change or delete \"result*\" files in the directory. " _ -> do exi <- doesFileExist "end.wav" if exi then removeFile "end.wav"@@ -957,7 +884,7 @@ let paths3 = sort . filter (isPrefixOf "result") $ path2s (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (paths3 ++ ["end.wav"]) "" case code of- ExitSuccess -> mapM_ removeFile paths3+ ExitSuccess -> putStrLn "The final file \"end.wav\" was successfully created. You can now manually change or delete \"result*\" files in the directory. " _ -> do exi <- doesFileExist "end.wav" if exi then removeFile "end.wav"
DobutokO/Sound/Executable.hs view
@@ -17,7 +17,8 @@ , dobutokO2H7 ) where -import qualified Data.List as L (groupBy)+import System.Exit (ExitCode (ExitSuccess))+import qualified Data.List as L (groupBy,sort) import CaseBi (getBFst') import Numeric (showFFloat) import Control.Exception (onException)@@ -27,7 +28,7 @@ import Data.Char (isDigit) import System.Process import EndOfExe (showE)-import qualified Data.Vector as V (fromList)+import qualified Data.Vector as V (Vector (..),generate,fromList,length,imapM_,snoc,toList,unsafeSlice) import System.Directory import SoXBasics import Processing_mmsyn7ukr@@ -43,7 +44,7 @@ args = unwords . drop 2 $ arggs exist2 <- doesFileExist file getBFst' (dobutokO2H exist2 args file, V.fromList . fmap (\(xs, f) -> (xs,f exist2 args file)) $ [("0",o2help),("1",dobutokO2H1),("2",dobutokO2H2),- ("3",dobutokO2H3),("4",dobutokO2H4),("5",dobutokO2H5),("7",dobutokO2H7)]) arg1+ ("3",dobutokO2H3),("4",dobutokO2H4),("5",dobutokO2H5),("7",dobutokO2H7),("8",dobutokO2H8),("80",dobutokO2H80)]) arg1 dobutokO2H1 :: Bool -> String -> FilePath -> IO () dobutokO2H1 exist2 args file = do@@ -100,6 +101,64 @@ dAmpl = read dAmpl0::Double uniqOberSoXSynthNGen4 file octave1 ampL time3 dAmpl args wws tts vs {-# INLINE dobutokO2H #-}++dobutokO2H8 :: Bool -> String -> FilePath -> IO ()+dobutokO2H8 _ _ _ = do+ path8s0 <- listDirectory "."+ let path8v = V.fromList . L.sort . filter (isPrefixOf "result") $ path8s0+ path8v1 = V.generate (V.length path8v `quot` 800) (\i0 -> V.unsafeSlice (i0 * 800) 800 path8v ) `V.snoc` V.unsafeSlice (800 *+ (V.length path8v `quot` 800)) (V.length path8v `rem` 800) path8v + V.imapM_ dO2H8 path8v1+ epath0s <- listDirectory "."+ let epaths = L.sort . filter (isPrefixOf "end0") $ epath0s+ (code1,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (epaths ++ ["end.wav"]) ""+ case code1 of+ ExitSuccess -> mapM_ removeFile epaths+ _ -> do+ exi1 <- doesFileExist "end.wav"+ if exi1+ then do+ removeFile "end.wav"+ error $ "The end file \"end.wav\" was not created. "+ else error "The end file \"end.wav\" was not created. "+{-# INLINE dobutokO2H8 #-}++dO2H8 :: Int -> V.Vector String -> IO ()+dO2H8 i v = do+ (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (V.toList v ++ ["end0" ++ show i ++ ".wav"]) ""+ case code of+ ExitSuccess -> putStr ""+ _ -> do+ exi0 <- doesFileExist $ "end0" ++ show i ++ ".wav"+ if exi0+ then do+ removeFile $ "end0" ++ show i ++ ".wav"+ error $ "The intermediate file " ++ "\"end0" ++ show i ++ ".wav\" was not created. "+ else error $ "The intermediate file " ++ "\"end0" ++ show i ++ ".wav\" was not created. "+{-# INLINE dO2H8 #-}++dobutokO2H80 :: Bool -> String -> FilePath -> IO ()+dobutokO2H80 _ _ _ = do+ path8s0 <- listDirectory "."+ let path8v = V.fromList . L.sort . filter (isPrefixOf "result") $ path8s0+ path8v1 = V.generate (V.length path8v `quot` 800) (\i0 -> V.unsafeSlice (i0 * 800) 800 path8v ) `V.snoc` V.unsafeSlice (800 *+ (V.length path8v `quot` 800)) (V.length path8v `rem` 800) path8v + V.imapM_ dO2H8 path8v1+ epath0s <- listDirectory "."+ let epaths = L.sort . filter (isPrefixOf "end0") $ epath0s+ (code1,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (epaths ++ ["end.wav"]) ""+ case code1 of+ ExitSuccess -> do+ mapM_ removeFile epaths+ mapM_ removeFile $ V.toList path8v+ _ -> do+ exi1 <- doesFileExist "end.wav"+ if exi1+ then do+ removeFile "end.wav"+ error $ "The end file \"end.wav\" was not created. "+ else error "The end file \"end.wav\" was not created. "+{-# INLINE dobutokO2H80 #-} isDataStr :: String -> Bool isDataStr = null . filter (== '@')
DobutokO/Sound/Functional.hs view
@@ -34,7 +34,7 @@ import DobutokO.Sound hiding (oberSoXSynth2FDN) -- | Similar to 'oberSoXSynth2DN' but instead of 'oberTones' function, it uses volatile function @f::Double -> Vector (Double, Double)@ with--- somewhat sophisticated mechanism to normalize the resulting 'V.Vector' elements @(Double, Double)@. The last one is experimental feature, so+-- somewhat sophisticated mechanism to normalize the resulting 'V.Vector' elements @(Double, Double)@. The last one is an experimental feature, so -- it is your responsibility to provide a function so that it does not lead to clipping. In such a case, the result of application of the -- 'convertToProperUkrainian' to the 'String' parameter must not be 'V.empty'. --@@ -56,7 +56,7 @@ v0 = g note0 v1 = if isNothing note1 then V.empty else g . fromJust $ note1- ts = showFFloat (Just 4) y $ show 0 + ts = showFFloat (Just 4) (abs y) $ show 0 oberSoXSynthHelp vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat (Just 4) noteN $ show 0,@@ -65,12 +65,12 @@ let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "") vec- _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) note0 $ show 0] "" if isNothing note1 then do oberSoXSynthHelp v0 else do - _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) (fromJust note1) $ show 0] "" oberSoXSynthHelp v0 oberSoXSynthHelp2 v1@@ -106,7 +106,7 @@ v0 = g note0 v1 = if isNothing note1 then V.empty else g . fromJust $ note1- ts = showFFloat (Just 4) y $ show 0 + ts = showFFloat (Just 4) (abs y) $ show 0 oberSoXSynthHelp vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat (Just 4) noteN $ show 0,@@ -115,12 +115,12 @@ let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "") vec- _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) note0 $ show 0] "" if isNothing note1 then do oberSoXSynthHelp v0 else do - _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) (fromJust note1) $ show 0] "" oberSoXSynthHelp v0 oberSoXSynthHelp2 v1@@ -146,43 +146,47 @@ v0 = f note0 v1 = if isNothing note1 then V.empty else f . fromJust $ note1- ts = showFFloat (Just 4) y $ show 0+ ts = showFFloat (Just 4) (abs y) $ show 0 oberSoXSynthHelp vec = let l = V.length vec zeroN = numVZeroesPre vec in V.imapM_ (\i (noteN, !amplN) -> if i /= 0 && i `rem` 250 == 0 then do path1s <- listDirectory "." let path2s = sort . filter (isPrefixOf "test0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path2s ++ ["test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) ""+ (code,_,herr0) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path2s ++ ["test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) "" case code of ExitSuccess -> mapM_ removeFile path2s _ -> do exi <- doesFileExist $ "test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- if exi then removeFile $ "test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- else putStr ""- else readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine",- showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec+ if exi then putStrLn ("Line 161: " ++ herr0) >> removeFile ("test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav")+ else putStrLn $ "Line 162: " ++ herr0 + else do+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine",+ showFFloat (Just 4) (abs noteN) $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] ""+ return ()) vec oberSoXSynthHelp2 vec = let l = V.length vec zeroN = numVZeroesPre vec in V.imapM_ (\i (noteN, !amplN) -> if i /= 0 && i `rem` 250 == 0 then do path3s <- listDirectory "." let path4s = sort . filter (isPrefixOf "test1") $ path3s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path4s ++ ["test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) ""- case code of+ (code2,_,herr2) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path4s ++ ["test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) ""+ case code2 of ExitSuccess -> mapM_ removeFile path4s _ -> do exi <- doesFileExist $ "test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- if exi then removeFile $ "test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- else putStr ""- else readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine",- showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec- _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ if exi then putStrLn ("Line 177: " ++ herr2) >> removeFile ("test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav")+ else putStrLn $ "Line 178: " ++ herr2+ else do+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine",+ showFFloat (Just 4) (abs noteN) $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] ""+ return ()) vec+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) note0 $ show 0] "" if isNothing note1 then do oberSoXSynthHelp v0 else do - _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) (fromJust note1) $ show 0] "" oberSoXSynthHelp v0 oberSoXSynthHelp2 v1@@ -207,43 +211,43 @@ v0 = V.filter (\(_,!z) -> compare (abs z) 0.001 == GT) . f $ note0 v1 = if isNothing note1 then V.empty else V.filter (\(_,!z) -> compare z 0.001 == GT) . f . fromJust $ note1- ts = showFFloat (Just 4) y $ show 0 + ts = showFFloat (Just 4) (abs y) $ show 0 oberSoXSynthHelp vec = let l = V.length vec zeroN = numVZeroesPre vec in V.imapM_ (\i (noteN, !amplN) -> if i /= 0 && i `rem` 250 == 0 then do path1s <- listDirectory "." let path2s = sort . filter (isPrefixOf "test0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path2s ++ ["test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) ""+ (code,_,herr0) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path2s ++ ["test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) "" case code of ExitSuccess -> mapM_ removeFile path2s _ -> do exi <- doesFileExist $ "test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- if exi then removeFile $ "test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- else putStr ""+ if exi then putStrLn ("Line 224: " ++ herr0) >> (removeFile $ "test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav")+ else putStrLn $ "Line 225: " ++ herr0 else readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine",- showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec+ showFFloat (Just 4) (abs noteN) $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec oberSoXSynthHelp2 vec = let l = V.length vec zeroN = numVZeroesPre vec in V.imapM_ (\i (noteN, !amplN) -> if i /= 0 && i `rem` 250 == 0 then do path3s <- listDirectory "." let path4s = sort . filter (isPrefixOf "test1") $ path3s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path4s ++ ["test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) ""+ (code,_,herr1) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path4s ++ ["test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) "" case code of ExitSuccess -> mapM_ removeFile path4s _ -> do exi <- doesFileExist $ "test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- if exi then removeFile $ "test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- else putStr ""+ if exi then putStrLn ("Line 239: " ++ herr1) >> (removeFile $ "test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav")+ else putStr $ "Line 240: " ++ herr1 else readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine",- showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec- _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ showFFloat (Just 4) (abs noteN) $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) note0 $ show 0] "" if isNothing note1 then do oberSoXSynthHelp v0 else do - _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) (fromJust note1) $ show 0] "" oberSoXSynthHelp v0 oberSoXSynthHelp2 v1@@ -268,43 +272,43 @@ v0 = V.filter (\(_,!z) -> compare (abs z) t0 == GT) . f $ note0 v1 = if isNothing note1 then V.empty else V.filter (\(_,!z) -> compare (abs z) t0 == GT) . f . fromJust $ note1- ts = showFFloat (Just 4) y $ show 0 + ts = showFFloat (Just 4) (abs y) $ show 0 oberSoXSynthHelp vec = let l = V.length vec zeroN = numVZeroesPre vec in V.imapM_ (\i (noteN, !amplN) -> if i /= 0 && i `rem` 250 == 0 then do path1s <- listDirectory "." let path2s = sort . filter (isPrefixOf "test0") $ path1s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path2s ++ ["test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) ""+ (code,_,herr0) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path2s ++ ["test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) "" case code of ExitSuccess -> mapM_ removeFile path2s _ -> do exi <- doesFileExist $ "test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- if exi then removeFile $ "test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- else putStr ""+ if exi then putStrLn ("Line 285: " ++ herr0) >> (removeFile $ "test-0" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav")+ else putStrLn $ "Line 286: " ++ herr0 else readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine",- showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec+ showFFloat (Just 4) (abs noteN) $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec oberSoXSynthHelp2 vec = let l = V.length vec zeroN = numVZeroesPre vec in V.imapM_ (\i (noteN, !amplN) -> if i /= 0 && i `rem` 250 == 0 then do path3s <- listDirectory "." let path4s = sort . filter (isPrefixOf "test1") $ path3s- (code,_,_) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path4s ++ ["test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) ""+ (code,_,herr1) <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ path4s ++ ["test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"]) "" case code of ExitSuccess -> mapM_ removeFile path4s _ -> do exi <- doesFileExist $ "test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- if exi then removeFile $ "test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav"- else putStr ""+ if exi then putStrLn ("Line 300: " ++ herr1) >> (removeFile $ "test-1" ++ prependZeroes zeroN (show (i `quot` 250)) ++ ".wav")+ else putStrLn $ "Line 301: " ++ herr1 else readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine",- showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec- _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ showFFloat (Just 4) (abs noteN) $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "" >> putStr "") vec+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) note0 $ show 0] "" if isNothing note1 then do oberSoXSynthHelp v0 else do - _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) y $ show 0,"sine",+ _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", showFFloat (Just 4) (abs y) $ show 0,"sine", showFFloat (Just 4) (fromJust note1) $ show 0] "" oberSoXSynthHelp v0 oberSoXSynthHelp2 v1
README.markdown view
@@ -13,7 +13,7 @@ For the executable you enter in the terminal: -dobutokO2 { 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 } {fileName} {Ukrainian text}+dobutokO2 { 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 80 } {fileName} {Ukrainian text} where filename is: the full name of the file to be recorded in the current directory or@@ -68,6 +68,22 @@ a textual input between two '@') can be omitted, the program will work also but with less control for the user possible.++ "8" -> the program just creates from input "result*" files the "end.wav" by+ concatenating them into one. It is mostly useful after some processment+ on the "result*" files after previous execution with other lesser first+ command line arguments to get the test final sound file. It can be then+ listened to and probably remade again by editing the "result*" files+ and running the program with this option again. In such a case,+ noone from the other command line arguments is important for the+ program running, so they all can be simply omitted.++ "80" -> the same as "8" but with one important difference that the program if+ succeeded in creation of the "end.wav" file, then removes all other "result*"+ files from the current directory, so you cannot reverse the successful action+ back and try again with just the same files. In such a case, you need to+ repeat all the process of creation of "result*" files. Be aware and use+ with care! _ -> the program behaves like for the "5" option, but generates obertones using additional String and allows maximum control over
dobutokO2.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dobutokO2-version: 0.13.0.0+version: 0.14.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 homepage: https://hackage.haskell.org/package/dobutokO2