Create sub groups for advances.
This helper class is only exported for testing purposes. in - [1,0,0,0,2,0] out - [[1,0,0,0], [2,0]]
createDynamicGetter is part of an experiment with dynamics that work even when applied to clips that were derived from a different rhythm string. For this to work, we need to be able to get the dynamic at an arbitrary point in time (and not just at a discrete point in the rhythm string).
dynamic pattern string
Convert rhythm string to a cumulative array of durations.
String representing of a rhythm
a javascript object representing timing. The object will have two properties, both of which are arrays: - .totals is a measure of elapsed times - .deltas is the duration of each character
Convert a rhythm, pattern, and note library to a Clip
.
an indexable object containing notes or arrays of notes. Can be an object or an array. If it is an array, the pattern may only contain single digit numbers (i.e. 0-9).
All symbols in the pattern should reference values in the noteLibrary.
To create 'c' and 'd' quarter notes on beats 1 and 3 respectively:
rhythm = '1234'
pattern = '0.1.'
noteLibrary = [60, 62]
noteLibrary = {'0': 60, '1': 62 }
A clip with .startTime == 0
(startTime
is set by score.parse
).
This helper method converts a pattern into an intermediary format that is helpful for parsing a tab. Its easiest to understand with an example:
const input = 'a-1-bb...';
const output = [['a',2], ['1',2], ['b',1], ['b', 1], ['.', 3]];
For every new symbol, the out output lists that symbol, and the number of positions that that symbols is active for.
Convert each character in an string to an duration. In the following examples, q=1/4 and e=1/8 and h=1/2 Quarter notes: rhythm - '1+2+' result - [e,e,e,e] Spaces leave a 0 in the array. rhythm - '1 + ' result - [e,0,e,0] Eighth and quarter notes: rhythm - '1234+' result - [q,q,q,e,e] Whole notes always 1. Half notes always get 0.5 rhythm - 'h34' result - [h,q,q] See tests for more examples.
String representing of a rhythm
An array of durations for each character
These keys cannot be used for patterns in tabs and scores.