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

Safe Haskell None

Cmd.PitchTrack

Contents

Description

Cmds to edit a pitch track, which is a special kind of control track.

This module creates the pitches that are later parsed by Derive.Control.

Synopsis

# entry

Val edit turns Msg.InputNotes into the appropriate scale degree call for the scale in scope.

Like control tracks, ' will add a ' call, which repeats the last value. This is useful to extend a constant pitch value to the desired breakpoint.

Method edit directs keystrokes to the (optional) call around the pitch call. Pitches by themselves simply set a constant pitch by default, but a call can create an interpolated curve, or a trill, or anything really.

Record the last note entered. Should be called by with_note.

# implementation

old_event -> (new_event, advance?)

Modify event text. This is not used within this module but is exported for others as a more general variant of modify_event_at.

Like ControlTrack.parse, but complicated by the fact that pitch calls can take args.

"x"        -> Event { method = "", val = "x", args = "" }
"x "       -> Event { method = "x", val = "", args = "" }
"x y"      -> Event { method = "", val = "x y", args = "" }
"x (y)"    -> Event { method = "x", val = "(y)", args = "" }
"x (y) z"  -> Event { method = "x", val = "(y)", args = "z" }

This is a bit more complicated than ControlTrack.unparse, since it needs to add or strip parens.

Try to figure out where the pitch call part is in event text and modify that with the given function. The function can signal failure by returning Left.

This is a bit of a heuristic because by design a pitch is a normal call and there's no syntactic way to tell where the pitches are in an expression. If the text is a call with a val call as its first argument, that's considered the pitch call. Otherwise, if the text is just a call, that's the pitch call. Otherwise the text is unchanged.

This works with the convention that pitch calls take the "base" pitch as their first argument.

Modify the note expression, e.g. in i (a b c) it would be (a b c), including the parens.

# edits

Function that modifies the pitch of an event on a pitch track, or a Left if the operation failed.

pitches :: Cmd.M m => ModifyPitch -> m () Source #

Apply a ModifyPitch to only pitch tracks.