Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Cmd.Instrument.MidiInst

Contents

Description

Utilities for the instrument definitions in Local.Instrument.

Synopsis

Documentation

code

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 -> [Call Note] 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 "".

Patch

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, 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, Control)] -> Patch Source #

Make a default patch for the synth.

modify

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

Annotate all the patches with some global controls.

pressure :: Patch -> Patch Source #

Set a patch to pressure control.

environ

environ :: RestrictedEnviron.ToVal a => 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

allocations Source #

Arguments

:: [(Text, 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.

db

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.