rhythm

Function summary
bpm->duration beats tempo
cut-holes sequence binary-list &key (swallow nil)
divide-selected sequence &key (select #'min) (divide 2) (count 1) section seed
divide-shortest sequence &key (divide 2) (count nil) (section nil) (seed nil)
durational-accent lengths &key (divide 2) (divide-n 1) (divide-prob 0.5) (tie-n 0) (tie-prob 0.5) (tie-previous-beat? nil) (grace-n 0) (grace-length 1/8) (grace-prob 0.5) (merge-n 2) (merge-prob 0.5) (whole-note-prob 0.1) (set nil) (ignore nil) (seed nil) (format :omn)
even-length-rhythm total-duration pattern &key prefix suffix (time-sig '(4 4))
insert-into-bar positions new lengths &key section seed
isolate-time-signatures ts-forms
length->time-signature sequence
length-divide-ext count divide length &rest args &key seed
lengths-with-merged-ties sequence
map-tuplet fn lengths &rest arglist
merge-rest-into-note sequence &key (flat nil) (section nil)
metric-shift l lengths
note-rest-series positions sequence &key (flat nil) (swallow nil) (section nil)
position-to-rest position sequence &key (n 1) (flat nil) (swallow t) (section nil) (seed nil)
replace-rhythm-fenved sequence new-rhythm &key (type :steps) (x-values :rhythm)
shift-meter-boundaries lengths positions
tie-whole-notes lengths tie-prob &key (seed nil)
tuplet-rhythm lengths subdivisions &rest args &key (length-dividend 1/2) (count-offset 0) (position 'e) (type '?) seed &allow-other-keys
tuplet-walk-rhythm bar-no &key (bar-length 1/2) (subdivisions-ambitus '(2 7)) (rest-distances '(7 8 9)) (rest-distance-order :rnd) (last-bar nil) (seed nil)
_cut-holes lengths binary-list
_durational-accent-divide lengths &key (divide 2) (n 1) (divide-prob 0.5) (tie-n 0) (tie-prob 0.5) (tie-previous-beat? nil) (grace-n 0) (grace-length 1/8) (grace-prob 0.5) (set nil) (ignore nil) (seed nil)
_durational-accent-merge lengths &key (n 2) (prob 0.5) (seed nil)
_durational-accent-whole-note lengths &key (whole-note-prob 0.1) (seed nil)
_map-tuplet-internal fn lengths more-args &key (type :extend)
_merge-rest-into-note lengths
_partition-args keywords arglist
_position-to-rest position lengths &key (n 1) (seed nil)
_remove-rest-articulations sequence
replace-rhythm-fenved   sequence new-rhythm &key (type :steps) (x-values :rhythm)  [Function]

Replaces the rhythm in `sequence' with the given `new-rhythm' in such a way that the number of notes can change while the overall development of the other parameters is retained. The resulting sequence using the time signature of `new-rhythm' as well (if `new-rhythm' is a nested list).

Internally, the function represents other parameter values with fenvs to retain their overall development, hence the function name.

Arguments:

  • sequence: OMN sequence

  • new-rhythm: length list or OMN sequence where only the lengths are used

  • type (either :steps or :linear): how to interpolate between parameter values for fenvs. Can be :steps (a step function, i.e. parameter values are hold by the fenv until the next value) or :linear (linear interpolation).

  • x-values (either :rhythm or :equidistant): whether the x-values of internal fenvs follow the rhythm of `sequence' or are equidistant, where points are spread evenly across the x axis.

BUGS:

Seemingly arg x-values not quite working yet as intended.

tuplet-rhythm   lengths subdivisions &rest args &key (length-dividend 1/2) (count-offset 0) (position 'e) (type '?) seed &allow-other-keys  [Function]

Subdivides given note `lengths'.

Arguments:

  • lengths: list of length values, can be nested.

  • subdivisions: (circling list of ints) specifies tuplet sequence.

  • length-dividend (default 1/2): duration ratio divided by subdivisions. Default case are half note subdivisions, ie. a subdivision of 3 results 3h notes (triplets splitting a half note).

  • count-offset (default -1): `subdivisions' also specifies number of equally spaced notes per tuplet plus amount of `count-offset' . I.e., if `count-offset' = 0 then each note is split into subdivision notes. All keyword args from `length-subdivision' are inherited, but some with different default.

Examples:

    (tuplet-rhythm '(1/2 1/2 1/2) '(3 4 5)) 
     => (1/6 1/6 1/6 1/8 1/8 1/8 1/8 1/10 1/10 1/10 1/10 1/10) 

    (tuplet-rhythm (gen-repeat 8 '((1/2))) '(3 4 5 6 5 4 3 2)) 

With irregular meter

    (tuplet-rhythm (gen-eval 4 '(gen-repeat (rnd1 :low 2 :high 5) 'h)) '(3 4 5 6 5 4 3 2) :seed 1234) 

BUGS:

Seed argument not working as expected -- it is not even used in this function!

tuplet-walk-rhythm   bar-no &key (bar-length 1/2) (subdivisions-ambitus '(2 7)) (rest-distances '(7 8 9)) (rest-distance-order :rnd) (last-bar nil) (seed nil)  [Function]

Some custom algorithm to create rhythmic phrases that randomly walk across tuplet subdivisions and includes some rests.

Arguments:

  • bar-no (int): number of bars to generate

  • bar-length: regular duration of resulting bars

  • subdivisions-ambitus: range of tuplet subdivisions

  • rest-distances: distances between rests

  • rest-distance-order (:rnd or :seq): whether rest distances will be in the given order (:seq) or randomised (:rnd)

  • last-bar (flat or nested OMN expression, but typically only a rhythm): one or more bars added at end after bar-no bars. If nil, no bar is added.

Examples:

    (tuplet-walk-rhythm 7 :seed 569 :rest-distances '(9 1 13) :last-bar '(1/4 -1/4)) 

even-length-rhythm   total-duration pattern &key prefix suffix (time-sig '(4 4))  [Function]

Custom algorithm to create rhythmic phrases consisting of even note durations over a certain time.

Arguments:

  • total-duration (length value): duration of the generated phrase including the prefix and suffix length.

  • pattern (length value, list of length values, or OMN sequence): rhythmic value(s) to repeat

  • prefix (length value, list of length values, or OMN sequence): preceeding phrase

  • suffix (length value, list of length values, or OMN sequence): succeeding phrase

  • time-sig: time signature

Examples:

    (even-length-rhythm 'w_w '5q :prefix '-w_5h :suffix '-5q_5h_q) 

Lists and OMN sequences can be specified for pattern, prefix and suffix

    (even-length-rhythm 'w_w_w '(3q c4 stacc 3e) :prefix '-3h :suffix '(q b3d4 -q)) 
tie-whole-notes   lengths tie-prob &key (seed nil)  [Function]

Every bar with only a single note in it is potentially tied over to the next bar, and that way can increase the degree of rhythmic contrast in a rhythmic sequence.

NOTE: this function is intended for processing note length values only, as ties are otherwise also affected by pitches. If given a full OMN sequence, then nevertheless only the transformed rhythm is returned.

Arguments:

  • sequence (nested OMN length sequence): input rhythm to process.

  • tie-prob (number or list of numbers): Probability whether 'whole' notes (notes filling a whole sublist) are tied or not. If 1, all whole notes are tied; if 0, no note is tied; any number in between sets the probability. If a list of numbers, it sets the probability of individual whole notes in order to be tied over. For example, `tie-prob' can be a list of binary numbers generated with Openmodus' binary number functions.

  • seed (integer): random seed for probability.

Examples:

Enforce tie at end of every bar with only a single note by setting the probability to 1 (except the last -- there is never a tied added at the end of the last bar).

    (tie-whole-notes '((h) (q q) (h) (h)) 1) 

Whether or not a tie is added is randomised and should be rather evenly distributed (probability is 0.7).

    (tie-whole-notes '((h) (q q) (h) (h)) 0.7) 

The tie probability is controlled for individual 'whole' notes in the sequence. Note that the probabilities are only given for the actual 'whole' notes, not intermediate bars.

    (tie-whole-notes '((h) (q q) (h) (h)) '(0 1)) 
divide-selected   sequence &key (select #'min) (divide 2) (count 1) section seed  [Function]

Transform the rhythm (e.g., increase or reduce rhythmic contrast) by dividing selected notes in the given `sequence' (e.g., the shortest or longest note).

Arguments:

  • sequence: OMN length sequence

  • select: function expecting 1 or more numbers (length values) and returning the rhythmic value to subdivide.

All other arguments are inherited from the Opusmodus buildin `length-divide`, see its documentation for more details.

NOTE: For simple cases, this function is not really needed: the Opusmodus buildin `length-divide` arg `set` also supports values `min` and `max` (which can be combined with the arg `ignore` set to `min` or `max`). However, here `select` is a function, which provides more flexibility.

Examples:

By default, the shortest notes are subdivided.

    (divide-selected '(1/8 1/16 1/16)) 

;; BUG:

    (divide-selected '(1/8 1/16 1/16 1/16 1/16) :count 2) 

A different note value can be set with the argument select. The next example divides instances of the longest notes value.

    (divide-selected '(1/8 1/16 1/16 1/8) :count 1 :select #'max) 

Note that if `sequence` is a full OMN expression, then the added notes cause all other parameters to shift forward. Additional parameters are added at the end by circling.

    (divide-selected '((e c4 s d4 e4) (e f4 s e4 d4) (q g4))) 

    (divide-selected '((e c4 s d4 e4) (e f4 s e4 d4) (q g4)) :section '(1)) 

divide-shortest   sequence &key (divide 2) (count nil) (section nil) (seed nil)  [Function]

Simplified variant of divide-selected kept only for backwards compatibility.

_partition-args   keywords arglist  [Function]

[Aux for map-tuplet] Partition the argument list around the first argument that is in KEYWORDS.

_map-tuplet-internal   fn lengths more-args &key (type :extend)  [Function]

[Aux for map-tuplet] Defines actual function.

map-tuplet   fn lengths &rest arglist  [Function]

A function for varying tuplet groups one by one: map-tuplet applies fn to each tuplet length group in lengths.

Arguments:

  • fn: a function expecting a length list, and potentially more arguments if further args are given

  • lengths: a (possibly nested) lengths list

  • arglist: further argument

    • args -- arguments that are part of arg-list before keyword args: more argument lists to map in parallel.

    • type -- a keyword arg that is part of arglist. :extend, :denominator or :tuplet. The default is :extend (inherited from split-lengths).

Examples:

    (setf rhy '((-1/6 1/6 1/6 -1/8 1/8 1/8 1/8) (-1/10 1/10 1/10 1/10 1/10 -1/12 1/12 1/12 1/12 1/12 1/12) (-1/10 1/10 1/10 1/10 1/10 -1/8 1/8 1/8 1/8) (-1/6 1/6 1/6 -1/4 1/4))) 

In this first example, all tuplet groups in rhy are rotated by one.

    (map-tuplet #'(lambda (ls) (gen-rotate 1 ls)) rhy) 

Additional arguments can be given to fn by specifying further argument lists to map-tuplet. If an argument list is shorter than the number of tuplet groups in lengths then it is circled through. In this example, tuplet groups are rotated by 1 or 2 alternating.

    (map-tuplet #'(lambda (ls n) (gen-rotate n ls)) 
                 rhy 
                 '(1 2)) 

length-divide-ext   count divide length &rest args &key seed  [Function]

Same as length-divide, but arg divide is list of ints (elements circled through).

Note: implemented by calling length-divide internally for each sublist in length, and therefore arguments like section and exclude are not supported.

Examples:

    (length-divide-ext 1 '(2 3) '((q q) (q q)) :seed 1) 
     => ((1/8 1/8 1/4) (1/4 1/12 1/12 1/12)) 

    (length-divide-ext 1 '(2 3) '(q q) :seed 1) 
     => ((1/8 1/8) (1/12 1/12 1/12)) 
note-rest-series   positions sequence &key (flat nil) (swallow nil) (section nil)  [Function]

Turn notes at specific positions (actually, distances between positions) into rests. This function is like the Opusmodus built-in length-rest-series, but supports arbitrary OMN expressions as input and additionally the arguments swallow and section.

Arguments:

  • positions (list of ints): 1-based positions of notes to be turned into rests

  • sequence (list of lengths or OMN expression): music to process

  • flat (Boolean): whether positions count for sublists (nil) or the whole list (T)

  • swallow (Boolean): whether the pitches of notes turned into rests should be shifted to the next note or omitted (swallowed)

  • section (list of ints): 0-based positions of sublists to process. This argument is ignored if flat is T.

Examples:

    (setf melody '((s eb6 < leg f5 < leg c5 < leg f5 < leg) (e e6 f - -q))) 
     (note-rest-series '(1 1) melody :swallow T :section '(0)) 
_position-to-rest   position lengths &key (n 1) (seed nil)  [Function]

[Aux] Processing plain list of lengths.

position-to-rest   position sequence &key (n 1) (flat nil) (swallow t) (section nil) (seed nil)  [Function]

Turn notes at the given position in the bar into rests.

Arguments:

  • position (symbol or integer): position of the note to turn into a rest. If a positive integer, it denotes the 0-based position. If a negative integer, it counts backwards from the end (-1 is the last element, -2 the one before the last and so on). Symbols have the following meaning: s - first note (start); e - last note (end); ? - randomly chosen position.

  • sequence (list of lengths or OMN expression): music to process.

  • n (integer): how many consecutive notes after `position' to affect.

  • flat (Boolean): whether positions count for sublists (nil) or the whole list (T)

  • swallow (Boolean): whether the pitches of notes turned into rests should be shifted to the next note or omitted (swallowed)

  • section (list of ints): 0-based positions of sublists to process. This argument is ignored if flat is T.

  • seed (integer): random seed for ? position.

Examples:

Processing a flat list of durations.

    (position-to-rest 's '(q q q q) :n 2) 

A sequence to be processed in following examples.

    (setf seq '((q c4 q d4 q e4 q d4) (h b3 q g4 q f4) (w e4))) 

Create rests at the beginning of every bar.

    (position-to-rest 's seq) 

Create rests at the end of every bar using a negative position

    (position-to-rest -1 seq) 

Create rests at a random position in the first bar (section) with two consecutive rests.

    (position-to-rest '? seq :section '(0) :n 2) 

Create a rest at a random position in every bar.

    (position-to-rest '? seq :seed 1) 

Process the flattened sequence and create two consecutive rests starting from position 5, which happens to be in the second bar.

    (position-to-rest 5 seq :n 2 :flat T) 

If there already is a rest at the given position, then it is simply kept as such.

    (position-to-rest 1 '(q -q q q) :n 2) 
_merge-rest-into-note   lengths  [Function]

[Aux def] All rests are merged into the following note. This function can be useful for producing harmonic rhythms.

Arguments:

  • lengths: a flat list of length values

merge-rest-into-note   sequence &key (flat nil) (section nil)  [Function]

All rests are merged into the following note. This function can be useful for producing harmonic rhythms.

Arguments:

  • sequence: OMN sequence, can be nested

  • flat (Boolean): whether or not to merge rests across bar boundaries

  • section (list of positive integers): selection of sublists to process

Examples:

    (merge-rest-into-note '((-h w. e4 pp) (-h w. gs4 pp) (-h w. gs4 pp))) 
     => ((d e4 pp) (d gs4) (d gs4)) 

    (merge-rest-into-note '((-w) (-h h e4 pp)) :flat T) 
     => ((w e4 pp tie) (w e4 pp)) 

BUGS:

Plain length lists are not properly processed.

    (merge-rest-into-note '(1/4 -1/8 1/16 1/16)) 
     => (1/4 3/16 1/16 1/4) 

Should be instead

    => (1/4 3/16 1/16) 

But if some other parameter is added, then the function works as documented.

    (merge-rest-into-note '(1/4 c4 -1/8 1/16 1/16)) 
     => (q c4 e. s) 

_cut-holes   lengths binary-list  [Function]

[Aux] Expects a list of lengths and a matching binary list. Every length at a position of a 1 in the binary list is left untouched, while every length at a 0 is turned into a rest.

If binary-list is shorter than lengths it is repeated in a circular fashion.

Related: length-rest-series

cut-holes   sequence binary-list &key (swallow nil)  [Function]

Turns notes in `sequence' into rests if `binary-list' contains a 0 at the matching position. Notes are left untouched if there is a 1 at the matching position.

Arguments:

  • sequence (list of lengths or OMN expression): music to process

  • binary-list (flat list of ints):

  • flat (Boolean): whether binary-list count for sublists (nil) or the whole list (T)

  • swallow (Boolean): whether the pitches of notes turned into rests should be shifted to the next note or omitted (swallowed)

See Also:

note-rest-series

_durational-accent-divide   lengths &key (divide 2) (n 1) (divide-prob 0.5) (tie-n 0) (tie-prob 0.5) (tie-previous-beat? nil) (grace-n 0) (grace-length 1/8) (grace-prob 0.5) (set nil) (ignore nil) (seed nil)  [Function]

Adds durational accents on first notes of bars by subdividing the last note of the preceding bar. `lengths' must be a list of length lists (multiple bars).

If a bar starts with a rest, then it cannot carry a durational accent, and hence its preceding note is never subdivided.

Arguments:

  • divide (integer or list of integers, default 2): specifies into how many equal note values notes preceeding a durational accent are subdivided. If list of integer, subdivision is randomly chosen.

  • n (integer): maximum number of notes at end of bars that are potentially subdivided.

  • divide-prob (default 0.5): probability value between 0.0 and 1.0, controlling whether a note that could be subdivided for creating a durational accent actually will be. Higher values make durational accents more likely.

  • tie-n (integer): maximum number of subdivided notes at end of bars (before the next durational accent) that are potentially tied together. Should not be larger than n*divide.

  • tie-previous-beat? (Bool): whether or not the first subdivided note before the durational accent is tied to the preceeding note (e.g., the preceeding accent). Such tie never occurs across bar lines.

  • tie-prob: probability value controlling whether subdivided notes are tied.

  • grace-n (integer): number of grace notes potentially inserted before first notes of bars.

  • grace-length (length value, default 1/8): notated note value of inserted grace notes.

  • grace-prob (default 0.5): probability value controlling whether grace notes are inserted.

  • set (length or list of lengths): only specified lengths are subdivided.

  • ignore (length or list of lengths): specified lengths are *not* subdivided.

  • seed (integer): random seed.

Examples:

    (_durational-accent-divide (gen-repeat 2 '((h q) (q q q) (h -q))) :divide '(2 3) :n 2 :seed 4321) 
_durational-accent-merge   lengths &key (n 2) (prob 0.5) (seed nil)  [Function]

Adds durational accents on first notes of bars by merging notes at the beginning of a bar. `lengths' must be a list of length lists (multiple bars).

If a bar starts with a rest, then it cannot carry a durational accent, and hence notes are not merged.

Arguments:

  • n (integer): number of notes at beginning of bars that are potentially subdivided.

  • prob (default 0.5): probability value between 0.0 and 1.0, controlling whether notes that could be merged for creating a durational accent actually will be. Higher values make durational accents more likely.

  • seed (integer): random seed.

Examples:

    (_durational-accent-merge (gen-repeat 4 '((q q q))) :n 3 :seed 3333) 
_durational-accent-whole-note   lengths &key (whole-note-prob 0.1) (seed nil)  [Function]

Adds quasi durational accents on first notes of bars (and simplifies the resulting music) by merging all notes of some bars into a single note taken the whole duration of that bar.

durational-accent   lengths &key (divide 2) (divide-n 1) (divide-prob 0.5) (tie-n 0) (tie-prob 0.5) (tie-previous-beat? nil) (grace-n 0) (grace-length 1/8) (grace-prob 0.5) (merge-n 2) (merge-prob 0.5) (whole-note-prob 0.1) (set nil) (ignore nil) (seed nil) (format :omn)  [Function]

Adds durational accents on first notes of bars by subdividing the last note of the preceding bar (see divide-related args) or merging notes at the beginning of a bar (see merge-related args). Subdivided notes can be partially tied together for rhythmic variety (see tie-related args), and durational accents can also be expressed with grace notes (see grace-related args).

While `durational-accent' only supports accents of the first beat of each bar, you can easily realise other accent patterns by temporarily rebarring the music (e.g., with `omn-to-time-signature' and perhaps `length->time-signature'), and then afterwards align the result of `durational-accent' again with the original time signatures (e.g., with `copy-time-signature').

Arguments:

  • lengths: a list of length lists (multiple bars). `length' can also be arbitrary OMN expressions, but only length lists are returned and other parameters are ignored.

  • divide (integer or list of integers, default 2): specifies into how many equal note values notes preceeding a durational accent are subdivided. If list of integer, subdivision is randomly chosen.

  • divide-n (integer): number of notes at end of bars that are potentially subdivided. If a bar starts with a rest, then it cannot carry a durational accent, and hence its preceding note is never subdivided.

  • divide-prob (default 0.5): probability value between 0.0 and 1.0, controlling whether a note that could be subdivided for creating a durational accent actually will be. Higher values make durational accents more likely.

  • tie-n (integer): maximum number of subdivided notes at end of bars (before the next durational accent) that are potentially tied together. Should not be larger than divide * divide-n. (The returned notes are not necessarily tied but can instead be notated, e.g., as dotted note values.)

  • tie-previous-beat? (Bool): whether or not the first subdivided note before the durational accent is tied to the preceeding note (e.g., the preceeding accent). Such tie never occurs across bar lines.

    • NOTE: If tie-previous-beat? is T, then you may want the argument divide to be 3 or larger, and tie-n to be only 1 (or slightly larger for large values of divide), because otherwise you also turn the preceeding note into a durational accent.

  • tie-prob: probability value controlling whether subdivided notes are tied.

  • merge-n (integer): number of notes at beginning of bars that are potentially subdivided.

  • merge-prob (default 0.5): probability value controlling whether notes at the beginning of a bar are merged.

  • whole-note-prob: probability value controlling whether all notes of a bar are merged to form quasi a whole note spanning that whole bar.

  • grace-n (integer): number of grace notes potentially inserted before first notes of bars.

  • grace-length (length value, default 1/8): note value of inserted grace notes.

  • grace-prob (default 0.5): probability value controlling whether grace notes are inserted.

  • set (length or list of lengths): only specified lengths are subdivided.

  • ignore (length or list of lengths): specified lengths are *not* subdivided.

  • format (either :omn or :length): set the output format. In :length format, grace notes are represented explicitly as acciaccatura and ties are represented explicitly, in length format they have simply the duration 0.

  • seed (integer): random seed.

Examples:

Evaluate these examples multiple times to see range of solutions.

    (durational-accent (gen-repeat 4 '((q q q))) :divide 2 :divide-n 2 :merge-n 3) 
     (durational-accent (gen-repeat 4 '((q q q))) :divide '(2 3) :divide-n 2 :merge-n 3) 

allow for ties for greater rhythmic variety, in particular for higher :divide values

    (durational-accent (gen-repeat 4 (list (gen-repeat 4 '(1/4)))) 
                      :divide '(3 4) :divide-n 2 
                      :tie-n 2 :tie-prob 0.8) 

ties with ties to previous beat

    (durational-accent (gen-repeat 4 (list (gen-repeat 2 '(1/4)))) 
                      :divide '(4) :divide-n 2 :divide-prob 1 
                      :tie-n 1 :tie-prob 1 :tie-previous-beat? t) 

shorter tuplet groups to create accents

    (durational-accent (gen-repeat 4 '((q q q))) :divide '(5 6 7) :divide-n 1 :divide-prob 0.7 :merge-n 3) 

inserting grace notes, but without subdividing notes at end of bar

    (durational-accent (gen-repeat 4 '((q q q))) :divide-n 0 :merge-n 3 :grace-n 2) 

metric structure can be irregular, but accents are still created on first beat

    (durational-accent  
      (gen-eval 4 '(gen-repeat (rnd1 :low 2 :high 5) (rnd-pick '(h q)))) 
      :divide '(2 3) :divide-n 3 :merge-n 3) 

Note that you can create potential accents on each bear, on syncopations or other accent patterns beyond emphasising the first note of bars by using this function with sublists (temporary bars) according to where you want to have your accents, and then in a next step re-barring your results, e.g., with the function omn-to-time-signature.

If you want your final rhythm to contain rests you best add these to your rhythmic material before processing it with this function, because turning notes into rests afterwards can contradict your durational accents.

_remove-rest-articulations   sequence  [Function]

Strips all articulations from rests.

Arguments:

  • sequence: OMN expression that _cannot_ be nested. TMP function -- only necessary until length-rest-merge or omn-merge-rests support merging rests with articulations.

lengths-with-merged-ties   sequence  [Function]

Returns a flat list of lengths that preserves the lengths in `sequence' including their tied notes.

Examples:

    (lengths-with-merged-ties '((h c4 pizz q arco+tie) (q h tie) (h.))) 
     => (1/2 1/2 5/4) 

Contrast:

    (omn :length '((h c4 pizz q arco+tie) (q h tie) (h.))) 
     => ((1/2 1/4) (1/4 1/2) (3/4)) 

See Also:

    (omn-merge-ties (flatten-omn '((h c4 pizz q arco+tie) (q h tie) (h.)))) 
     => (h c4 pizz c4 arco wq) 

bpm->duration   beats tempo  [Function]

Converts a duration in number of beats and the corresponding tempo in BPM into a duration in seconds.

isolate-time-signatures   ts-forms  [Function]

Transforms time signatures `ts-forms' so that each resulting time signature denotes only a single bar.

Examples:

    (isolate-time-signatures '((3 4 2) (2 4 1))) 
     => ((3 4 1) (3 4 1) (2 4 1)) 
length->time-signature   sequence  [Function]

Expects any OMN sequence, extracts its rhythm, and translates each note value in a time signature of the same length.

Examples:

    (rhythm-to-time-sig-sequence '(3/4 1/4 1/2)) 
     => ((3 4 1) (1 4 1) (2 4 1)) 

See Also:

This function is largely the complement of the Opusmodus buildin function `time-signature-length'.

metric-shift   l lengths  [Function]

Appends `l' (a length or omn) before `lengths' (a list of lengths or omn), but maintains the metric structure, i.e., the function shifts `lengths' metrically 'to the right' by `l'.

Returns an OMN form if lengths is an OMN form, otherwise a length form.

Examples:

    (metric-shift '-h '((q q q q) (q q q q))) 

    (metric-shift '(h g4 e) '((q c4 q d4 q e4 q f4) (q c4 q d4 q e4 q f4))) 

BUGS:

If `lengths' is only a list of length values and not a full OMN sequence, then other parameters in `l' are ignored.

    (metric-shift '(h d4) '((q q q q) (q q q q))) 

See Also:

assemble-seq (but that does not shift across bars)

shift-meter-boundaries   lengths positions  [Function]

Shift meter boundaries (sublist lengths) between bars in `lengths', by given number of positions (number of notes or rests) forwards or backwards. Such meter transformations can be useful, e.g., to prepare music for inserting durational accents expressing syncopations, and then afterwards moving the meter boundaries back to their original positions (e.g., using `copy-time-signature' with the original sequence).

Note that resulting meter changes may occur even within tuplets, though Opusmodus may not support notating the result.

Arguments:

  • length: list of OMN length values, must be nested

  • positions (lists of ints, length most be one shorter than number of bars/sublists in lengths): amount by how many note values the bar line should be moved to the left (negative number) or to the right (positive number). `positions' is circled through to meet the length of `lengths'.

Examples:

    (shift-meter-boundaries '((1/18 1/18 1/18 1/18 1/18 1/18 1/18 1/18 1/18) 
                               (1/16 1/16 1/16 1/16 1/16 1/16 1/16 -1/16) 
                               (-1/14 1/14 1/14 1/14 1/14 1/14 1/14)  
                               (q -q))  
                             '(0 -1 1)) 

insert-into-bar   positions new lengths &key section seed  [Function]

Inserts item(s)

Arguments:

  • positions (list of position values): either symbol 's (start), 'e (end) or '? (random position), or integer specifying position.

  • new: list of OMN length values to be inserted, can be nested or partially nested.

  • lengths: list of OMN length values, must be nested. `positions' and `new' is circled through to meet the length of `lengths' or `section'.

  • section (list of ints): selected sublists to process.

Examples:

    (insert-into-bar '(s e) '(q (e e)) '((h) (h) (h))) 
     (insert-into-bar '(?) '(q (e e)) '((h) (h) (h)) :section '(1 2) :seed 1) 

See Also:

Opusmodus builtin `position-insert'.