Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred

Synth.Sampler.Patch.Lib.Util

Description

General utilities for sampler patches.

Synopsis

preprocess

nextsBy :: Eq key => (a -> key) -> [a] -> [(a, [a])] Source #

nexts :: [a] -> [(a, [a])] Source #

convert

pitch

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

dynamic

data Dynamic Source #

Standard dynamic ranges.

Constructors

PP 
MP 
MF 
FF 

Instances

Instances details
Bounded Dynamic Source # 
Instance details

Defined in Synth.Sampler.Patch.Lib.Util

Enum Dynamic Source # 
Instance details

Defined in Synth.Sampler.Patch.Lib.Util

Read Dynamic Source # 
Instance details

Defined in Synth.Sampler.Patch.Lib.Util

Show Dynamic Source # 
Instance details

Defined in Synth.Sampler.Patch.Lib.Util

Eq Dynamic Source # 
Instance details

Defined in Synth.Sampler.Patch.Lib.Util

Methods

(==) :: Dynamic -> Dynamic -> Bool #

(/=) :: Dynamic -> Dynamic -> Bool #

Ord Dynamic Source # 
Instance details

Defined in Synth.Sampler.Patch.Lib.Util

Pretty Dynamic Source # 
Instance details

Defined in Synth.Sampler.Patch.Lib.Util

dynamic Source #

Arguments

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

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

sustainRelease :: Y -> RealTime.RealTime -> Note.Note -> Signal.Signal Source #

Simple sustain-release envelope.

thru

util

requireMap :: (Ord k, Show k) => Text -> Map k a -> k -> Patch.ConvertM a Source #

enumAll :: (Enum a, Bounded a) => [a] Source #

findBelow :: Ord k => (a -> k) -> k -> [a] -> a Source #

showtLower :: Show a => a -> Text Source #