Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
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.


Instances details
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 Symbols.default_note, since that's supposed to be the "named" way to call "".


data Patch Source #


Instances details
Pretty.Pretty Patch # 
Instance details

Defined in Cmd.Instrument.MidiInst

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

Convert patches as emitted by Patch.

named_patch :: Control.PbRange -> InstTypes.Name -> [(Midi.Control, ScoreT.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, ScoreT.Control)] -> Patch Source #

Make a default patch for the synth.


synth_controls :: [(Midi.Control, ScoreT.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.


inst_range :: Scale.Range -> Common.Config -> Common.Config Source #

Like range, but set it in the allocation, not the patch.


allocations Source #


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


save_synth :: Path.AppDir -> 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 = Path.AppDir -> IO (Maybe Synth) Source #

Instrument definition modules that need to load from disk export a function called load, with this signature. Use the AppDir to find Config.instrument_dir.

type MakeDb = Path.AppDir -> 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.