Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

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.

Semigroup Code # 
Instance details

Defined in Cmd.Instrument.MidiInst


(<>) :: Code -> Code -> Code #

sconcat :: NonEmpty Code -> Code #

stimes :: Integral b => b -> Code -> Code #

Monoid Code # 
Instance details

Defined in Cmd.Instrument.MidiInst


mempty :: Code #

mappend :: Code -> Code -> Code #

mconcat :: [Code] -> Code #

Pretty.Pretty Code # 
Instance details

Defined in Cmd.Instrument.MidiInst

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 "".


data Patch Source #

Pretty.Pretty Patch # 
Instance details

Defined in Cmd.Instrument.MidiInst

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.


type Load = FilePath -> IO (Maybe Synth) Source #

Instrument definition modules that need to load from disk export a function called load, with this signature. The FilePath is the Config.instrument_dir and could hold cached instruments, as created by MakeDb.

type MakeDb = FilePath -> IO () Source #

Some synths may require a more expensive load, e.g. they could parse a directory full of sysex dumps. These expose a make_db function with this type. As with Load, the FilePath is Config.instrument_dir. The function is expected to do its work and save the results in the instrument dir

You should use save_synth, which will put the file into Config.instrument_cache_dir with the same name as the synth.