dobutokO2 0.3.1.1 → 0.4.0.0
raw patch · 3 files changed
+109/−60 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- DobutokO/Sound.hs +104/−59
- dobutokO2.cabal +1/−1
CHANGELOG.md view
@@ -20,3 +20,7 @@ ## 0.3.1.1 -- 2020-03-06 * Third version revised B. Some documentation improvements for README.markdown file.++## 0.4.0.0 -- 2020-03-07++* Fourth version. Fixed issues with wrongly realized rhythm behaviour. Now it corresponds to the documented.
DobutokO/Sound.hs view
@@ -193,29 +193,67 @@ -- in their becoming more silent ones. The second 'Double' argument is a basic sound duration. The default one is 0.5 (second). oberSoXSynthN :: Int -> Double -> Double -> String -> V.Vector Double -> IO () oberSoXSynthN n ampL time3 zs vec0- | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT = V.imapM_ (\j x -> do - let note0 = closestNote x -- zs is obtained from the command line arguments- note1 = pureQuintNote note0- v0 = oberTones note0- v1 = oberTones note1- (t, ws) = splitAt 1 . syllableStr n $ zs+ | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT = + let (t, ws) = splitAt 1 . syllableStr n $ zs+ m = length ws zeroN = numVZeroesPre vec0- v2 = V.map (\yy -> time3 * fromIntegral (yy * n) / fromIntegral (head t)) . V.fromList $ ws- oberSoXSynthHelpN vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))- ["-r22050", "-n", "test" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 i) $ show 0,"sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec- oberSoXSynthHelpN2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))- ["-r22050", "-n", "testQ" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 i) $ show 0,"sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec - _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test" ++ prependZeroes zeroN "1" ++ ".wav", "synth", showFFloat (Just 4) time3 $ show 0,"sine", showFFloat (Just 4) note0 $ show 0, "synth" , showFFloat (Just 4) time3 $ show 0,"sine", "mix", showFFloat (Just 4) note1 $ show 0] ""- oberSoXSynthHelpN v0- oberSoXSynthHelpN2 v1- paths0 <- listDirectory "."- let paths = sort . filter (isPrefixOf "test") $ paths0- _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""- mapM_ removeFile paths ) vec0+ v2 = V.map (\yy -> time3 * fromIntegral (yy * m) / fromIntegral (head t)) . V.fromList $ ws in V.imapM_ (\j x -> do + let note0 = closestNote x -- zs is obtained from the command line arguments+ note1 = pureQuintNote note0+ v0 = oberTones note0+ v1 = oberTones note1+ oberSoXSynthHelpN vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+ ["-r22050", "-n", "test" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine",+ showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec+ oberSoXSynthHelpN2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+ ["-r22050", "-n", "testQ" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,+ "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec + soxSynthHelpMain note01 note02 = readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA" ++ prependZeroes zeroN "1" ++ ".wav",+ "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", showFFloat (Just 4) note01 $ show 0, "synth", showFFloat (Just 4)+ (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", "mix", showFFloat (Just 4) note02 $ show 0] ""+ soxSynthHelpMain note0 note1+ oberSoXSynthHelpN v0+ oberSoXSynthHelpN2 v1+ paths0 <- listDirectory "."+ let paths = sort . filter (isPrefixOf "test") $ paths0+ _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""+ mapM_ removeFile paths ) vec0 | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in if ampL1 < 0.01 then oberSoXSynthN n 0.01 time3 zs vec0 else oberSoXSynthN n ampL1 time3 zs vec0 +{-+uniqOberSoXSynthN n ampL time3 zs wws vec0+ | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT =+ let (t, ws) = splitAt 1 . syllableStr n $ zs+ m = length ws+ zeroN = numVZeroesPre vec0+ v2 = V.map (\yy -> time3 * fromIntegral (yy * m) / fromIntegral (head t)) . V.fromList $ ws in V.imapM_ (\j x -> do + let note0 = closestNote x -- zs ? vec0 -- are they related to the one object? No, they are obtained from different sources.+ note1 = pureQuintNote note0+ v0 = uniqOberTonesV note0 wws+ v1 = uniqOberTonesV note1 wws+ uniqOberSoXSynthHelpN vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+ ["-r22050", "-n", "test" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine",+ showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec+ uniqOberSoXSynthHelpN2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+ ["-r22050", "-n", "testQ" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,+ "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec + soxSynthHelpMain note01 note02 = readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA" +++ prependZeroes zeroN "1" ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", showFFloat (Just 4) note01 $ show 0,+ "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", "mix", showFFloat (Just 4) note02 $ show 0] ""+ soxSynthHelpMain note0 note1+ uniqOberSoXSynthHelpN v0+ uniqOberSoXSynthHelpN2 v1+ paths0 <- listDirectory "."+ let paths = sort . filter (isPrefixOf "test") $ paths0+ _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""+ mapM_ removeFile paths ) vec0+ | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in+ if ampL1 < 0.01 then uniqOberSoXSynthN n 0.01 time3 zs wws vec0+ else uniqOberSoXSynthN n ampL1 time3 zs wws vec0+ -}+ -- | Similar to 'oberSoXSynthN', but uses a sound file to obtain the information analogous to 'V.Vector' in the latter one. Besides, the function lifts -- the frequencies to the octave with the given by 'Int' parameter number (better to use from the range [1..8]). The first 'Double' argument from -- the range [0.01..1.0] is used as a maximum amplitude for obertones. If it is set to 1.0 the obertones amplitudes are just maximum ones,@@ -288,25 +326,31 @@ -- the number lower by one. The second 'Double' argument is a basic sound duration. The default one is 0.5 (second). uniqOberSoXSynthN :: Int -> Double -> Double -> String -> String -> V.Vector Double -> IO () uniqOberSoXSynthN n ampL time3 zs wws vec0- | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT = V.imapM_ (\j x -> do - let note0 = closestNote x -- zs ? vec0 -- are they related to the one object? No, they are obtained from different sources.- note1 = pureQuintNote note0- v0 = uniqOberTonesV note0 wws- v1 = uniqOberTonesV note1 wws- (t, ws) = splitAt 1 . syllableStr n $ zs+ | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT =+ let (t, ws) = splitAt 1 . syllableStr n $ zs+ m = length ws zeroN = numVZeroesPre vec0- v2 = V.map (\yy -> time3 * fromIntegral (yy * n) / fromIntegral (head t)) . V.fromList $ ws- uniqOberSoXSynthHelpN vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))- ["-r22050", "-n", "test" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 i) $ show 0,"sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec- uniqOberSoXSynthHelpN2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))- ["-r22050", "-n", "testQ" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 i) $ show 0,"sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec - _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test" ++ prependZeroes zeroN "1" ++ ".wav", "synth", showFFloat (Just 4) time3 $ show 0,"sine", showFFloat (Just 4) note0 $ show 0, "synth", showFFloat (Just 4) time3 $ show 0,"sine", "mix", showFFloat (Just 4) note1 $ show 0] ""- uniqOberSoXSynthHelpN v0- uniqOberSoXSynthHelpN2 v1- paths0 <- listDirectory "."- let paths = sort . filter (isPrefixOf "test") $ paths0- _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""- mapM_ removeFile paths ) vec0+ v2 = V.map (\yy -> time3 * fromIntegral (yy * m) / fromIntegral (head t)) . V.fromList $ ws in V.imapM_ (\j x -> do + let note0 = closestNote x -- zs ? vec0 -- are they related to the one object? No, they are obtained from different sources.+ note1 = pureQuintNote note0+ v0 = uniqOberTonesV note0 wws+ v1 = uniqOberTonesV note1 wws+ uniqOberSoXSynthHelpN vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+ ["-r22050", "-n", "test" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine",+ showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec+ uniqOberSoXSynthHelpN2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+ ["-r22050", "-n", "testQ" ++ prependZeroes zeroN (show (i + 2)) ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,+ "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN * ampL) $ show 0] "") vec + soxSynthHelpMain note01 note02 = readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA" +++ prependZeroes zeroN "1" ++ ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", showFFloat (Just 4) note01 $ show 0,+ "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", "mix", showFFloat (Just 4) note02 $ show 0] ""+ soxSynthHelpMain note0 note1+ uniqOberSoXSynthHelpN v0+ uniqOberSoXSynthHelpN2 v1+ paths0 <- listDirectory "."+ let paths = sort . filter (isPrefixOf "test") $ paths0+ _ <- readProcessWithExitCode (fromJust (showE "sox")) (["--combine", "mix"] ++ paths ++ ["result" ++ prependZeroes zeroN (show j) ++ ".wav","vol","0.3"]) ""+ mapM_ removeFile paths ) vec0 | otherwise = let ampL1 = ampL - (fromIntegral . truncate $ ampL) in if ampL1 < 0.01 then uniqOberSoXSynthN n 0.01 time3 zs wws vec0 else uniqOberSoXSynthN n ampL1 time3 zs wws vec0@@ -375,26 +419,27 @@ recAndProcess file 1) | x == 2 = onException (do putStr "Please, specify the control parameter for the SoX \"noisered\" effect in the range from 0.0 to 1.0. "- putStrLn "The greater value causes more reduction with possibly removing some important sound data. The default value is 0.5"- putStrLn "To use the default value, you can simply press Ether."+ putStrLn "The greater value causes more reduction with possibly removing some important sound data. The default value is 0.5 "+ putStrLn "To use the default value, you can simply press Enter." ctrlN <- getLine- if null ctrlN then return ""- else let noiseP = tail . dropWhile (/= '.') . filter (\t -> isDigit t || t == '.') $ ctrlN in do {- controlNoiseReduction $ '0':noiseP ;- norm "_x.wav" ;- if isPrefixOf "nx." file - then putStr "" - else renameFile "8_x.wav" (file ++ ".wav") ;- removeFile "x.wav" ;- removeFile "_x.wav" ;- dir <- listDirectory "." ;- let paths4 = filter (isPrefixOf "nx.") dir in do {- mapM_ removeFile paths4 ;- putStrLn "" ;- return "" } }) (do- putStrLn "The process was not successful may be because of the not valid data. Please, specify the valid data as requested."- putStrLn "_______________________________________________________________________"- recAndProcess file 2)+ let addit = dropWhile (/= '.') . filter (\t -> isDigit t || t == '.') $ ctrlN+ noiseP = if null ctrlN then ""+ else tail addit+ controlNoiseReduction $ '0':noiseP ;+ norm "_x.wav" ;+ if isPrefixOf "nx." file + then putStr "" + else renameFile "8_x.wav" (file ++ ".wav") ;+ removeFile "x.wav" ;+ removeFile "_x.wav" ;+ dir <- listDirectory "." ;+ let paths4 = filter (isPrefixOf "nx.") dir+ mapM_ removeFile paths4 ;+ putStrLn "" ;+ return "") (do+ putStrLn "The process was not successful may be because of the not valid data. Please, specify the valid data as requested."+ putStrLn "_______________________________________________________________________"+ recAndProcess file 2) | x == 3 = onException (do putStr "Please, specify the octave number, to which you would like all the main components (not taking into account their respective lower pure quints) " putStrLn "should belong. The number should be better in the range [1..8]"@@ -405,9 +450,9 @@ putStrLn "_______________________________________________________________________" recAndProcess file 3) | x == 4 = onException (do- putStr "Please, specify the amplitude for the generated obertones as an Int number in the range [0..99]."+ putStr "Please, specify the amplitude for the generated obertones as an Int number in the range [0..99]. " putStrLn "The default one is 99"- putStrLn "To use the default value, you can simply press Ether."+ putStrLn "To use the default value, you can simply press Enter." amplOb0 <- getLine if null amplOb0 then return "1.0" else let amplOb = (read (take 2 . filter isDigit $ amplOb0)::Int) `rem` 100 in@@ -419,9 +464,9 @@ putStrLn "_______________________________________________________________________" recAndProcess file 4) | x == 5 = onException (do- putStr "Please, specify the basic duration for the generated sounds as a Double number in the range [0.1..4.0]."+ putStr "Please, specify the basic duration for the generated sounds as a Double number in the range [0.1..4.0]. " putStrLn "The default one is 0.5"- putStrLn "To use the default value, you can simply press Ether."+ putStrLn "To use the default value, you can simply press Enter." time0 <- getLine if null time0 then return "0.5" else let time1 = (read (filter (\z -> isDigit z || z == '.') $ time0)::Double) in
dobutokO2.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dobutokO2-version: 0.3.1.1+version: 0.4.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