synthesizer-core 0.8.2.1 → 0.8.3
raw patch · 9 files changed
+60/−14 lines, 9 filesdep ~bytestringdep ~containersdep ~deepseq
Dependency ranges changed: bytestring, containers, deepseq, explicit-exception, sample-frame-np, storable-tuple
Files
- src/Synthesizer/ApplicativeUtility.hs +1/−1
- src/Synthesizer/Basic/Wave.hs +46/−0
- src/Synthesizer/CausalIO/Gate.hs +1/−1
- src/Synthesizer/Frame/Stereo.hs +1/−1
- src/Synthesizer/Interpolation/Custom.hs +1/−1
- src/Synthesizer/Interpolation/Module.hs +1/−1
- src/Synthesizer/State/Signal.hs +1/−1
- synthesizer-core.cabal +5/−5
- test/Test/Sound/Synthesizer/Plain/Interpolation.hs +3/−3
src/Synthesizer/ApplicativeUtility.hs view
@@ -76,7 +76,7 @@ {-# INLINE ($#) #-} ($#) :: (Functor f) => f (a -> b) -> a -> f b-($#) f x = fmap ($x) f+($#) f x = fmap ($ x) f -- ($#) f x = f $: pure x
src/Synthesizer/Basic/Wave.hs view
@@ -42,6 +42,7 @@ saw, sawCos, sawComplex,+ superSaw, square, squareCos, squareComplex,@@ -424,6 +425,51 @@ T a (Complex.T a) sawComplex = fromFunction $ \x -> log (1 + Complex.cis (2*pi*x)) -}+++{-+sum [0..n-1] $ \k -> fraction (x+k*d)+sum [0..n-1] $ \k -> fraction (x+k*(floor d + fraction d))+sum [0..n-1] $ \k -> fraction (x+k*floor d + k*fraction d)+sum [0..n-1] $ \k -> fraction (x + k*fraction d)+sum [0..n-1] $ \k -> fraction (fraction x + k*fraction d)+X = fraction x (0<=X<1)+D = fraction d (0<=D<1)+sum [0..n-1] $ \k -> X+k*D - floor (X+k*D)+n*X + n*(n-1)/2*D - sum [0..n-1] (\k -> floor (X+k*D))++n=1: sum = 0+n=2: sum = floor(X+D)+n=3: sum = floor(X+D)(<2) + floor(X+2*D)(<3)+n=4: sum = floor(X+D) + floor(X+2*D) + floor(X+3*D)++N=n-1+special case: N*D<1 => X+N*D<2++X+(k-1)*D < 1+k-1 < (1-X)/D+k = ceiling((1-X)/D)++sum: max 0 (n - ceiling((1-X)/D))+ = n - min n (ceiling((1-X)/D))++https://math.stackexchange.com/questions/116689/counting-integral-lattice-points-in-a-triangle-that-may-not-have-integer-coordin+-}+{- |+@superSaw n d@ requires @1 <= n@ and @n*d <= 1@.+-}+superSaw, _superSaw :: (RealRing.C a, Field.C a) => Int -> a -> T a a+superSaw n =+ let nf = fromIntegral n+ in \d ->+ fmap (\y -> 1-2*y) $+ fromFunction $ \x ->+ (x + (nf-1)/2*d - 1) + min 1 (ceiling((1-x)/d) / nf)++_superSaw n d =+ fmap (\y -> 1 - 2/fromIntegral n * y) $+ fromFunction $ \x ->+ sum $ map fraction $ take n $ iterate (d+) x {- | square -}
src/Synthesizer/CausalIO/Gate.hs view
@@ -67,7 +67,7 @@ instance Mn.Monoid (Chunk a) where mempty = error "Gate.mempty cannot be defined"- mappend = error "Gate.mappend cannot be defined"+ mappend = (Sg.<>) instance CutG.Transform (Chunk a) where take n (Chunk dur mrel) =
src/Synthesizer/Frame/Stereo.hs view
@@ -1,5 +1,5 @@ module Synthesizer.Frame.Stereo (- T, left, right, cons, map,+ T, left, right, cons, map, swap, arrowFromMono, arrowFromMonoControlled, arrowFromChannels, Stereo.Channel(Left, Right), Stereo.select, Stereo.interleave,
src/Synthesizer/Interpolation/Custom.hs view
@@ -91,7 +91,7 @@ combineMany "Interpolation.element: list of functions empty" "Interpolation.element: list of samples empty" $- Sig.map ($t) $ Sig.fromList $ reverse ps+ Sig.map ($ t) $ Sig.fromList $ reverse ps {-# INLINE piecewiseConstant #-} piecewiseConstant :: (Interpol.C t y) => T t y
src/Synthesizer/Interpolation/Module.hs view
@@ -72,7 +72,7 @@ Int -> [t -> t] -> T t y piecewise center ps = cons (length ps) (center-1)- (\t -> Sig.linearComb (Sig.fromList (map ($t) (reverse ps))))+ (\t -> Sig.linearComb (Sig.fromList (map ($ t) (reverse ps)))) {-# INLINE piecewiseConstant #-} piecewiseConstant :: (Module.C t y) => T t y
src/Synthesizer/State/Signal.hs view
@@ -944,7 +944,7 @@ instance Monoid (T y) where mempty = empty- mappend = append+ mappend = (<>) catMaybes :: T (Maybe a) -> T a
synthesizer-core.cabal view
@@ -1,5 +1,5 @@ Name: synthesizer-core-Version: 0.8.2.1+Version: 0.8.3 License: GPL License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -38,7 +38,7 @@ Source-Repository this- Tag: 0.8.2.1+ Tag: 0.8.3 Type: darcs Location: http://code.haskell.org/synthesizer/core/ @@ -48,9 +48,9 @@ Library Build-Depends:- sample-frame-np >=0.0.4 && <0.1,+ sample-frame-np >=0.0.5 && <0.1, sox >=0.1 && <0.3,- transformers >=0.2 && <0.6,+ transformers >=0.2 && <0.7, non-empty >=0.2 && <0.4, semigroups >=0.1 && <1.0, event-list >=0.1 && <0.2,@@ -60,7 +60,7 @@ numeric-quest >=0.1 && <0.3, utility-ht >=0.0.14 && <0.1, filepath >=1.1 && <1.5,- bytestring >=0.9 && <0.11,+ bytestring >=0.9 && <0.12, binary >=0.1 && <1, deepseq >=1.1 && <1.5, storablevector >=0.2.5 && <0.3,
test/Test/Sound/Synthesizer/Plain/Interpolation.hs view
@@ -104,7 +104,7 @@ (Interpol.C a v, Module.C a v, Eq v) => a -> v -> [v] -> Bool constant t x0 xs =- equalList $ map ($(x0:xs)) $ map ($t) $+ equalList $ map ($ (x0:xs)) $ map ($ t) $ Interpolation.func ExampleCustom.constant : Interpolation.func ExampleCustom.piecewiseConstant : Interpolation.func ExampleModule.constant :@@ -115,7 +115,7 @@ (Interpol.C a v, Module.C a v, Eq v) => a -> v -> v -> [v] -> Bool linear t x0 x1 xs =- equalList $ map ($(x0:x1:xs)) $ map ($t) $+ equalList $ map ($ (x0:x1:xs)) $ map ($ t) $ Interpolation.func ExampleCustom.linear : Interpolation.func ExampleCustom.piecewiseLinear : Interpolation.func ExampleModule.linear :@@ -126,7 +126,7 @@ (Interpol.C a v, VectorSpace.C a v, Eq v) => a -> v -> v -> v -> v -> [v] -> Bool cubic t x0 x1 x2 x3 xs =- equalList $ map ($(x0:x1:x2:x3:xs)) $ map ($t) $+ equalList $ map ($ (x0:x1:x2:x3:xs)) $ map ($ t) $ Interpolation.func ExampleCustom.cubic : Interpolation.func ExampleCustom.piecewiseCubic : Interpolation.func ExampleModule.cubic :