Karya, built on 2018-02-23T20:23:55 (patch cf8565b7ac832266878af99a942555d139065f12)

Safe HaskellNone




Utilities for the instrument definitions in Local.Instrument.




data Code Source #

A version of Cmd.InstrumentCode that's more convenient for record update syntax.


data Call d Source #

Bundle together generators and transformers. The rationale is described in CallMaps.

note_generators :: [(Expr.Symbol, Generator Note)] -> Code Source #

Add the given calls to the note track scope.

note_transformers :: [(Expr.Symbol, Transformer Note)] -> Code Source #

Add the given calls to the note track scope.

null_call :: Generator Note -> Code Source #

Add the given call as the null note call to the note track. This also binds n, since n is supposed to be the "named" way to call "".


make_patch :: Patch.Patch -> Patch Source #

Make a patch. Get the name from Patch.patch_name. TODO: pass the name independently

patch_from_pair :: (Patch.Patch, Common.Common ()) -> Patch Source #

Convert patches as emitted by Patch.

named_patch :: Control.PbRange -> InstTypes.Name -> [(Midi.Control, Score.Control)] -> Patch Source #

Make a patch, with a few parameters that tend to be unique per patch. Controls come last because they are often a long list.

TODO I don't love the name, but patch is already taken by the lens.

default_patch :: Control.PbRange -> [(Midi.Control, Score.Control)] -> Patch Source #

Make a default patch for the synth.


synth_controls :: [(Midi.Control, Score.Control)] -> [Patch] -> [Patch] Source #

Annotate all the patches with some global controls.

pressure :: Patch -> Patch Source #

Set a patch to pressure control.


environ :: RestrictedEnviron.ToVal a => EnvKey.Key -> a -> Patch -> Patch Source #

The instrument will also set the given environ when it comes into scope.

default_scale :: Pitch.ScaleId -> Patch -> Patch Source #

The instrument will set the given scale when it comes into scope.

range :: Scale.Range -> Patch -> Patch Source #

Set instrument range.


allocations Source #


:: [(Score.Instrument, Text, Common.Config -> Common.Config, UiConfig.Backend)]

(inst, qualified, set_config, backend)

-> UiConfig.Allocations 

config :: [Patch.Addr] -> Patch.Config Source #

Create an incomplete Config. It's incomplete because it doesn't have the Settings from Patch.patch_defaults, so it'll need to have those applied when it gets applied to state_allocations.

config1 :: Midi.WriteDevice -> Midi.Channel -> Patch.Config Source #

Specialize config for a single Addr.

merge_defaults :: Cmd.Inst -> UiConfig.Allocation -> Either Text UiConfig.Allocation Source #

Merge an incomplete allocation with defaults from its instrument.


save_synth :: FilePath -> InstTypes.SynthName -> [Patch] -> IO () Source #

Some instruments want to load their patches in elaborate slow ways, like parsing a directory full of sysexes. These patches can export a make_db function, which will do the slow parts and save the results in a cache file. The load function will simply read the cache file, if present.

check_names :: [Patch] -> (Map InstTypes.Name Patch, [InstTypes.Name]) Source #

Like generate_names, but don't drop or rename duplicates, just report them as errors.

generate_names :: [Patch] -> (Map InstTypes.Name Patch, [Text]) Source #

inst_name is the name as it appears on the synth, so it's not guaranteed to be unique. Also, due to loading from sysexes, there may be duplicate patches. Generate valid names for the patches, drop duplicates, and disambiguate names that wind up the same.

clean_name :: Text -> InstTypes.Name Source #

People like to put wacky characters in their names, but it makes them hard to type.