Safe Haskell | Safe-Inferred |
---|
Utilities shared between drum patches.
The base structure is that a drum has an enumeration of articulations, where each one is a directory of samples of increasing dynamics. There are an arbitrary number of samples, which may or may not be normalized, which form a continuum, rather than having explicit dynamic groups. Since there are no explicit variation samples, variation takes neighbor dynamics, where the variation range is defined per-patch.
There is a Common.AttributeMap
mapping attrs to each articulation.
Synopsis
- patch :: Ord art => FilePath -> Note.PatchName -> StrokeMap art -> ConvertMap art -> (Maybe.Maybe art -> CUtil.CallConfig) -> Patch.Patch
- karyaPatch :: FilePath -> StrokeMap art -> ConvertMap art -> (Maybe.Maybe art -> CUtil.CallConfig) -> [(Maybe.Maybe Char, Expr.Symbol, Generator Note)] -> ImInst.Patch
- makePatch :: Common.AttributeMap a -> Bool -> ImInst.Patch
- data ConvertMap art = ConvertMap {
- _dynRange :: (Y, Y)
- _naturalNn :: Maybe.Maybe (art -> Pitch.NoteNumber)
- _muteTime :: Maybe.Maybe RealTime.RealTime
- _getFilename :: art -> Y -> Y -> (FilePath, Maybe.Maybe (Y, Y))
- _allFilenames :: Set FilePath
- variableDynamic :: Show art => Y -> (art -> [FilePath]) -> art -> Y -> Y -> (FilePath, Maybe.Maybe a)
- allFilenames :: (Stack.HasCallStack, Enum a, Bounded a, Show a) => Int -> (a -> [FilePath]) -> Set FilePath
- convert :: Common.AttributeMap art -> ConvertMap art -> Note.Note -> Patch.ConvertM Sample.Sample
- data StrokeMap art = StrokeMap {
- _stops :: Map art (Set art)
- _strokes :: [(Drums.Stroke, Maybe.Maybe art)]
- _attributeMap :: Common.AttributeMap art
- _extraCalls :: [(Maybe.Maybe Char, Expr.Symbol, Generator Note)]
- strokeMapSimple :: Ord art => Drums.Stops -> [(Char, Expr.Symbol, Attrs.Attributes, art, Drums.Group)] -> StrokeMap art
- data Call art
- strokeMapTable :: Ord art => Drums.Stops -> [(Char, Expr.Symbol, Call art)] -> StrokeMap art
- addAttributeMap :: Common.AttributeMap art -> StrokeMap art -> StrokeMap art
- replaceSoft :: Y -> StrokeMap art -> StrokeMap art
- strokeMap :: Ord art => Drums.Stops -> [Drums.Stroke] -> Common.AttributeMap art -> StrokeMap art
- stopMap :: Ord art => [(art, Drums.Group)] -> [(Drums.Group, [Drums.Group])] -> Map art (Set art)
- inferDuration :: Ord art => StrokeMap art -> [Note.Note] -> [Note.Note]
- inferEnd :: Ord art => StrokeMap art -> Note.Note -> [Note.Note] -> RealTime.RealTime
- makeFileList :: FilePath -> [FilePath] -> String -> IO ()
- filenameSortKey :: FilePath -> Int
- enumFunction :: (Typeable.Typeable a, Show a, Typeable.Typeable b, Pretty b) => String -> [(a, [b])] -> [String]
patch
patch :: Ord art => FilePath -> Note.PatchName -> StrokeMap art -> ConvertMap art -> (Maybe.Maybe art -> CUtil.CallConfig) -> Patch.Patch Source #
Make a complete sampler patch with all the drum bits.
karyaPatch :: FilePath -> StrokeMap art -> ConvertMap art -> (Maybe.Maybe art -> CUtil.CallConfig) -> [(Maybe.Maybe Char, Expr.Symbol, Generator Note)] -> ImInst.Patch Source #
Make a patch with the drum-oriented code in there already.
makePatch :: Common.AttributeMap a -> Bool -> ImInst.Patch Source #
Make an unconfigured patch, without code, in case it's too custom for
karyaPatch
.
convert
data ConvertMap art Source #
Arguments for the convert
function.
ConvertMap | |
|
:: Show art | |
=> Y | A note may pick a sample of this much dyn difference on either side. |
-> (art -> [FilePath]) | |
-> art -> Y -> Y -> (FilePath, Maybe.Maybe a) |
Create a _getFilename
with the strategy where each articulation has
a [FilePath]
, sorted evenly over the dynamic range.
allFilenames :: (Stack.HasCallStack, Enum a, Bounded a, Show a) => Int -> (a -> [FilePath]) -> Set FilePath Source #
_allFilenames
for ConvertMaps that use variableDynamic
and
makeFileList
.
convert :: Common.AttributeMap art -> ConvertMap art -> Note.Note -> Patch.ConvertM Sample.Sample Source #
Make a generic convert, suitable for drum type patches.
StrokeMap
Describe a drum-like instrument. This is just the data for the various functions to construct the patch.
StrokeMap | |
|
strokeMapSimple :: Ord art => Drums.Stops -> [(Char, Expr.Symbol, Attrs.Attributes, art, Drums.Group)] -> StrokeMap art Source #
Like strokeMapTable
, but for patches with only Stroke
s.
Call (Generator Note) | A call that doesn't correspond directly to Attributes. |
Stroke Attrs.Attributes art Drums.Group | Emit a call that produces these Attributes, and cause the patch to assign those Attributes to the given articulation. |
Attr Attrs.Attributes | Emit a call that produces these Attributes, with no articulation association. |
:: Ord art | |
=> Drums.Stops | |
-> [(Char, Expr.Symbol, Call art)] | If Char == ' ', there is no key binding. Symbol == "" means there
is no call, but it still makes sense for |
-> StrokeMap art |
Make a StrokeMap describing the keymap and call map of a drum-like patch.
addAttributeMap :: Common.AttributeMap art -> StrokeMap art -> StrokeMap art Source #
replaceSoft :: Y -> StrokeMap art -> StrokeMap art Source #
Set dynamic for Attrs.soft and remove it.
strokeMap :: Ord art => Drums.Stops -> [Drums.Stroke] -> Common.AttributeMap art -> StrokeMap art Source #
Make a StrokeMap from separate strokes and AttributeMap. This happens when instruments parts are factored apart, due to having both MIDI and im versions.
stopMap :: Ord art => [(art, Drums.Group)] -> [(Drums.Group, [Drums.Group])] -> Map art (Set art) Source #
inferDuration
inferDuration :: Ord art => StrokeMap art -> [Note.Note] -> [Note.Note] Source #
Notes ring until stopped by their stop note.
file list
makeFileList :: FilePath -> [FilePath] -> String -> IO () Source #
Generate haskell code for an Articulation -> [FilePath] function.
This expects a subdirectory for each articulation, whose name is the same as the Articulation constructor, and sorts it on the last numeric dash-separated field.
This could be done with TH but it's constant so it's simpler to copy paste into the source.
filenameSortKey :: FilePath -> Int Source #
enumFunction :: (Typeable.Typeable a, Show a, Typeable.Typeable b, Pretty b) => String -> [(a, [b])] -> [String] Source #
Emit haskell code for a function from an Enum to lists.