Safe Haskell | Safe-Inferred |
---|
Utilities for the instrument definitions in Local.Instrument.
Synopsis
- type Synth = Inst.SynthDecl Cmd.InstrumentCode
- synth :: InstT.SynthName -> Text -> [Patch] -> Synth
- make_inst :: Patch -> Inst.Inst Cmd.InstrumentCode
- make_code :: Code -> Cmd.InstrumentCode
- data Code = Code {}
- data Call d
- generator :: Expr.Symbol -> Generator d -> Call d
- transformer :: Expr.Symbol -> Transformer d -> Call d
- both :: Expr.Symbol -> Library.Calls d -> Call d
- note_calls :: [Call Note] -> Code
- note_generators :: [(Expr.Symbol, Generator Note)] -> Code
- note_transformers :: [(Expr.Symbol, Transformer Note)] -> Code
- val_calls :: [(Expr.Symbol, ValCall)] -> Code
- null_call :: Generator Note -> Code
- null_calls :: Generator Note -> [Call Note]
- postproc :: Cmd.InstrumentPostproc -> Code
- cmd :: Cmd.HandlerId -> Code
- thru :: Cmd.ThruFunction -> Code
- data Patch = Patch {}
- patch :: Patch :-> Patch.Patch
- common :: Patch :-> Common.Common Code
- make_patch :: Patch.Patch -> Patch
- patch_from_pair :: (Patch.Patch, Common.Common ()) -> Patch
- named_patch :: Control.PbRange -> InstT.Name -> [(Midi.Control, ScoreT.Control)] -> Patch
- default_patch :: Control.PbRange -> [(Midi.Control, ScoreT.Control)] -> Patch
- dummy :: Text -> Patch -> Patch
- code :: Lens.Lens Patch Code
- doc :: Lens.Lens Patch Doc.Doc
- attribute_map :: Lens.Lens Patch Patch.AttributeMap
- decay :: Lens.Lens Patch (Maybe RealTime)
- synth_controls :: [(Midi.Control, ScoreT.Control)] -> [Patch] -> [Patch]
- add_flag :: Patch.Flag -> Patch.Patch -> Patch.Patch
- add_flags :: [Patch.Flag] -> Patch.Patch -> Patch.Patch
- pressure :: Patch -> Patch
- add_common_flag :: Common.Flag -> Patch -> Patch
- triggered :: Patch -> Patch
- control_defaults :: [(ScoreT.Control, Signal.Y)] -> Patch -> Patch
- environ :: REnv.ToVal a => EnvKey.Key -> a -> Patch -> Patch
- range :: Scale.Range -> Patch -> Patch
- nn_range :: (Pitch.NoteNumber, Pitch.NoteNumber) -> Patch -> Patch
- inst_range :: Scale.Range -> Common.Config -> Common.Config
- allocations :: [(ScoreT.Instrument, InstT.Qualified, Common.Config -> Common.Config, UiConfig.Backend)] -> UiConfig.Allocations
- config :: [Patch.Addr] -> Patch.Config
- config1 :: Midi.WriteDevice -> Midi.Channel -> Patch.Config
- type Load = Path.AppDir -> IO (Maybe Synth)
- type MakeDb = Path.AppDir -> IO ()
Documentation
type Synth = Inst.SynthDecl Cmd.InstrumentCode Source #
code
make_code :: Code -> Cmd.InstrumentCode Source #
A version of Cmd.InstrumentCode
that's more convenient for record update
syntax.
Bundle together generators and transformers. The rationale is described
in CallMaps
.
transformer :: Expr.Symbol -> Transformer d -> Call d Source #
both :: Expr.Symbol -> Library.Calls d -> Call d Source #
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 "".
cmd :: Cmd.HandlerId -> Code Source #
thru :: Cmd.ThruFunction -> Code Source #
Patch
make_patch :: Patch.Patch -> Patch Source #
patch_from_pair :: (Patch.Patch, Common.Common ()) -> Patch Source #
Convert patches as emitted by Patch
.
named_patch :: Control.PbRange -> InstT.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.
modify
synth_controls :: [(Midi.Control, ScoreT.Control)] -> [Patch] -> [Patch] Source #
Annotate all the patches with some global controls.
add_flag :: Patch.Flag -> Patch.Patch -> Patch.Patch Source #
add_flags :: [Patch.Flag] -> Patch.Patch -> Patch.Patch Source #
add_common_flag :: Common.Flag -> Patch -> Patch Source #
control_defaults :: [(ScoreT.Control, Signal.Y)] -> Patch -> Patch Source #
environ
environ :: REnv.ToVal a => EnvKey.Key -> a -> Patch -> Patch Source #
The instrument will also set the given environ when it comes into scope.
nn_range :: (Pitch.NoteNumber, Pitch.NoteNumber) -> Patch -> Patch Source #
per-allocation
inst_range :: Scale.Range -> Common.Config -> Common.Config Source #
Like range
, but set it in the allocation, not the patch.
allocations
:: [(ScoreT.Instrument, InstT.Qualified, 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.
types
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
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 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 instrument_cache_dir
with the same name as the synth.