Safe Haskell | Safe-Inferred |
---|
General utilities for sampler patches.
Synopsis
- data SampleFormat
- extension :: SampleFormat -> String
- nextsBy :: Eq key => (a -> key) -> [a] -> [(a, [a])]
- nexts :: [a] -> [(a, [a])]
- symbolicPitch :: MonadError Text m => Note.Note -> m (Either Pitch.Note Pitch.NoteNumber)
- initialPitch :: MonadError Text m => Note.Note -> m Pitch.NoteNumber
- findPitchRatio :: Map Pitch.NoteNumber a -> Pitch.NoteNumber -> (a, Y)
- articulation :: MonadError Text m => Common.AttributeMap a -> Attrs.Attributes -> m a
- articulationDefault :: a -> Common.AttributeMap a -> Attrs.Attributes -> a
- data Dynamic
- dynamic :: (Bounded dyn, Enum dyn) => (dyn -> (Int, Int)) -> Y -> Note.Note -> (dyn, Y)
- findDynamic :: (Bounded dyn, Enum dyn) => (dyn -> Y) -> Y -> (dyn, Y)
- type Variation = Int
- variation :: Variation -> Note.Note -> Variation
- chooseVariation :: [a] -> Note.Note -> a
- pickVariation :: [a] -> Double -> a
- pickDynamicVariation :: Double -> [a] -> Double -> Double -> a
- dynamicAutoScale :: (Y, Y) -> (Y, Y) -> Y -> Y
- dynToVel :: Y -> Int
- velToDyn :: Int -> Y
- dynEnvelope :: Y -> RealTime.RealTime -> Note.Note -> Signal.Signal
- sustainRelease :: Y -> RealTime.RealTime -> Note.Note -> Signal.Signal
- thru :: FilePath -> (Note.Note -> Patch.ConvertM Sample.Sample) -> Code
- imThruFunction :: FilePath -> (Note.Note -> Patch.ConvertM Sample.Sample) -> CUtil.Thru
- thruFunction :: FilePath -> (Note.Note -> Patch.ConvertM Sample.Sample) -> Thru.ThruFunction
- requireMap :: (Ord k, Show k) => Text -> Map k a -> k -> Patch.ConvertM a
- enumAll :: (Enum a, Bounded a) => [a]
- findBelow :: Ord k => (a -> k) -> k -> [a] -> a
- showLower :: Show a => a -> String
- showtLower :: Show a => a -> Text
- assertLength :: (Stack.HasCallStack, Foldable t) => Int -> t a -> t a
Documentation
data SampleFormat Source #
Instances
Show SampleFormat Source # | |
Defined in Synth.Sampler.Patch.Lib.Util showsPrec :: Int -> SampleFormat -> ShowS # show :: SampleFormat -> String # showList :: [SampleFormat] -> ShowS # | |
Eq SampleFormat Source # | |
Defined in Synth.Sampler.Patch.Lib.Util (==) :: SampleFormat -> SampleFormat -> Bool # (/=) :: SampleFormat -> SampleFormat -> Bool # |
extension :: SampleFormat -> String Source #
preprocess
convert
pitch
symbolicPitch :: MonadError Text m => Note.Note -> m (Either Pitch.Note Pitch.NoteNumber) Source #
initialPitch :: MonadError Text m => Note.Note -> m Pitch.NoteNumber Source #
findPitchRatio :: Map Pitch.NoteNumber a -> Pitch.NoteNumber -> (a, Y) Source #
Find a value (presumably a FileName) and pitch ratio for a simple patch with a static NoteNumber mapping.
articulation
articulation :: MonadError Text m => Common.AttributeMap a -> Attrs.Attributes -> m a Source #
articulationDefault :: a -> Common.AttributeMap a -> Attrs.Attributes -> a Source #
dynamic
Standard dynamic ranges.
Instances
Bounded Dynamic Source # | |
Enum Dynamic Source # | |
Read Dynamic Source # | |
Show Dynamic Source # | |
Eq Dynamic Source # | |
Ord Dynamic Source # | |
Defined in Synth.Sampler.Patch.Lib.Util | |
Pretty Dynamic Source # | |
:: (Bounded dyn, Enum dyn) | |
=> (dyn -> (Int, Int)) | Returns velocity instead of dyn, and the lower bound is unnecessary, for compatibility. |
-> Y | Min dyn. This is for normalized samples, where 0 gets this dyn. |
-> Note.Note | |
-> (dyn, Y) |
Get patch-specific dyn category, and note dynamic.
findDynamic :: (Bounded dyn, Enum dyn) => (dyn -> Y) -> Y -> (dyn, Y) Source #
Convert to (Dynamic, DistanceFromPrevDynamic)
chooseVariation :: [a] -> Note.Note -> a Source #
pickVariation :: [a] -> Double -> a Source #
pickDynamicVariation :: Double -> [a] -> Double -> Double -> a Source #
Pick from a list of dynamic variations.
dynamicAutoScale :: (Y, Y) -> (Y, Y) -> Y -> Y Source #
Scale dynamic for non-normalized samples, recorded with few dynamic levels. Since each sample already has its own dynamic level, if I do no scaling, then there will be noticeable bumps as the dynamic thresholds are crossed. So I scale the dynamics of each one by an adjustment to smooth the bumps. But the result will be more bumpy if each sample covers a different width of dynamic range, so I also scale the adjustment by that width.
TODO I think it doesn't actually work though, I need to adjust manually per-sample.
envelope
dynEnvelope :: Y -> RealTime.RealTime -> Note.Note -> Signal.Signal Source #
sustainRelease :: Y -> RealTime.RealTime -> Note.Note -> Signal.Signal Source #
Simple sustain-release envelope.
thru
thru :: FilePath -> (Note.Note -> Patch.ConvertM Sample.Sample) -> Code Source #
imThruFunction :: FilePath -> (Note.Note -> Patch.ConvertM Sample.Sample) -> CUtil.Thru Source #
thruFunction :: FilePath -> (Note.Note -> Patch.ConvertM Sample.Sample) -> Thru.ThruFunction Source #
util
requireMap :: (Ord k, Show k) => Text -> Map k a -> k -> Patch.ConvertM a Source #
showtLower :: Show a => a -> Text Source #
assertLength :: (Stack.HasCallStack, Foldable t) => Int -> t a -> t a Source #