velocity

Function summary
max-velocity velocities &key (type :float)
min-velocity velocities &key (type :float)
simplify-dynamics notation &key (flat t)
velocity-add offset velocities &key (simplify t)
velocity-apply fun velocities &key (type :float)
velocity-fenvs lengths &rest dynamics-fenvs
velocity-fenvs2 sequence dynamics-fenvs &key (omn t)
velocity-smooth alfa velocities &key (simplify t)
velocity-transform fun args &key (simplify t)
_simplify-dynamics dynamics &key (flat t)
_velocity-add offset velocities &key (simplify t)
_velocity-smooth alfa velocities &key (simplify t)
velocity-fenvs   lengths &rest dynamics-fenvs  [Function]

Generates dynamics markers (velocities) for OMN `lengths'. Dynamics for each phrase (notes between rests) are defined by their own fenv (if fewer fenvs are defined, they are circled through). Returns a sublist for each phrase.

Arguments:

  • lengths: OMN `lengths' (list or list of list)

  • each dynamics-fenv has the form (<min-vel> <max-vel> &rest points), where `min-vel' and `max-vel' are dynamic indicators like pp or f, and points are pairs of linear fenv points.

Examples:

    (velocity-fenvs  '((1/4 1/8 1/8) (1/4 -1/4) (1/4 1/4) (1/4 -1/4)) 
                      '(pp mp (0 0) (0.7 1) (1 0))) 
     => ((pp< p< > pp) (pp< > pp)) 

velocity-fenvs2   sequence dynamics-fenvs &key (omn t)  [Function]

Generates dynamics markers (velocities) for OMN `lengths'. Dynamics for each phrase (notes between rests) are defined by their own fenv (if fewer fenvs are defined, they are circled through). Returns a sublist for each phrase.

Arguments:

  • lengths (list): OMN length values or OMN sequence, can be nested

  • dynamics-fenvs: One dynamics-fenv or list of them. Each dynamics-fenv has the form (<min-vel> <max-vel> &rest points), where `min-vel' and `max-vel' are dynamic indicators like pp or f, and points are pairs of linear fenv points.

  • omn (Boolean): whether to return a plain velocity list or OMN expression

Examples:

    (velocity-fenvs  '((1/4 1/8 1/8) (1/4 -1/4) (1/4 1/4) (1/4 -1/4)) 
                      '(pp mp (0 0) (0.7 1) (1 0))) 
     => ((pp< p< > pp) (pp< > pp)) 

BUG: not working yet

_simplify-dynamics   dynamics &key (flat t)  [Function]
simplify-dynamics   notation &key (flat t)  [Function]

Removes intermediate textual dynamic indicators from longer hairpins (e.g., generated by velocity-to-dynamic or gen-dynamic).

Arguments:

  • notation: list of OMN dynamics values in multiple formats (can be nested)

  • flat (default T): whether or not to simplify dynamics across sublists.

Examples:

    (simplify-dynamics '(pppp< < ppp< pp< < p< < mp< mf< < f< < ff> > mf> mp> p> ppp> pppp)) 
     => (pppp< < < < < < < < < < < < ff> > > > > > pppp) 

    (simplify-dynamics '((pppp< < ppp< pp< < p< <) (mp< mf< < f< < ff> > mf> mp> p> ppp> pppp))) 
     => ((pppp< < < < < < <) (< < < < < ff> > > > > > pppp)) 

    (simplify-dynamics '((pppp< < ppp< pp< < p< <) (mp< mf< < f< < ff> > mf> mp> p> ppp> pppp)) 
                         :flat nil) 
     => ((pppp< < < < < < <) (mp< < < < < ff> > > > > > pppp)) 

using omn input

    (simplify-dynamics '((e c4 p< d4 < e4 mf< f4 < g4 f))) 
     => ((e c4 p< d4 < e4 < f4 < g4 f)) 

processing MIDI velocity integers

    (simplify-dynamics '((10 20 30 40) (50 60 50 30))) 
     => ((pppp < < <) (< mp > ppp)) 

processing floats

    (simplify-dynamics '((0.1 0.2 0.3 0.4) (0.5 0.6 0.5 0.3))) 
     => ((pppp < < <) (< f > pp)) 

BUGS:

This is not correct -- various problems.

    (simplify-dynamics 
      '((h c4 f> pp<) (q c4 f> mf> p> pp<) (h c4 f> pp<) (q c4 f> p> pp c4) (h c4 f> pp<) (q c4 f> mf> p> pp<))) 

velocity-apply   fun velocities &key (type :float)  [Function]

Applies a numeric function `fun' to a list of symbolic velocity values `velocities', which are translated into floats in the background.

Examples:

(velocity-apply #'min '(p mf pp ff) :type :symbol) =>pp

min-velocity   velocities &key (type :float)  [Function]
max-velocity   velocities &key (type :float)  [Function]
velocity-transform   fun args &key (simplify t)  [Function]

Higher-order function for transforming velocities by processing them as an Openmodus vector in the background.

Arguments:

  • fun: a function expecting a vector and possibly more arguments.

  • args: the arguments for `fun'. Velocities should be explicitly transformed into numeric values. Example args value: (get-velocity '(mf> > > > > pp))

  • simplify: whether or not to simplify cresc. and dim. in the result with simplify-dynamics.

Examples:

    (velocity-transform #'vector-add (list (get-velocity '(mf> > > > > pp)) '(0.1))) 
_velocity-add   offset velocities &key (simplify t)  [Function]
velocity-add   offset velocities &key (simplify t)  [Function]

Adds an offset to a list of OMN velocities. Quasi the dynamics equivalent of pitch transposition.

Arguments:

  • offset: an offset added to `velocities', can be numeric (between 0 and 1) or a velocity symbol (e.g., pp), and also a list of either.

  • velocities: list of velocities, can be nested.

  • simplify: whether or not to simplify cresc. and dim. in the result with simplify-dynamics.

Examples:

    (velocity-add 0.1 '(mf> > > > > pp)) 
     => (f> > > > > p) 

    (velocity-add 'pppp '(mf> > > > > pp)) 
     => (f> > > > > p) 

    (velocity-add 0.1 '((mf> > >) (> > pp))) 
     => ((f> > >) (> > p)) 

    (velocity-add '(0.1 0.2 0.3 0.4 0.5 0.6) '(mf> > > > > pp)) 
     => (f< < < < < ffff) 

omn input

    (velocity-add 0.15 '((e c4 p< d4 < e4 mf< f4 < g4 f))) 
     => ((e c4 mf< d4 < e4 < f4 < g4 fff)) 

_velocity-smooth   alfa velocities &key (simplify t)  [Function]
velocity-smooth   alfa velocities &key (simplify t)  [Function]

Smoothes velocity values.

Arguments:

  • alfa: parameter controlling the degree of exponential smoothing (usually 0 < alpha < 1).

  • velocities: list of velocities, can be nested.

  • simplify: whether or not to simplify cresc. and dim. in the result with simplify-dynamics.

Examples:

    (velocity-smooth 0.7 '((ppp p mf ff p< < <) (fff> > f><p ff mf p ppp))) 
     => ((ppp< < < mp< < mp< <) (f< ff> > < ff> > mp)) 

    (velocity-smooth 0.2 '((ppp p mf ff p< < <) (fff> > f><p ff mf p ppp))) 
     => ((ppp< < < < < < <) (< mf mf mf mf mf mf))