dobutokO4 0.2.1.0 → 0.3.0.0
raw patch · 5 files changed
+108/−22 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ DobutokO.Sound.Presentation: Empty :: IntervalTim
+ DobutokO.Sound.Presentation: Empty2 :: IntervalTimI
+ DobutokO.Sound.Presentation: IMG :: a -> a -> IntervalMG a
+ DobutokO.Sound.Presentation: UniversalG :: IntervalMG a
+ DobutokO.Sound.Presentation: UniversalI :: IntervalTim
+ DobutokO.Sound.Presentation: UniversalII :: IntervalTimI
+ DobutokO.Sound.Presentation: data IntervalMG a
+ DobutokO.Sound.Presentation: instance GHC.Base.Monoid (DobutokO.Sound.Presentation.IntervalMG a)
+ DobutokO.Sound.Presentation: instance GHC.Base.Monoid DobutokO.Sound.Presentation.IntervalTim
+ DobutokO.Sound.Presentation: instance GHC.Base.Monoid DobutokO.Sound.Presentation.IntervalTimI
+ DobutokO.Sound.Presentation: instance GHC.Base.Semigroup (DobutokO.Sound.Presentation.IntervalMG a)
+ DobutokO.Sound.Presentation: instance GHC.Classes.Eq a => GHC.Classes.Eq (DobutokO.Sound.Presentation.IntervalMG a)
+ DobutokO.Sound.Presentation: instance GHC.Classes.Ord a => GHC.Classes.Ord (DobutokO.Sound.Presentation.IntervalMG a)
+ DobutokO.Sound.Presentation: instance GHC.Show.Show a => GHC.Show.Show (DobutokO.Sound.Presentation.IntervalMG a)
Files
- ChangeLog.md +5/−0
- DobutokO/Sound/Faded.hs +1/−1
- DobutokO/Sound/Presentation.hs +98/−17
- README.markdown +3/−3
- dobutokO4.cabal +1/−1
ChangeLog.md view
@@ -16,3 +16,8 @@ ## 0.2.1.0 -- 2020-06-09 * Second version. Added a README.markdown file. ++## 0.3.0.0 -- 2020-06-09++* Third version. Added a new data type to the DobutokO.Sound.Presentation module (IntervalMG), some changes to the data types already present. +Added more instances. Some minor documentation improvements.
DobutokO/Sound/Faded.hs view
@@ -76,7 +76,7 @@ overChangeVolG :: String -> String -> Int -> Double -> Double -> Double -> Double -> ((Double,Double), (Double,Double)) -> IO () overChangeVolG = overChangeVolGN "test" --- | A generalized version of the 'overChangeVolGN' with a possibility to specify the name of the resulting file (by default it is \"test\" based).+-- | A generalized version of the 'overChangeVolG' with a possibility to specify the name of the resulting file (by default it is \"test\" based). overChangeVolGN :: FilePath -> String -> String -> Int -> Double -> Double -> Double -> Double -> ((Double,Double), (Double,Double)) -> IO () overChangeVolGN filestart ys cs j freq1 freq2 x0 xdelta ((t0,v0), (t1,v1)) | x0 /= 0 && compare (abs x0) 1.0 /= GT && compare freq1 16 == GT && compare freq1 20000 == LT =
DobutokO/Sound/Presentation.hs view
@@ -22,6 +22,7 @@ , IntervalTim (..) , IntervalTimI (..) , IntervalG (..)+ , IntervalMG (..) ) where #ifdef __GLASGOW_HASKELL__@@ -38,7 +39,7 @@ import Data.Semigroup #endif #endif-+import Data.Monoid -- | An 'Int' parameter is an index of the 'SoundI' sound file in the sorted in the ascending order 'V.Vector' of them (the corresponding files or their -- names) representing the whole composition.@@ -109,22 +110,33 @@ #endif -- | 'Double' interval representation with no order of the arguments preserved.-data IntervalTim = I Double Double+data IntervalTim = Empty | I Double Double | UniversalI instance Eq IntervalTim where (==) (I x1 x2) (I y1 y2) | x1 /= y1 = if x1 == y2 then x2 == y1 else False | otherwise = x2 == y2+ (==) UniversalI UniversalI = True+ (==) Empty Empty = True+ (==) _ _ = False instance Ord IntervalTim where compare (I x01 x02) (I x11 x12) | min x01 x02 == min x11 x12 = compare (max x01 x02) (max x11 x12) | otherwise = compare (min x01 x02) (min x11 x12)+ compare UniversalI UniversalI = EQ+ compare Empty Empty = EQ+ compare _ UniversalI = LT+ compare _ Empty = GT+ compare UniversalI _ = GT+ compare _ _ = LT instance Show IntervalTim where+ show Empty = "()" show (I x1 x2) | compare x1 x2 /= GT = "[" ++ showFFloat Nothing x1 ", " ++ showFFloat Nothing x2 "]" | otherwise = "[" ++ showFFloat Nothing x2 ", " ++ showFFloat Nothing x1 "]"+ show UniversalI = "(-Infinity..+Infinity)" #ifdef __GLASGOW_HASKELL__ #if __GLASGOW_HASKELL__>=804@@ -132,37 +144,85 @@ -- | Since base-4.9.0.0. Idempotent semigroup (x <> x == x) -- band. instance Semigroup IntervalTim where (<>) (I x01 x02) (I x11 x12) = I (minimum [x01,x02,x11,x12]) (maximum [x01,x02,x11,x12])+ (<>) Empty x = x+ (<>) x Empty = x+ (<>) _ _ = UniversalI #endif #endif++instance Monoid IntervalTim where+ mempty = Empty+#ifdef __GLASGOW_HASKELL__+#if __GLASGOW_HASKELL__<=802+/* code that applies only to GHC 8.2.* and lower versions */+ mappend Empty x = x+ mappend x Empty = x+ mappend (I x01 x02) (I x11 x12) = I (minimum [x01,x02,x11,x12]) (maximum [x01,x02,x11,x12])+ mappend _ _ = UniversalI+#endif+#endif -- | Another 'Double' interval representation with no order of the arguments preserved. Since base-4.9.0.0 has different instance of 'Semigroup' -- than 'IntervalTim'.-data IntervalTimI = II Double Double +data IntervalTimI = Empty2 | II Double Double | UniversalII instance Eq IntervalTimI where (==) (II x1 x2) (II y1 y2) | x1 /= y1 = if x1 == y2 then x2 == y1 else False | otherwise = x2 == y2+ (==) Empty2 Empty2 = True+ (==) UniversalII UniversalII = True+ (==) _ _ = False instance Ord IntervalTimI where compare (II x01 x02) (II x11 x12) | min x01 x02 == min x11 x12 = compare (max x01 x02) (max x11 x12) | otherwise = compare (min x01 x02) (min x11 x12)+ compare Empty2 Empty2 = EQ+ compare Empty2 _ = LT+ compare UniversalII UniversalII = EQ+ compare UniversalII _ = GT+ compare _ Empty2 = GT+ compare _ _ = LT instance Show IntervalTimI where+ show Empty2 = "()" show (II x1 x2) | compare x1 x2 /= GT = "[" ++ showFFloat Nothing x1 ", " ++ showFFloat Nothing x2 "]" | otherwise = "[" ++ showFFloat Nothing x2 ", " ++ showFFloat Nothing x1 "]"+ show UniversalII = "(-Infinity..+Infinity)" #ifdef __GLASGOW_HASKELL__ #if __GLASGOW_HASKELL__>=804 /* code that applies only to GHC 8.4.* and higher versions */--- | Since base-4.9.0.0. Idempotent semigroup (x <> x == x) -- band. +-- | Since base-4.9.0.0. Idempotent semigroup (x <> x == x) -- band. (<>) can be understood as a intersection of the sets. instance Semigroup IntervalTimI where- (<>) (II x01 x02) (II x11 x12) = II (max (min x01 x02) (min x11 x12)) (min (max x01 x02) (max x11 x12)) + (<>) Empty2 x = Empty2+ (<>) x Empty2 = Empty2+ (<>) (II x01 x02) (II x11 x12) = if compare (max (min x01 x02) (min x11 x12)) (min (max x01 x02) (max x11 x12)) /= GT + then II (max (min x01 x02) (min x11 x12)) (min (max x01 x02) (max x11 x12)) + else Empty2+ (<>) (II x y) _ = II x y+ (<>) _ (II x y) = II x y+ (<>) _ _ = UniversalII #endif #endif - ++-- | Can be understood as intersection of the sets.+instance Monoid IntervalTimI where+ mempty = Empty2+#ifdef __GLASGOW_HASKELL__+#if __GLASGOW_HASKELL__<=802+/* code that applies only to GHC 8.2.* and lower versions */+ mappend Empty2 x = x+ mappend x Empty2 = x+ mappend (II x01 x02) (II x11 x12) = if compare (max (min x01 x02) (min x11 x12)) (min (max x01 x02) (max x11 x12)) /= GT + then II (max (min x01 x02) (min x11 x12)) (min (max x01 x02) (max x11 x12)) + else Empty2+ mappend _ _ = UniversalII+#endif+#endif+ -- | The first 'Double' parameter is some adjustment parameter for the playing sound being represented by 'OvertonesO'. data SoundTim = StOm Timity Double OvertonesO | SAtOm Timity Double Double OvertonesO | SAbtOm Timity Double Double OvertonesO deriving (Eq, Ord, Show)@@ -170,17 +230,7 @@ ---------------------------------------------------------------------------------- -- | Generalized interval representation.-data IntervalG a b = IG a b --instance (Eq a, Eq b) => Eq (IntervalG a b) where- (==) (IG a0 b0) (IG a1 b1) - | a0 /= a1 = False- | otherwise = b0 == b1--instance (Ord a, Ord b) => Ord (IntervalG a b) where- compare (IG a0 b0) (IG a1 b1) - | a0 /= a1 = compare a0 a1- | otherwise = compare b0 b1+data IntervalG a b = IG a b deriving (Eq, Ord) instance (Show a, Show b) => Show (IntervalG a b) where show (IG x y) = "[|" ++ show x ++ " __ " ++ show y ++ "|]"@@ -206,3 +256,34 @@ bimap f g (IG x y) = IG (f x) (g y) #endif #endif ++-- | Generalized interval representation which is a Monoid instance.+data IntervalMG a = IMG a a | UniversalG deriving (Eq, Ord)++instance (Show a) => Show (IntervalMG a) where+ show (IMG x y) = "[|" ++ show x ++ " __ " ++ show y ++ "|]"+ show UniversalG = "(-InfinityMG..+InfinityMG)"++#ifdef __GLASGOW_HASKELL__+#if __GLASGOW_HASKELL__>=804+/* code that applies only to GHC 8.4.* and higher versions */+-- | Since base-4.9.0.0. Idempotent semigroup (x <> x == x) and rectangular band (x <> y <> z == x <> z)+-- For more information, please, refer to: https://en.wikipedia.org/wiki/Band_(mathematics)+instance Semigroup (IntervalMG a) where+ (<>) (IMG x0 _) (IMG _ w1) = IMG x0 w1+ (<>) (IMG x y) _ = IMG x y+ (<>) _ (IMG x y) = IMG x y+ (<>) _ _ = UniversalG+#endif+#endif ++instance Monoid (IntervalMG a) where+ mempty = UniversalG+#ifdef __GLASGOW_HASKELL__+#if __GLASGOW_HASKELL__<=802+/* code that applies only to GHC 8.2.* and lower versions */+ mappend UniversalG x = x+ mappend x UniversalG = x+ mappend (IMG a1 a2) (IMG a3 a4) = IMG a1 a4+#endif+#endif
README.markdown view
@@ -1,10 +1,10 @@- Model Explanation for DobutokO.Sound.Faded- ==========================================+Model Explanation for DobutokO.Sound.Faded+========================================== [] (https://drive.google.com/file/d/1DUXtj-2YMMxc6wAmTcQS8Ub2czDFSOro) The line with dashes and dots for the different variants can be changed to the other types of lines (not the linear ones), but if there is a t_{2} point as on the right -plot then its coordinates is preserved.+plot then its coordinates are preserved.
dobutokO4.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dobutokO4-version: 0.2.1.0+version: 0.3.0.0 synopsis: Helps to create experimental music. Uses SoX inside. description: Uses SoX fade (in a special 2D way) and frequency modulation. Provides a special representation for the composition. homepage: https://hackage.haskell.org/package/dobutokO4