packages feed

dobutokO2 0.32.0.0 → 0.33.0.0

raw patch · 5 files changed

+86/−68 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ DobutokO.Sound.Functional: fChangeFElem :: (Double, Double) -> Double -> (Double -> (Double, Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Double -> OvertonesO) -> Double -> OvertonesO
+ DobutokO.Sound.Functional: fChangeFElems :: OvertonesO -> Double -> (Double -> OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Double -> OvertonesO) -> Double -> OvertonesO
- DobutokO.Sound.Executable: soundGen3G_O :: Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Int -> OvertonesO) -> (OvertonesO -> (Double, Double)) -> (Double -> OvertonesO) -> IO ()
+ DobutokO.Sound.Executable: soundGen3G_O :: Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Int -> OvertonesO) -> (OvertonesO -> OvertonesO) -> (Double -> OvertonesO) -> IO ()
- DobutokO.Sound.Executable: soundGen3G_O2 :: ((Double -> OvertonesO, Int -> Double -> OvertonesO, Int -> Double -> OvertonesO) -> Vector (Int, Int) -> Vector (Double, Double -> OvertonesO)) -> Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Int -> OvertonesO) -> (OvertonesO -> (Double, Double)) -> (Double -> OvertonesO) -> IO ()
+ DobutokO.Sound.Executable: soundGen3G_O2 :: ((Double -> OvertonesO, Int -> Double -> OvertonesO, Int -> Double -> OvertonesO) -> Vector (Int, Int) -> Vector (Double, Double -> OvertonesO)) -> Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Int -> OvertonesO) -> (OvertonesO -> OvertonesO) -> (Double -> OvertonesO) -> IO ()
- DobutokO.Sound.Executable: soundGen3G_O2G :: ((Vector (Double -> OvertonesO), Vector (Int -> Double -> OvertonesO), Vector (Int -> Double -> OvertonesO)) -> Vector (Int, Int) -> Vector (Double, Double -> OvertonesO)) -> Vector (Double -> OvertonesO) -> Vector (Int -> Double -> OvertonesO) -> Vector (Int -> Double -> OvertonesO) -> Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Int -> OvertonesO) -> (OvertonesO -> (Double, Double)) -> (Double -> OvertonesO) -> IO ()
+ DobutokO.Sound.Executable: soundGen3G_O2G :: ((Vector (Double -> OvertonesO), Vector (Int -> Double -> OvertonesO), Vector (Int -> Double -> OvertonesO)) -> Vector (Int, Int) -> Vector (Double, Double -> OvertonesO)) -> Vector (Double -> OvertonesO) -> Vector (Int -> Double -> OvertonesO) -> Vector (Int -> Double -> OvertonesO) -> Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Int -> OvertonesO) -> (Double -> OvertonesO) -> IO ()
- DobutokO.Sound.Functional: fAddFElem :: (Double, Double) -> Double -> (Double -> OvertonesO) -> ((Double, Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) -> Double -> OvertonesO
+ DobutokO.Sound.Functional: fAddFElem :: (Double, Double) -> (Double -> OvertonesO) -> ((Double, Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) -> Double -> OvertonesO
- DobutokO.Sound.Functional: fAddFElems :: OvertonesO -> Double -> (Double -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> Double -> OvertonesO
+ DobutokO.Sound.Functional: fAddFElems :: OvertonesO -> (Double -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> Double -> OvertonesO
- DobutokO.Sound.Functional: fRemoveFElem :: (Double, Double) -> Double -> (Double -> OvertonesO) -> ((Double, Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) -> Double -> OvertonesO
+ DobutokO.Sound.Functional: fRemoveFElem :: (Double, Double) -> (Double -> OvertonesO) -> ((Double, Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) -> Double -> OvertonesO
- DobutokO.Sound.Functional: fRemoveFElems :: OvertonesO -> Double -> (Double -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> Double -> OvertonesO
+ DobutokO.Sound.Functional: fRemoveFElems :: OvertonesO -> (Double -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> Double -> OvertonesO

Files

CHANGELOG.md view
@@ -291,3 +291,8 @@  * Thirty-second version. Made a way the greatest amplitudes are treated in the splitting functions for OvertonesO better defined. Added a new generalization for the  splitting functionality to the DobutokO.Sound.Functional module. Some documentation improvements.++## 0.33.0.0 -- 2020-04-20++* Thirty-third version. Changed some functions to reduce unneeded parameter functions and arguments in the DobutokO.Sound.Functional and DobutokO.Sound.Executable +modules. Added new functions to change elements of the OvertonesO 'fChangeFElem' and 'fChangeFElems'. Some documentation improvements.
DobutokO/Sound/Executable.hs view
@@ -392,7 +392,7 @@     putStrLn ys  dobutokO2H00 :: Bool -> String -> FilePath -> IO ()-dobutokO2H00 exist2 args beginningSymbols = fadeAllE args beginningSymbols+dobutokO2H00 exist2 = fadeAllE {-# INLINE dobutokO2H00 #-}  ----------------------------------------------------------------------------------------------------------------------------------------------------@@ -636,15 +636,15 @@                               ----------------------                           --                                    f testSoundGen2G file f y zs = do-  vecA0 <- fmap (V.map (\t -> quotRem t 108)) (readFileDoubles file) -- >>= print+  vecA0 <- fmap (V.map (`quotRem` 108)) (readFileDoubles file) -- >>= print   let n = V.length vecA0       freq0 j = V.unsafeIndex notes (snd . V.unsafeIndex vecA0 $ j `rem` n)       f0 t = V.fromList [(0.05763181818181818 * t, 0.3598),(1.112159090909091 * t, 0.4588962),(2 * t, 0.6853),(3 * t, 0.268),(4 * t, 0.6823),(5 * t, 0.53)]-      fA1 j = fAddFElem (freq0 (j + 1),0.5) (freq0 j) f0 gAdd04 -      fR1 j = fRemoveFElem (freq0 (j + 1),0.5) (freq0 j) f0 gRem03+      fA1 j = fAddFElem (freq0 (j + 1),0.5) f0 gAdd04 +      fR1 j = fRemoveFElem (freq0 (j + 1),0.5) f0 gRem03       vecB = V.imap (\j r -> (V.unsafeIndex notes (snd r),        case fst r of-         0 -> (\vv -> f0 vv)+         0 -> f0          1 -> fA1 j          2 -> fA1 j          3 -> fA1 j@@ -662,14 +662,14 @@ soundGen3G :: FilePath -> (Double -> OvertonesO) -> Double -> String -> ((Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO)    -> ((Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Double -> OvertonesO) -> IO () soundGen3G file f y zs gAdd gRem f0 = do-  vecA0 <- fmap (V.map (\t -> quotRem t 108)) (readFileDoubles file) -- >>= print+  vecA0 <- fmap (V.map (`quotRem` 108)) (readFileDoubles file) -- >>= print   let n = V.length vecA0       freq0 j = V.unsafeIndex notes (snd . V.unsafeIndex vecA0 $ j `rem` n)-      fA1 j = fAddFElem (freq0 (j + 1),0.5) (freq0 j) f0 gAdd-      fR1 j = fRemoveFElem (freq0 (j + 1),0.5) (freq0 j) f0 gRem+      fA1 j = fAddFElem (freq0 (j + 1),0.5) f0 gAdd+      fR1 j = fRemoveFElem (freq0 (j + 1),0.5) f0 gRem       vecB = V.imap (\j r -> (V.unsafeIndex notes (snd r),        case fst r of-         0 -> (\vv -> f0 vv)+         0 -> f0          1 -> fA1 j          2 -> fA1 j          3 -> fA1 j@@ -685,22 +685,21 @@  -- | Generates a sequence of sounds with changing timbre. Uses several functions as parameters. Unlike the 'soundGen3G', the last two  -- functions as arguments for their first argument have not ('Double','Double'), but 'V.Vector' of them so are applied to 'OvertonesO'. To --- provide a generalized functionality, it uses two additional functions @freq0 :: Int -> OvertonesO@ and @proj :: OvertonesO -> (Double,Double)@ --- to define the first element to which are applied @gAdds@ and @gRems@ and the way to obtain a one tuple from the 'V.Vector' of them (probably, each --- element of which differs from the result). Besides, it lifts notes into specified with the first two 'Int' arguments enku (see 'liftInEnku'). +-- provide a generalized functionality, it uses two additional functions @freq0 :: Int -> OvertonesO@ and @proj :: OvertonesO -> OvertonesO@ +-- to define the first element to which are applied @gAdds@ and @gRems@ and the way to obtain a internal 'OvertonesO'.+-- Besides, it lifts notes into specified with the first two 'Int' arguments enku (see 'liftInEnku').  -- The 'Double' argument is a average duration of the sounds. soundGen3G_O :: Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -  -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Int -> OvertonesO) -> (OvertonesO -> (Double,Double)) -> +  -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (Int -> OvertonesO) -> (OvertonesO -> OvertonesO) ->      (Double -> OvertonesO) -> IO () soundGen3G_O m ku freq1 file f y zs gAdds gRems freq0 proj f0 = do-  vecA0 <- fmap (V.map (\t -> quotRem t 108)) (readFileDoubles file) -- >>= print+  vecA0 <- fmap (V.map (`quotRem` 108)) (readFileDoubles file) -- >>= print   let n = V.length vecA0-      fA1 j = fAddFElems (freq0 (j + 1)) (fst . proj . freq0 $ j) f0 gAdds--- It can be: proj . freq0 $ j = if V.null (freq0 j) then (V.unsafeIndex notes (snd . V.unsafeIndex vecA0 $ j `rem` n),0.5) else V.unsafeIndex (freq0 j) 0-      fR1 j = fRemoveFElems (freq0 (j + 1)) (fst . proj . freq0 $ j) f0 gRems+      fA1 j = fAddFElems (proj . freq0 $ j) f0 gAdds+      fR1 j = fRemoveFElems (proj . freq0 $ j) f0 gRems       vecB = V.imap (\j r -> (V.unsafeIndex notes (snd r),        case fst r of-         0 -> (\vv -> f0 vv)+         0 -> f0          1 -> fA1 j          2 -> fA1 j          3 -> fA1 j@@ -740,13 +739,12 @@ soundGen3G_O2 :: ((Double -> OvertonesO,Int -> Double -> OvertonesO,Int -> Double -> OvertonesO) -> V.Vector (Int,Int) ->    V.Vector (Double,Double -> OvertonesO)) -> Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String ->      (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> -      (Int -> OvertonesO) -> (OvertonesO -> (Double,Double)) -> (Double -> OvertonesO) -> IO ()+      (Int -> OvertonesO) -> (OvertonesO -> OvertonesO) -> (Double -> OvertonesO) -> IO () soundGen3G_O2 conversionFII m ku freq1 file f y zs gAdds gRems freq0 proj f0 = do-  vecA0 <- fmap (V.map (\t -> quotRem t 108)) (readFileDoubles file) -- >>= print+  vecA0 <- fmap (V.map (`quotRem` 108)) (readFileDoubles file) -- >>= print   let n = V.length vecA0-      fA1 j = fAddFElems (freq0 (j + 1)) (fst . proj . freq0 $ j) f0 gAdds--- It can be: proj . freq0 $ j = if V.null (freq0 j) then (V.unsafeIndex notes (snd . V.unsafeIndex vecA0 $ j `rem` n),0.5) else V.unsafeIndex (freq0 j) 0-      fR1 j = fRemoveFElems (freq0 (j + 1)) (fst . proj . freq0 $ j) f0 gRems+      fA1 j = fAddFElems (proj . freq0 $ j) f0 gAdds+      fR1 j = fRemoveFElems (proj . freq0 $ j) f0 gRems       vecB = conversionFII (f0,fA1,fR1) vecA0       (t, ws) = splitAt 1 . syllableStr n $ zs       m0    = length ws@@ -768,9 +766,9 @@   V.Vector (Double,Double -> OvertonesO)) -> V.Vector (Double -> OvertonesO) -> V.Vector (Int -> Double -> OvertonesO) -> V.Vector (Int -> Double -> OvertonesO) ->      Int -> Int -> Double -> FilePath -> (Double -> OvertonesO) -> Double -> String ->        (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> -        (Int -> OvertonesO) -> (OvertonesO -> (Double,Double)) -> (Double -> OvertonesO) -> IO ()-soundGen3G_O2G conversionFII vf vfA vfR m ku freq1 file f y zs gAdds gRems freq0 proj f0 = do-  vecA0 <- fmap (V.map (\t -> quotRem t 108)) (readFileDoubles file) -- >>= print+        (Int -> OvertonesO) -> (Double -> OvertonesO) -> IO ()+soundGen3G_O2G conversionFII vf vfA vfR m ku freq1 file f y zs gAdds gRems freq0 f0 = do+  vecA0 <- fmap (V.map (`quotRem` 108)) (readFileDoubles file) -- >>= print   let n = V.length vecA0       vecB = conversionFII (vf,vfA,vfR) vecA0       (t, ws) = splitAt 1 . syllableStr n $ zs
DobutokO/Sound/Functional.hs view
@@ -109,6 +109,7 @@   , sameFreqFI   , fAddFElem   , fRemoveFElem+  , fChangeFElem   , gAdd01   , gAdd02   , gAdd03@@ -119,6 +120,7 @@   -- ** Working with two OvertonesO   , fAddFElems   , fRemoveFElems+  , fChangeFElems   , freqsOverlapOvers   , elemsOverlapOvers   , gAdds01@@ -207,9 +209,9 @@         v0    = g note0         v1    = maybe V.empty g note1         ts = showFFloat (Just 4) (abs y) "" -        overSoXSynthHelp vec = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        overSoXSynthHelp = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))             ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat Nothing noteN "",-              "vol", showFFloat Nothing amplN ""] "") vec+              "vol", showFFloat Nothing amplN ""] "")          overSoXSynthHelp2 vec vdB = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))             (adjust_dbVol ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat Nothing noteN "",               "vol", showFFloat Nothing amplN ""] (V.unsafeIndex vdB i)) "") vec@@ -238,9 +240,9 @@         v0    = g note0         v1    = maybe V.empty g note1         ts = showFFloat (Just 4) (abs y) "" -        overSoXSynthHelp vec = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        overSoXSynthHelp = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))             (soxBasicParams ys ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat Nothing noteN "",-              "vol", showFFloat Nothing amplN ""]) "") vec+              "vol", showFFloat Nothing amplN ""]) "")         overSoXSynthHelp2 vec vdB = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))             (soxBasicParams ys (adjust_dbVol ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat Nothing noteN "",               "vol", showFFloat Nothing amplN ""] (V.unsafeIndex vdB i))) "") vec@@ -446,9 +448,9 @@                 else V.takeWhile (\(!w,!z) -> compare w (V.unsafeIndex notes 107) /= GT && compare (abs z) 0.001 == GT) .                    V.imap (\i (_,!z0) -> (fromIntegral (i + 1) * (fst . V.unsafeIndex (g0 . fromJust $ note1) $ 0), z0)) . g0 . fromJust $ note1         ts = showFFloat (Just 4) (abs y) "" -        overSoXSynthHelp vec = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        overSoXSynthHelp = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))             ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat Nothing noteN "",-              "vol", showFFloat Nothing amplN ""] "") vec+              "vol", showFFloat Nothing amplN ""] "")         overSoXSynthHelp2 vec vdB = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))             (adjust_dbVol ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat Nothing noteN "",               "vol", showFFloat Nothing amplN ""] (V.unsafeIndex vdB i))"") vec@@ -480,9 +482,9 @@                 else V.takeWhile (\(!w,!z) -> compare w (V.unsafeIndex notes 107) /= GT && compare (abs z) 0.001 == GT) .                    V.imap (\i (_,!z0) -> (fromIntegral (i + 1) * (fst . V.unsafeIndex (g0 . fromJust $ note1) $ 0), z0)) . g0 . fromJust $ note1         ts = showFFloat (Just 4) (abs y) "" -        overSoXSynthHelp vec = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        overSoXSynthHelp = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))             (soxBasicParams ys ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat Nothing noteN "",-              "vol", showFFloat Nothing amplN ""]) "") vec+              "vol", showFFloat Nothing amplN ""]) "")         overSoXSynthHelp2 vec vdB = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))             (soxBasicParams ys (adjust_dbVol ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", ts,"sine", showFFloat Nothing noteN "",               "vol", showFFloat Nothing amplN ""] (V.unsafeIndex vdB i))) "") vec@@ -938,10 +940,10 @@       note1 = pureQuintNote note0       v0    = overTones note0       v1    = overTones note1-      overSoXSynthHelp vec = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat Nothing noteN "", "vol", showFFloat Nothing amplN ""] "") vec-      overSoXSynthHelp2 vec = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))-        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat Nothing noteN "", "vol", showFFloat Nothing amplN ""] "") vec+      overSoXSynthHelp = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test0" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat Nothing noteN "", "vol", showFFloat Nothing amplN ""] "")+      overSoXSynthHelp2 = V.imapM_ (\i (noteN, !amplN) -> readProcessWithExitCode (fromJust (showE "sox"))+        ["-r22050", "-n", "test1" ++ show (i + 2) ++ ".wav", "synth", "0.5","sine", showFFloat Nothing noteN "", "vol", showFFloat Nothing amplN ""] "")   _ <- readProcessWithExitCode (fromJust (showE "sox")) ["-r22050", "-n", "test01.wav", "synth", "0.5","sine", showFFloat Nothing note0 "", "synth", "0.5","sine", "mix", showFFloat Nothing note1 "", "vol","0.5"] ""   overSoXSynthHelp v0   overSoXSynthHelp2 v1@@ -998,7 +1000,7 @@     case rs of       Nothing -> V.empty       _       ->-        let (y,f1) = fromJust $ rs in+        let (y,f1) = fromJust rs in           V.map fst (f1 1)  -- | Experimental 'show' for @f::Double -> Vector (Double,Double)@ that is used only for visualisation. It is correct only with 'maybeFFromStrVec' or@@ -1014,8 +1016,8 @@  | otherwise =     let (y,f) = fromJust . maybeFFromStrVec n x $ ys         l = length ("(" ++ (showFFloat Nothing y "") ++ ",(\t -> <(" ++ concat (V.toList . V.map (\z -> (showFFloat Nothing (fst z) $-              " * t, " ++ (showFFloat Nothing (snd z) $ "),("))) $ (f 1))) in take (l - 2) ("(" ++ (showFFloat Nothing y "") ++ ",(\t -> <("-                ++ concat (V.toList . V.map (\z -> (showFFloat Nothing (fst z) $ " * t, " ++ (showFFloat Nothing (snd z) $ "),("))) $ (f 1))) ++ ">))"+              " * t, " ++ (showFFloat Nothing (snd z) "),("))) $ (f 1))) in take (l - 2) ("(" ++ (showFFloat Nothing y "") ++ ",(\t -> <("+                ++ concat (V.toList . V.map (\z -> (showFFloat Nothing (fst z) " * t, " ++ (showFFloat Nothing (snd z) "),("))) $ (f 1))) ++ ">))"  ---------------------------------------------------------------------------------------- @@ -1065,26 +1067,33 @@  -- | @gAdd :: (Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO@ is a function that defines how the element is added -- to the 'OvertonesO'. Unlike for 'sameFreqF', it depends also on the 'Double' argument for @f :: Double -> OvertonesO@. 'fAddFElem' is--- actually a higher-order function, it changes the function @f@ (in some point) and returns the new one. It can be interesting task +-- actually a higher-order function, it changes the function @f@ and returns a new one. It can be an interesting task  -- (in general) to look at such a function through a prism of notion of operator (mathematical, for example similar to that ones that  -- are used for quantum mechanics and quantum field theory).  -- @gAdd@ allows not only to insert an element if missing, but to change all the 'OvertonesO' system. So depending on the complexity,--- it can reproduce rather complex behaviour.-fAddFElem :: (Double, Double) -> Double -> (Double -> OvertonesO) -> ((Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) ->+-- it can produce rather complex behaviour.+fAddFElem :: (Double, Double) -> (Double -> OvertonesO) -> ((Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) ->   (Double -> OvertonesO)-fAddFElem (noteN,amplN) freq f gAdd = \t -> gAdd (noteN,amplN) t f+fAddFElem (noteN, amplN) f gAdd t = gAdd (noteN, amplN) t f  -- | @gRem:: (Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO@ is a function that defines how the element is removed -- from the 'OvertonesO'. Unlike for 'sameFreqF', it depends also on the 'Double' argument for @f :: Double -> OvertonesO@. 'fRemoveFElem' is--- actually a higher-order function, it changes the function @f@ (in some point) and returns the new one. It can be an interesting task +-- actually a higher-order function, it changes the function @f@ and returns a new one. It can be an interesting task  -- (in general) to look at such a function through a prism of notion of operator (mathematical, for example that ones that are used  -- for quantum mechanics and quantum field theory).  -- @gRem@ allows not only to delete an element if existing, but to change all the 'OvertonesO' system. So depending on the complexity,--- it can reproduce rather complex behaviour.-fRemoveFElem :: (Double, Double) -> Double -> (Double -> OvertonesO) -> ((Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) -> +-- it can produce rather complex behaviour.+fRemoveFElem :: (Double, Double) -> (Double -> OvertonesO) -> ((Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO) ->    (Double -> OvertonesO)-fRemoveFElem (noteN,amplN) freq f gRem = \t -> gRem (noteN,amplN) t f+fRemoveFElem (noteN, amplN) f gRem t = gRem (noteN, amplN) t f +-- | Changes elements of the 'OvertonesO' using two functions. It is a generalization of the 'fAddFElem' and 'fRemoveFElem' functions. For example, if the first +-- of the two inner functional arguments acts as 'gAdd01' or similar, then it adds element to the 'OvertonesO', if it acts as 'gRem01', then it removes the element. +-- Its behaviour is defined by the 'Double' parameter (meaning frequency, probably), so you can change elements depending on what point it is applied.+fChangeFElem :: (Double, Double) -> Double -> (Double -> ((Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO)) -> (Double -> OvertonesO) -> +  (Double -> OvertonesO)+fChangeFElem (noteN, amplN) freq h f t = (h freq) (noteN, amplN) t f+ -- | Example of the function gAdd for the 'fAddFElem'. If the frequency is already in the 'OvertonesO' then the corresponding amplitude is divided -- equally between all the elements with the repeated given frequency from @(Double, Double)@. Otherwise, it is just concatenated to the 'OvertonesO'. gAdd01 :: (Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO@@ -1092,14 +1101,14 @@  | V.null . f $ freq = V.singleton (note,ampl)  | otherwise =     let v1 = renormF . f $ freq in-     let v2 = V.findIndices (\(x,_) -> x == note) $ v1 in+     let v2 = V.findIndices (\(x,_) -> x == note) v1 in        if V.null v2 then V.cons (note,ampl) (f freq)        else renormF . V.imap (\i (t,w) -> if i `V.elem` v2 then (t,w + ampl / fromIntegral (V.length v2)) else (t,w)) $ v1  -- | Can be used to produce an example of the function @gAdd@ for the 'fAddFElem'. Similar to 'gAdd01', but uses its first argument -- to renorm the result of the 'gAdd01' so that its maximum by absolute value amplitude equals to the first argument. gAdd02 :: Double -> (Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO-gAdd02 amplMax (note,ampl) freq f = renormFD amplMax . gAdd01 (note,ampl) freq $ f +gAdd02 amplMax (note,ampl) freq = renormFD amplMax . gAdd01 (note,ampl) freq  -- | Example of the function @gAdd@. for the 'fAddFElem'. If the frequency is not already in the 'OvertonesO' then the corresponding element is added and -- the 'OvertonesO' are renormed with 'renormF'. Otherwise, the element is tried to be inserted with a new frequency between the greatest by an absolute@@ -1110,7 +1119,7 @@  | V.null . f $ freq = V.singleton (note,ampl)  | otherwise =     let v1 = renormF . f $ freq in-     let v2 = V.findIndices (\(x,_) -> x == note) $ v1 in+     let v2 = V.findIndices (\(x,_) -> x == note) v1 in        if V.null v2 then renormF . V.cons (note,ampl) $ f freq        else         let xs = sortBy (\(x1,y1) (x2,y2)-> compare (abs x2) (abs x1)) . V.toList $ v1@@ -1127,7 +1136,7 @@   | V.null . f $ freq = V.empty   | otherwise =      let v1 = renormF . f $ freq in-     let v2 = V.findIndices (\(x,y) -> x == note && y == ampl) $ v1 in+     let v2 = V.findIndices (\(x,y) -> x == note && y == ampl) v1 in        if V.null v2 then        if compare (V.length v1) 5 == GT then renormF . V.unsafeSlice 0 (V.length v1 - 1) $ v1        else v1@@ -1136,18 +1145,24 @@ -- | Can be used to produce an example of the function @gRem@ for the 'fRemoveFElem'. Similar to 'gRem01', but uses its first argument -- to renorm the result of the 'gRem01' so that its maximum by absolute value amplitude equals to the first argument. gRem02 :: Double -> (Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO-gRem02 amplMax (note,ampl) freq f = renormFD amplMax . gAdd01 (note,ampl) freq $ f +gRem02 amplMax (note,ampl) freq = renormFD amplMax . gAdd01 (note,ampl) freq  -- | Similar to 'fAddFElem', but instead of one element @(Double,Double)@ it deals with a 'V.Vector' of such elements that is 'OvertonesO'. -fAddFElems :: OvertonesO -> Double -> (Double -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) ->+fAddFElems :: OvertonesO -> (Double -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) ->   (Double -> OvertonesO)-fAddFElems v freq f gAdds = \t -> gAdds v t f+fAddFElems v f gAdds t = gAdds v t f  -- | Similar to 'fRemoveFElem', but instead of one element @(Double,Double)@ it deals with a 'V.Vector' of such elements that is 'OvertonesO'. -fRemoveFElems :: OvertonesO -> Double -> (Double -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) -> +fRemoveFElems :: OvertonesO -> (Double -> OvertonesO) -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO) ->    (Double -> OvertonesO)-fRemoveFElems v freq f gRems = \t -> gRems v t f+fRemoveFElems v f gRems t = gRems v t f +-- | Similar to 'fChangeFElem', but use another form of the changing function, so it can deal with not only single element of the 'OvertonesO', +-- but also with several ones.+fChangeFElems :: OvertonesO -> Double -> (Double -> (OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO)) -> (Double -> OvertonesO) -> +  (Double -> OvertonesO)+fChangeFElems v freq h f t = (h freq) v t f+ -- | Binary predicate to check whether two given 'OvertonesO' both have the elements with the same first element in the tuples. If 'True' then -- this means that 'OvertonesO' are at least partially overlaped by the first elements in the tuples (meaning frequencies).  freqsOverlapOvers :: OvertonesO -> OvertonesO -> Bool@@ -1178,8 +1193,8 @@      let ys = sortBy (\(x1,y1) (x2,y2) -> compare x1 x2) . V.toList $ v0          h ys           | null ys = []-          | otherwise = (fst . break (/= head ys) $ ys):h (snd . break (/= head ys) $ ys)-         h1 ys = map (\zs -> (sum . map snd $ zs) / fromIntegral (length zs)) . h $ ys+          | otherwise = (takeWhile (not . (/= head ys)) ys):h (dropWhile (not . (/= head ys)) ys)+         h1 = map (\zs -> (sum . map snd $ zs) / fromIntegral (length zs)) . h          h2 ys = map (fst . head) (h ys)          v2   = V.fromList . zip (h2 ys) $ (h1 ys)          us = sortBy (\(x1,y1) (x2,y2) -> compare x1 x2) . V.toList $ f freq@@ -1189,7 +1204,7 @@ -- | Can be used to produce an example of the function @gAdds@ for the 'fAddFElems'. Similar to 'gAdds01', but uses its first argument -- to renorm the result of the 'gAdds01' so that its maximum by absolute value amplitude equals to the first argument. gAdds02 :: Double -> OvertonesO -> Double -> (Double -> OvertonesO) -> OvertonesO-gAdds02 amplMax v0 freq f = renormFD amplMax . gAdds01 v0 freq $ f +gAdds02 amplMax v0 freq = renormFD amplMax . gAdds01 v0 freq  -- | Example of the function @gAdd@. for the 'fAddFElem'. It tries to insert the given ('Double','Double') into the less dense frequency region. gAdd04 :: (Double,Double) -> Double -> (Double -> OvertonesO) -> OvertonesO@@ -1226,7 +1241,7 @@         v31 = V.map (\t -> (fst t) / x0) v2         v32 = V.map (\t -> (snd t) / y0) v2         v3 = V.zip v31 v32-        f1Tup = (\(t1,w2) -> V.imap (\i (u1,u2) -> (fst (V.unsafeIndex v3 i) * t1, snd (V.unsafeIndex v3 i) * w2 )) v3)+        f1Tup (t1, w2) = V.imap (\ i (u1, u2) -> (fst (V.unsafeIndex v3 i) * t1, snd (V.unsafeIndex v3 i) * w2)) v3           in V.map f1Tup (V.unsafeSlice 0 n v1)   | otherwise = V.singleton v0 @@ -1245,7 +1260,7 @@         v31 = V.map (\t -> (fst t) / x0) v2         v32 = V.map (\t -> (snd t) / y0) v2         v3 = V.zip v31 v32-        f1Tup = (\(t1,w2) -> V.imap (\i (u1,u2) -> (fst (V.unsafeIndex v3 i) * t1, snd (V.unsafeIndex v3 i) * w2 )) v3)+        f1Tup (t1, w2) = V.imap (\ i (u1, u2) -> (fst (V.unsafeIndex v3 i) * t1, snd (V.unsafeIndex v3 i) * w2)) v3           in V.map f1Tup (h . V.unsafeSlice 0 n $ v1)   | otherwise = V.singleton v0 @@ -1270,7 +1285,7 @@       v31 = V.map (\t -> (fst t) / y5) v2       v32 = V.map (\t -> (snd t) / y6) v2       v3 = V.zip v31 v32-      f1Tup = (\(t1,w2) -> V.imap (\i (u1,u2) -> (fst (V.unsafeIndex v3 i) * t1, snd (V.unsafeIndex v3 i) * w2 )) v3)+      f1Tup (t1, w2) = V.imap (\ i (u1, u2) -> (fst (V.unsafeIndex v3 i) * t1, snd (V.unsafeIndex v3 i) * w2)) v3         in V.map f1Tup (V.unsafeSlice x3 x4 v00)  -- | Auxiliary function that is used inside 'innerSplit2' and also in 'splitOG2'.@@ -1280,7 +1295,7 @@       v31 = V.map (\t -> (fst t) / y5) v2       v32 = V.map (\t -> (snd t) / y6) v2       v3 = V.zip v31 v32-      f1Tup = (\(t1,w2) -> V.imap (\i (u1,u2) -> (fst (V.unsafeIndex v3 i) * t1, snd (V.unsafeIndex v3 i) * w2 )) v3)+      f1Tup (t1, w2) = V.imap (\ i (u1, u2) -> (fst (V.unsafeIndex v3 i) * t1, snd (V.unsafeIndex v3 i) * w2)) v3         in V.map f1Tup (h1 . V.unsafeSlice x3 x4 $ v00)          -- | Generalized variant of the 'splitO2' with the different splitting variants depending on the first two ASCII lower case letters in the 'String' argument.@@ -1299,4 +1314,4 @@  -- | Concatenates a 'V.Vector' of 'OvertonesO' into a single 'OvertonesO'. Can be easily used with 'splitO'. overConcat :: V.Vector OvertonesO -> OvertonesO-overConcat v = V.concat . V.toList $ v+overConcat = V.concat . V.toList
README.markdown view
@@ -233,7 +233,7 @@ simplest (but still meaningful) multiplicative data fitting.  Since the 0.31.0.0 version the library includes functions to split the sound -into several simultanously sounding similar ones. For more information, please, +into several simultaneously sounding similar ones. For more information, please,  refer to the DobutokO.Sound.Functional module.  ** Note:
dobutokO2.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                dobutokO2-version:             0.32.0.0+version:             0.33.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