Safe Haskell | Safe-Inferred |
---|
Functions to parse MIDI patch files.
Synopsis
- type Parser st a = Parse.ParserS st a
- type Annotation = Tag.Tag
- parse_annotations :: FilePath -> IO (Either String (Map InstT.Qualified [Annotation]))
- p_annotation_file :: Parser st [(InstT.Qualified, [Annotation])]
- p_annotation_line :: Parser st (InstT.Qualified, [Annotation])
- p_qualified :: Parser st InstT.Qualified
- p_tag :: Parser st Tag.Tag
- lexeme :: Parser st a -> Parser st a
- p_eol :: Parser st ()
- p_whitespace :: Parser st ()
- patch_file :: FilePath -> IO [Sysex.Patch]
- parse_patch_file :: String -> IO (Either Text [Sysex.Patch])
- data State = State {}
- empty_state :: State
- data PatchLine = PatchLine {
- patch_name :: Text
- patch_bank :: Int
- patch_program :: Midi.Program
- patch_tags :: [Tag.Tag]
- p_patch_file :: Parser State [Sysex.Patch]
- make_patch :: Control.PbRange -> PatchLine -> Sysex.Patch
- p_line :: Parser State (Maybe.Maybe PatchLine)
- p_patch_line :: Parser State PatchLine
- p_bank_decl :: Parser State ()
Documentation
type Parser st a = Parse.ParserS st a Source #
annotation file
type Annotation = Tag.Tag Source #
parse_annotations :: FilePath -> IO (Either String (Map InstT.Qualified [Annotation])) Source #
Format is synth/inst-name tag1=x tag2=y
.
TODO other attributes are not supported, but if there were, they could look
like *pb-range=12 *flag=pressure
p_annotation_file :: Parser st [(InstT.Qualified, [Annotation])] Source #
p_annotation_line :: Parser st (InstT.Qualified, [Annotation]) Source #
p_qualified :: Parser st InstT.Qualified Source #
p_whitespace :: Parser st () Source #
patch file
patch_file :: FilePath -> IO [Sysex.Patch] Source #
Parse a simple ad-hoc text file format to describe a synth's built-in patches.
Each line should look like inst-name, tag=val, tag=val, ...
.
The instrument name can contain any character except a comma, but the
tags are restricted to [a-z0-9-]. The category
tag is treated specially:
if not set it will be inherited from the previous category.
The patch's program change is incremented for each patch. A line like
*bank num
sets the bank number and resets the program change to 0.
Comments start with #
, and blank lines are ignored.
parse_patch_file :: String -> IO (Either Text [Sysex.Patch]) Source #
empty_state :: State Source #
PatchLine | |
|
make_patch :: Control.PbRange -> PatchLine -> Sysex.Patch Source #
p_bank_decl :: Parser State () Source #