packages feed

dobutokO2 0.10.0.0 → 0.10.1.0

raw patch · 4 files changed

+127/−98 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -100,3 +100,8 @@  * Tenth version. Added again the possibility to filter possible beats. Added new simple functions that are likely to work with previously prepared Vector (Double, Double) that satisfies some constraints. Some documentation imrovement. Some performance optimizations.++## 0.10.1.0 -- 2020-03-14++* Tenth version revised A. Some documentation improvements. Some performance optimizations.+
DobutokO/Sound.hs view
@@ -8,6 +8,7 @@ -- A program and a library to create experimental music -- from a mono audio and a Ukrainian text. +{-# LANGUAGE BangPatterns #-} {-# OPTIONS_GHC -threaded #-}  module DobutokO.Sound (@@ -108,14 +109,17 @@ -- | Returns a pure quint lower than the given note. pureQuintNote :: Double -> Double pureQuintNote x = x / 2 ** (fromIntegral 7 / fromIntegral 12)+{-# INLINE pureQuintNote #-}  -- | Returns an analogous note in the higher octave (its frequency in Hz). octaveUp :: Double -> Double octaveUp x = 2 * x+{-# INLINE octaveUp #-}  -- | Returns an analogous note in the lower octave (its frequency in Hz). octaveDown :: Double -> Double octaveDown x = x / fromIntegral 2+{-# INLINE octaveDown #-}  -- | Returns a 'V.Vector' of tuples with the lowest and highest frequencies for the notes in the octaves. octavesT :: V.Vector (Double, Double)@@ -174,8 +178,8 @@ -- | For the given frequency of the note it generates a 'V.Vector' of the tuples, each one of which contains the harmonics' frequency and amplitude. oberTones :: Double -> V.Vector (Double, Double) oberTones note =-  V.takeWhile (\w -> compare (fst w) (V.unsafeIndex notes 107) /= GT && compare (snd w) 0.001 == GT) . V.zip (V.generate 1024 (\i -> note * fromIntegral (i + 2))) $-    (V.generate 1024 (\i -> fromIntegral 1 / fromIntegral ((i + 1) * (i + 1))))+  V.takeWhile (\(!w,!z) -> compare w (V.unsafeIndex notes 107) /= GT && compare (abs z) 0.001 == GT) . V.zip (V.generate 1024 (\i ->+    note * fromIntegral (i + 2))) $ (V.generate 1024 (\i -> fromIntegral 1 / fromIntegral ((i + 1) * (i + 1))))  -- | For the given frequency of the note it generates a 'V.Vector' of the tuples, each one of which contains the harmonics' frequency and amplitude. For every given -- 'String' structure of the uniqueness (see the documentation for @mmsyn7s@ package and its 'MMSyn7.Syllable' module) it produces the unique timbre.@@ -186,7 +190,7 @@       v  = V.fromList . fmap (\y -> fromIntegral y / fromIntegral z) $ ys       z2 = V.length v       v2 = V.generate z2 $ (\i -> V.unsafeIndex v i / fromIntegral (i + 1)) in-        V.takeWhile (\u -> compare (fst u) (V.unsafeIndex notes 107) /= GT && compare (snd u) 0.001 == GT) . V.unsafeSlice 1 (z2 - 1) .+        V.takeWhile (\(!u,!z) -> compare u (V.unsafeIndex notes 107) /= GT && compare (abs z) 0.001 == GT) . V.unsafeSlice 1 (z2 - 1) .           V.zip (V.generate z2 (\i -> note * fromIntegral (i + 1))) $ v2  -- | Additional function to produce signs from the given 'String' of the Ukrainian text. Ukrainian vowels and voiced consonants gives \"+\" sign (+1), voiceless@@ -208,7 +212,7 @@ -- the harmonics' frequency and amplitude. The 'String' is used to produce the signs for harmonics coefficients. oberTones2 :: Double -> String -> V.Vector (Double, Double) oberTones2 note ts =-  V.takeWhile (\w -> compare (fst w) (V.unsafeIndex notes 107) /= GT && compare (abs . snd $ w) 0.001 == GT) . V.filter (\(_, t4) -> t4 /= 0.0) .+  V.takeWhile (\(!w,!z) -> compare w (V.unsafeIndex notes 107) /= GT && compare (abs z) 0.001 == GT) . V.filter (\(_, t4) -> t4 /= 0.0) .     V.zip (V.generate 1024 (\i -> note * fromIntegral (i + 2))) $ (V.generate 1024 (\i -> fromIntegral (V.unsafeIndex (signsFromString 1024 ts)       (i + 1)) / fromIntegral ((i + 1) * (i + 1)))) @@ -222,7 +226,7 @@       v  = V.fromList . fmap (\y -> fromIntegral y / fromIntegral z) $ ys       z2 = V.length v       v2 = V.generate z2 $ (\i -> (V.unsafeIndex (V.map fromIntegral . signsFromString z2 $ ts) i) * V.unsafeIndex v i / fromIntegral (i + 1)) in-        V.takeWhile (\u -> compare (fst u) (V.unsafeIndex notes 107) /= GT && compare (abs . snd $ u) 0.001 == GT) . V.filter (\(_, t4) -> t4 /= 0.0) .+        V.takeWhile (\(!u,!z) -> compare u (V.unsafeIndex notes 107) /= GT && compare (abs z) 0.001 == GT) . V.filter (\(_, t4) -> t4 /= 0.0) .           V.unsafeSlice 1 (z2 - 1) . V.zip (V.generate z2 (\i -> note * fromIntegral (i + 1))) $ v2  -- | For the given frequency it generates a musical sound with a timbre. The main component of the sound includes the lower pure quint,@@ -234,11 +238,13 @@       note1 = pureQuintNote note0       v0    = oberTones note0       v1    = oberTones note1-      oberSoXSynthHelp vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-      oberSoXSynthHelp2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test01.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "synth", "0.5","sine", "mix", showFFloat (Just 4) note1 $ 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", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+          fromIntegral l) $ show 0] "") vec+      oberSoXSynthHelp2 vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+          fromIntegral l) $ show 0] "") vec+  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test01.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "synth", "0.5","sine", "mix", showFFloat (Just 4) note1 $ show 0, "vol","0.5"] ""   oberSoXSynthHelp v0   oberSoXSynthHelp2 v1   paths0 <- listDirectory "."@@ -258,14 +264,16 @@       v0    = oberTones note0       v1    = if isNothing note1 then V.empty               else oberTones . fromJust $ note1-      oberSoXSynthHelp vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-      oberSoXSynthHelp2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testA.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ 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", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+          fromIntegral l) $ show 0] "") vec+      oberSoXSynthHelp2 vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","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", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "vol","0.5"] ""   if isNothing note1 then do oberSoXSynthHelp v0   else do -    _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", "0.5","sine", showFFloat (Just 4) (fromJust note1) $ show 0]   ""+    _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB.wav", "synth", "0.5","sine", showFFloat (Just 4) (fromJust note1) $ show 0,   "vol","0.5"]   ""     oberSoXSynthHelp v0     oberSoXSynthHelp2 v1   paths0 <- listDirectory "."@@ -284,18 +292,18 @@         v0    = oberTones note0         v1    = if isNothing note1 then V.empty                 else oberTones . fromJust $ note1-        oberSoXSynthHelp vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        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", showFFloat (Just 4) y $ show 0,"sine", showFFloat (Just 4) noteN $ show 0,-            "vol", showFFloat (Just 4) amplN $ show 0] "") vec-        oberSoXSynthHelp2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+            "vol", showFFloat (Just 4) (amplN / fromIntegral l) $ show 0] "") vec+        oberSoXSynthHelp2 vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))           ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", showFFloat (Just 4) y $ show 0,"sine", showFFloat (Just 4) noteN $ show 0,-            "vol", showFFloat (Just 4) amplN $ show 0] "") vec+            "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",-       showFFloat (Just 4) note0 $ show 0] ""+       showFFloat (Just 4) note0 $ show 0, "vol","0.5"] ""     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",-         showFFloat (Just 4) (fromJust note1) $ show 0] ""+         showFFloat (Just 4) (fromJust note1) $ show 0, "vol","0.5"] ""       oberSoXSynthHelp v0       oberSoXSynthHelp2 v1     paths0 <- listDirectory "."@@ -313,11 +321,13 @@       note1 = pureQuintNote note0       v0    = oberTones2 note0 tts       v1    = oberTones2 note1 tts-      oberSoXSynthHelp vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-      oberSoXSynthHelp2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test01.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "synth", "0.5","sine", "mix", showFFloat (Just 4) note1 $ 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", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+          fromIntegral l) $ show 0] "") vec+      oberSoXSynthHelp2 vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+           fromIntegral l) $ show 0] "") vec+  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test01.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "synth", "0.5","sine", "mix", showFFloat (Just 4) note1 $ show 0, "vol","0.5"] ""   oberSoXSynthHelp v0   oberSoXSynthHelp2 v1   paths0 <- listDirectory "."@@ -332,7 +342,7 @@ -- whether there is no \"x.wav\", \"test*\", \"result*\" and \"end.wav\" files in the current directory, because they can be overwritten. 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 = + | compare (abs ampL) 0.01 /= LT && compare (abs ampL) 1.0 /= GT =      let (t, ws) = splitAt 1 . syllableStr n $ zs         m     = length ws         zeroN = numVZeroesPre vec0@@ -341,15 +351,15 @@               note1 = pureQuintNote note0               v0    = oberTones note0               v1    = oberTones note1-              oberSoXSynthHelpN vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+              oberSoXSynthHelpN vec = let l = V.length vec in 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"))+                  showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l * ampL) $ show 0] "") vec+              oberSoXSynthHelpN2 vec = let l = V.length vec in 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  +                   "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l * 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] ""+                  (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", "mix", showFFloat (Just 4) note02 $ show 0, "vol","0.5"] ""           soxSynthHelpMain note0 note1           oberSoXSynthHelpN v0           oberSoXSynthHelpN2 v1@@ -358,7 +368,7 @@           _ <- 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+    if abs ampL1 < 0.01 then oberSoXSynthN n 0.01 time3 zs vec0     else oberSoXSynthN n ampL1 time3 zs vec0  -- | Function to create a melody for the given arguments. 'String' is used to provide a rhythm. The main component of the sound includes the lower pure quint, which@@ -368,7 +378,7 @@ -- whether there is no \"x.wav\", \"test*\", \"result*\" and \"end.wav\" files in the current directory, because they can be overwritten. oberSoXSynthN2 :: Int -> Double -> Double -> String -> String -> V.Vector Double -> IO () oberSoXSynthN2 n ampL time3 zs tts vec0- | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT = + | compare (abs ampL) 0.01 /= LT && compare (abs ampL) 1.0 /= GT =      let (t, ws) = splitAt 1 . syllableStr n $ zs         m     = length ws         zeroN = numVZeroesPre vec0@@ -377,24 +387,25 @@               note1 = pureQuintNote note0               v0    = oberTones2 note0 tts               v1    = oberTones2 note1 tts-              oberSoXSynthHelpN vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+              oberSoXSynthHelpN vec = let l = V.length vec in 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"))+                  showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l * ampL) $ show 0] "") vec+              oberSoXSynthHelpN2 vec = let l = V.length vec in 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  +                   "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l * 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] ""+                  (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", "mix", showFFloat (Just 4) note02 $ show 0, "vol","0.5"] ""           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"]) ""+          _ <- 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 oberSoXSynthN2 n 0.01 time3 zs tts vec0+    if abs ampL1 < 0.01 then oberSoXSynthN2 n 0.01 time3 zs tts vec0     else oberSoXSynthN2 n ampL1 time3 zs tts vec0      -- | Function to create a melody for the given arguments. 'String' is used to provide a rhythm. The main component of the sound includes the lower pure quint, which@@ -408,7 +419,7 @@ -- The last one is experimental feature. oberSoXSynthN3 :: Int -> Double -> Double -> Double -> String -> String -> String -> V.Vector Double -> IO () oberSoXSynthN3 n ampL time3 dAmpl zs tts vs vec0- | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT = + | compare (abs ampL) 0.01 /= LT && compare (abs ampL) 1.0 /= GT =      let (t, ws) = splitAt 1 . syllableStr n $ zs         m     = length ws         zeroN = numVZeroesPre vec0@@ -420,18 +431,18 @@               v0    = oberTones2 note0 tts               v1    = if isNothing note1 then V.empty                       else oberTones2 (fromJust note1) tts-              oberSoXSynthHelpN vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+              oberSoXSynthHelpN vec = let l1 = V.length vec in 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"))+                  showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l1 * ampL) $ show 0] "") vec+              oberSoXSynthHelpN2 vec = let l1 = V.length vec in 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) (if dAmpl * amplN * ampL > 1.0 then 1.0 else dAmpl * amplN * ampL) $-                      show 0] "") vec  +                   "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (if dAmpl * amplN / fromIntegral l1 * ampL > 1.0 then 1.0 else dAmpl+                      * amplN / fromIntegral l1 * ampL) $ show 0] "") vec                 soxSynthHelpMain0 note01 = 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", showFFloat (Just 4) note01 $ show 0, "vol","0.5"] ""               soxSynthHelpMain1 note02 = readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB" ++                  prependZeroes zeroN "1" ++  ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", showFFloat (Just 4) note02 $-                   show 0, "vol", showFFloat (Just 4) (if dAmpl > 1.0 then 1.0 else dAmpl) $ show 0] ""+                   show 0, "vol", showFFloat (Just 4) (if dAmpl > 0.5 then 0.5 else dAmpl / fromIntegral 2) $ show 0] ""           if isNothing note1 then do { soxSynthHelpMain0 note0                                      ; oberSoXSynthHelpN v0 }           else do { soxSynthHelpMain0 note0@@ -443,7 +454,7 @@           _ <- 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 oberSoXSynthN3 n 0.01 time3 dAmpl zs tts vs vec0+    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  -- | Similar to 'oberSoXSynthN', but uses a sound file to obtain the information analogous to 'V.Vector' in the latter one. Besides, the function lifts@@ -532,18 +543,21 @@ prependZeroes n xs    | if compare n 0 /= GT || null xs then True else compare n (length xs) /= GT = xs   | otherwise = replicate (n - length xs) '0' ++ xs+{-# INLINE prependZeroes #-}    nOfZeroesLog :: Int -> Maybe Int nOfZeroesLog x   | compare x 0 /= GT = Nothing   | otherwise = Just (truncate (log (fromIntegral x) / log 10) + 1)+{-# INLINE nOfZeroesLog #-}    numVZeroesPre :: V.Vector a -> Int numVZeroesPre v =   let xx = nOfZeroesLog . V.length $ v in     if isJust xx       then fromJust xx-      else 0::Int +      else 0::Int+{-# INLINE numVZeroesPre #-}          -- | For the given frequency and a Ukrainian text it generates a musical sound with the timbre obtained from the Ukrainian text (see the -- documentation for @mmsyn7s@ package). The timbre for another given text usually differs, but can be the same. The last one is only@@ -557,11 +571,13 @@       note1 = pureQuintNote note0       v0    = uniqOberTonesV note0 wws       v1    = uniqOberTonesV note1 wws-      uniqOberSoXSynthHelp vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-      uniqOberSoXSynthHelp2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test-.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "synth", "0.5","sine", "mix", showFFloat (Just 4) note1 $ show 0] ""+      uniqOberSoXSynthHelp vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+          fromIntegral l) $ show 0] "") vec+      uniqOberSoXSynthHelp2 vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+          fromIntegral l) $ show 0] "") vec+  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test-.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "synth", "0.5","sine", "mix", showFFloat (Just 4) note1 $ show 0, "vol","0.5"] ""   uniqOberSoXSynthHelp v0   uniqOberSoXSynthHelp2 v1   paths0 <- listDirectory "."@@ -582,11 +598,14 @@       note1 = pureQuintNote note0       v0    = uniqOberTonesV2 note0 wws tts       v1    = uniqOberTonesV2 note1 wws tts-      uniqOberSoXSynthHelp vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-      uniqOberSoXSynthHelp2 vec = V.imapM_ (\i (noteN, amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) amplN $ show 0] "") vec-  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test-.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "synth", "0.5","sine", "mix", showFFloat (Just 4) note1 $ show 0] ""+      uniqOberSoXSynthHelp vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+          fromIntegral l) $ show 0] "") vec+      uniqOberSoXSynthHelp2 vec = let l = V.length vec in V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN /+          fromIntegral l) $ show 0] "") vec+  _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test-.wav", "synth", "0.5","sine", showFFloat (Just 4) note0 $ show 0, "synth",+     "0.5","sine", "mix", showFFloat (Just 4) note1 $ show 0, "vol","0.5"] ""   uniqOberSoXSynthHelp v0   uniqOberSoXSynthHelp2 v1   paths0 <- listDirectory "."@@ -604,7 +623,7 @@ -- whether there is no \"x.wav\", \"test*\", \"result*\" and \"end.wav\" files in the current directory, because they can be overwritten. 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 =+ | compare (abs ampL) 0.01 /= LT && compare (abs ampL) 1.0 /= GT =     let (t, ws) = splitAt 1 . syllableStr n $ zs         m     = length ws         zeroN = numVZeroesPre vec0@@ -613,15 +632,16 @@               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"))+              uniqOberSoXSynthHelpN vec = let l = V.length vec in 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 / fromIntegral l * ampL) $ show 0] "") vec+              uniqOberSoXSynthHelpN2 vec = let l = V.length vec in 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 +                   "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l * 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] ""+                 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, "vol","0.5"]+                    ""           soxSynthHelpMain note0 note1           uniqOberSoXSynthHelpN v0           uniqOberSoXSynthHelpN2 v1@@ -630,7 +650,7 @@           _ <- 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+    if abs ampL1 < 0.01 then uniqOberSoXSynthN n 0.01 time3 zs wws vec0     else uniqOberSoXSynthN n ampL1 time3 zs wws vec0  -- | Function to create a melody for the given arguments. The first 'String' is used to provide a rhythm. The second one -- to provide a timbre.@@ -644,7 +664,7 @@ -- The third 'String' argument is used to define signs of the harmonics coefficients in the generated sounds. uniqOberSoXSynthN3 :: Int -> Double -> Double -> String -> String -> String -> V.Vector Double -> IO () uniqOberSoXSynthN3 n ampL time3 zs wws tts vec0- | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT =+ | compare (abs ampL) 0.01 /= LT && compare (abs ampL) 1.0 /= GT =     let (t, ws) = splitAt 1 . syllableStr n $ zs         m     = length ws         zeroN = numVZeroesPre vec0@@ -653,15 +673,15 @@               note1 = pureQuintNote note0               v0    = uniqOberTonesV2 note0 wws tts               v1    = uniqOberTonesV2 note1 wws tts-              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"))+              uniqOberSoXSynthHelpN vec = let l = V.length vec in 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 / fromIntegral l * ampL) $ show 0] "") vec+              uniqOberSoXSynthHelpN2 vec = let l = V.length vec in 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 +                   "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (amplN / fromIntegral l * 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] ""+                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, "vol","0.5"] ""           soxSynthHelpMain note0 note1           uniqOberSoXSynthHelpN v0           uniqOberSoXSynthHelpN2 v1@@ -670,7 +690,7 @@           _ <- 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 uniqOberSoXSynthN3 n 0.01 time3 zs wws tts vec0+    if abs ampL1 < 0.01 then uniqOberSoXSynthN3 n 0.01 time3 zs wws tts vec0     else uniqOberSoXSynthN3 n ampL1 time3 zs wws tts vec0      -- | Function to create a melody for the given arguments. The first 'String' is used to provide a rhythm. The second one -- to provide a timbre.@@ -688,7 +708,7 @@ -- The last one is experimental feature. uniqOberSoXSynthN4 :: Int -> Double -> Double -> Double -> String -> String -> String -> String -> V.Vector Double -> IO () uniqOberSoXSynthN4 n ampL time3 dAmpl zs wws tts vs vec0- | compare ampL 0.01 /= LT && compare ampL 1.0 /= GT =+ | compare (abs ampL) 0.01 /= LT && compare (abs ampL) 1.0 /= GT =     let (t, ws) = splitAt 1 . syllableStr n $ zs         m     = length ws         zeroN = numVZeroesPre vec0@@ -700,18 +720,19 @@               v0    = uniqOberTonesV2 note0 wws tts               v1    = if isNothing note1 then V.empty                       else uniqOberTonesV2 (fromJust note1) wws tts-              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"))+              uniqOberSoXSynthHelpN vec = let l1 = V.length vec in 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 / fromIntegral l1 * ampL) $ show 0] "") vec+              uniqOberSoXSynthHelpN2 vec = let l1 = V.length vec in 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) (if dAmpl * amplN * ampL > 1.0 then 1.0 else dAmpl * amplN * ampL) $ show 0] "") vec +                   "sine", showFFloat (Just 4) noteN $ show 0, "vol", showFFloat (Just 4) (if dAmpl * amplN / fromIntegral l * ampL > 1.0 then 1.0 else dAmpl *+                      amplN / fromIntegral l * ampL) $ show 0] "") vec                soxSynthHelpMain0 note01 = 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] ""+                   show 0, "vol","0.5"] ""               soxSynthHelpMain1 note02 = readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "testB" ++                  prependZeroes zeroN "1" ++  ".wav", "synth", showFFloat (Just 4) (V.unsafeIndex v2 (j `rem` m)) $ show 0,"sine", showFFloat (Just 4) note02 $-                   show 0, "vol", showFFloat (Just 4) (if dAmpl > 1.0 then 1.0 else dAmpl) $ show 0] ""+                   show 0, "vol", showFFloat (Just 4) (if dAmpl > 0.5 then 0.5 else dAmpl / fromIntegral 2) $ show 0] ""           if isNothing note1 then do { soxSynthHelpMain0 note0                                      ; uniqOberSoXSynthHelpN v0 }           else do { soxSynthHelpMain0 note0@@ -723,7 +744,7 @@           _ <- 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 uniqOberSoXSynthN4 n 0.01 time3 dAmpl zs wws tts vs vec0+    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      -- | Function is used to get numbers of intervals from a Ukrainian 'String'. It is used internally in the 'uniqOberSoXSynthN4' function.@@ -737,7 +758,8 @@ strToInt =   getBFst' (0, V.fromList [("а", 12), ("б", 4), ("в", 7), ("г", 3), ("д", 4), ("дж", 5), ("дз", 5), ("е", 12), ("ж", 3), ("з", 8), ("и", 12),      ("й", 7), ("к", 10), ("л", 7), ("м", 7), ("н", 7), ("о", 12), ("п", 10), ("р", 7), ("с", 10), ("т", 2), ("у", 12), ("ф", 2), ("х", 2),-      ("ц", 11), ("ч", 11), ("ш", 1), ("і", 12), ("ґ", 9)]) +      ("ц", 11), ("ч", 11), ("ш", 1), ("і", 12), ("ґ", 9)])+{-# INLINE strToInt #-}        -- | Function to get from the number of semi-tones and a note a 'Maybe' note for the second lower note in the interval if any. If there is -- no need to obtain such a note, then the result is 'Nothing'.@@ -759,7 +781,7 @@   duration0 <- durationA file   let n = truncate (duration0 / 0.001)   vecA <- V.generateM n (\k -> do {-    (_, _, herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "-n", "trim", show (fromIntegral k * 0.001),+    (_, _, herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "-n", "trim", showFFloat (Just 4) (fromIntegral k * 0.001) $ show 0,       "0.001", "stat"] ""     ; let line0s = lines herr           noteN0 = takeWhile isDigit . dropWhile (not . isDigit) . concat . drop 13 . take 14 $ line0s@@ -786,7 +808,7 @@   duration0 <- durationA file   let n = truncate (duration0 / 0.001)   vecA <- V.generateM n (\k -> do {-    (_, _, herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "-n", "trim", show (fromIntegral k * 0.001),+    (_, _, herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "-n", "trim", showFFloat (Just 4) (fromIntegral k * 0.001) $ show 0,       "0.001", "stat"] ""     ; let line0s = lines herr           noteN0 = takeWhile isDigit . dropWhile (not . isDigit) . concat . drop 13 . take 14 $ line0s@@ -817,7 +839,7 @@   duration0 <- durationA file   let n = truncate (duration0 / 0.001)   vecA <- V.generateM n (\k -> do {-    (_, _, herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "-n", "trim", show (fromIntegral k * 0.001),+    (_, _, herr) <- readProcessWithExitCode (fromJust (showE "sox")) [file, "-n", "trim", showFFloat (Just 4) (fromIntegral k * 0.001) $ show 0,       "0.001", "stat"] ""     ; let line0s = lines herr           noteN0 = takeWhile isDigit . dropWhile (not . isDigit) . concat . drop 13 . take 14 $ line0s
DobutokO/Sound/Functional.hs view
@@ -81,12 +81,14 @@ -- | 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 -- 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'.+-- 'convertToProperUkrainian' to the 'String' parameter must not be 'V.empty'. The function also tries to perform filtering to avoid possible beating.+-- The third 'Double' parameter in the tuple is used as a limit for frequencies difference in Hz to be filtered out from the resulting sound. It is+-- considered to be from the range @[0.1..10.0]@. -- -- Be aware that the result can be rather unpredictable (the program can even obtain segmentation fault) for not very suitable function. -- But for a lot of functions this works well. -- --- It is recommended to fully compute the \"f\" function before using it in the 'oberSoXSynth2FDN'.+-- It is recommended to fully compute the \"f\" function before using it in the 'oberSoXSynth2FDN_B'. oberSoXSynth2FDN_B :: (Double -> V.Vector (Double, Double)) -> (Double, Double, Double) -> String -> IO () oberSoXSynth2FDN_B f (x, y, limB) zs  | V.null . convertToProperUkrainian $ zs = oberSoXSynth x@@ -172,7 +174,7 @@ -- Be aware that the result can be rather unpredictable (the program can even obtain segmentation fault) for not very suitable function. -- But for a lot of functions this works well. -- --- It is recommended to fully compute the \"f\" function before using it in the 'oberSoXSynth2FDN_S'.+-- It is recommended to fully compute the \"f\" function before using it in the 'oberSoXSynth2FDN_Sf'. oberSoXSynth2FDN_Sf :: (Double -> V.Vector (Double, Double)) -> (Double, Double) -> String -> IO () oberSoXSynth2FDN_Sf f (x, y) zs  | V.null . convertToProperUkrainian $ zs = oberSoXSynth x@@ -211,7 +213,7 @@ -- Be aware that the result can be rather unpredictable (the program can even obtain segmentation fault) for not very suitable function. -- But for a lot of functions this works well. -- --- It is recommended to fully compute the \"f\" function before using it in the 'oberSoXSynth2FDN_S'.+-- It is recommended to fully compute the \"f\" function before using it in the 'oberSoXSynth2FDN_Sf3'. oberSoXSynth2FDN_Sf3 :: (Double -> V.Vector (Double, Double)) -> (Double, Double, Double) -> String -> IO () oberSoXSynth2FDN_Sf3 f (x, y, t0) zs  | V.null . convertToProperUkrainian $ zs = oberSoXSynth x
dobutokO2.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                dobutokO2-version:             0.10.0.0+version:             0.10.1.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