packages feed

dobutokO2 0.29.0.0 → 0.30.0.0

raw patch · 5 files changed

+65/−8 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ 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 ()

Files

CHANGELOG.md view
@@ -277,3 +277,8 @@  * Twenty-ninth version. Recent code in the DobutokO.Sound.Executable generalization. Added new functions for this. Added info about  the YouTube list with some of the generated sounds as videos. Some minor documentation improvements.++## 0.30.0.0 -- 2020-04-15++* Thirtieth version. Recent code in the DobutokO.Sound.Executable generalization. Added a new function 'soundGen3G_O2G' for this. It allows very general +approach to generation of the changing timbre for a solo sounds and their sequences. Some documentation improvements.
DobutokO/Sound/Executable.hs view
@@ -22,6 +22,7 @@   , soundGen3G   , soundGen3G_O   , soundGen3G_O2+  , soundGen3G_O2G   , h1   , h2 ) where@@ -683,11 +684,11 @@   endFromResult  -- | Generates a sequence of sounds with changing timbre. Uses several functions as parameters. Unlike the 'soundGen3G', the last two --- functions as arguments their first argument have not ('Double','Double'), but 'V.Vector' of them so areapplied 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 (possibly, each +-- 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'). --- The 'Double' argument is expected to be not used, though it is specified.+-- 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)) ->      (Double -> OvertonesO) -> IO ()@@ -718,15 +719,24 @@ --  -- > soundGen3G_O = soundGen3G_O2  -- with the first argument +--  -- > conversionFII (f0,fA1,fR1) = V.imap (\j r -> (V.unsafeIndex notes (snd r),+--  -- >      case fst r of+--  -- >        0 -> (\vv -> f0 vv)+--  -- >        1 -> fA1 j+--  -- >        2 -> fA1 j+--  -- >        3 -> fA1 j+--  -- >        4 -> fA1 j+--  -- >        _ -> fR1 j)) -- +--  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) -> @@ -738,6 +748,31 @@ -- 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       vecB = conversionFII (f0,fA1,fR1) vecA0+      (t, ws) = splitAt 1 . syllableStr n $ zs+      m0    = length ws+      zeroN = numVZeroesPre vecB+      v2    = V.map (\yy -> y * fromIntegral (yy * m0) / fromIntegral (head t)) . V.fromList $ ws in V.imapM_ (\j (x,k) -> do+        h2 (k x) (x, (V.unsafeIndex v2 (j `rem` (V.length v2)))) m ku freq1+        renameFile ("result.wav") $ "result0" ++ prependZeroes zeroN (show (j + 1)) ++ ".wav") vecB+  endFromResult    ++-- | Generates a sequence of sounds with changing timbre. Is a generalized version of the 'soundGen3G_O2', but for the conversion function conversionFII as its +-- tuple first argument uses not the tuple of the three functions, but a tuple of three 'V.Vector' of functions of the respective types, that allows to +-- specify more comlex behaviour and different variants inside the function itself, not its inner function parts. 'V.Vector' as a data type is used +-- instead of more common list because it has similar functionality and besides provides easier and quicker access to its elements. So these are the +-- following vectors of functions: @vf :: Vector (Double -> OvertonesO)@ (no changing a function for timbre generation), +-- @vfA :: Vector (Int -> Double -> OvertonesO)@ (for \"adding\" overtones to the function for timbre generation), +-- and @vfR :: Vector (Int -> Double -> OvertonesO@ (for \"removing\" overtones from the function for timbre generation).+-- +soundGen3G_O2G :: ((V.Vector (Double -> OvertonesO),V.Vector (Int -> Double -> OvertonesO),V.Vector (Int -> Double -> OvertonesO)) -> V.Vector (Int,Int) -> +  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+  let n = V.length vecA0+      vecB = conversionFII (vf,vfA,vfR) vecA0       (t, ws) = splitAt 1 . syllableStr n $ zs       m0    = length ws       zeroN = numVZeroesPre vecB
DobutokO/Sound/Functional.hs view
@@ -1056,7 +1056,9 @@  -- | @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 functional or operator (in mathematical sense), it changes the function @f@ (in some point) and returns the new one.+-- actually a higher-order function, it changes the function @f@ (in some point) and returns the new one. It can be 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) ->@@ -1065,7 +1067,9 @@  -- | @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 an operator (in mathematical sense), it changes the function @f@ (in some point) and returns the new one.+-- actually a higher-order function, it changes the function @f@ (in some point) and returns the 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) -> 
DobutokO/Sound/Keyboard.hs view
@@ -11,7 +11,20 @@  {-# OPTIONS_GHC -threaded #-} -module DobutokO.Sound.Keyboard where+module DobutokO.Sound.Keyboard (+  -- * Working with input and files+  qwerty2dvorak+  , dvorak2qwerty+  , input2BL+  , readFile2BL+  , readFile2BLGen+  -- * Conversions+  , readFileDoubles+  , readFileDoublesGen+  , takeDoubles+  , hashStr2+  , convH+) where  import CaseBi (getBFst') import Data.Char (isAsciiLower)
dobutokO2.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                dobutokO2-version:             0.29.0.0+version:             0.30.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