Methods
sequence(sequence)
Assign a sequence of notes to a phrase.
Parameters:
Name | Type | Description |
---|---|---|
sequence |
Array | ExpressionModel |
Sequence of notes and rests |
Create reusable phrases with session.phrase():
session.phrase('progression', ({ phrase }) => {
phrase.sequence([
whole.note('cmaj'),
whole.note('fmaj'),
whole.note('cmaj'),
whole.note('gmaj'),
])
});
// Play progression on piano:
session.track('piano', ({ track }) => {
track.at(0).play.phrase('progression');
});
// Play progression on acoustic guitar:
session.track('acoustic-guitar', ({ track }) => {
track.at(0).play.phrase('progression');
});
Phrases are declared once, but can be used by any track any number of times and are agnostic of the instrument playing them. Meaning, if 3 instruments play the same melody, you only have to code it once.
The same phrase can also be written more tersely:
session.phrase('progression', [
whole.note('cmaj'),
whole.note('fmaj'),
whole.note('cmaj'),
whole.note('gmaj'),
]);
Phrases can also be sequenced without being declared previously:
session.track('piano', ({ track }) => {
track.at(0).play.phrase([
whole.note('cmaj'),
whole.note('fmaj'),
whole.note('cmaj'),
whole.note('gmaj'),
]);
});
Anonymous phrases are not reusable, but they can make sequencing easier.
Assign a sequence of notes to a phrase.
Name | Type | Description |
---|---|---|
sequence |
Array | ExpressionModel |
Sequence of notes and rests |