Extends
Methods
play(note, proxy)
Sequence one or more notes.
Examples
Play a single note:
session.track('drums', ({ track } => {
track.at(0).play(quarter.note('kick'));
});
Play multiple notes at once:
session.track('drums', ({ track } => {
track.at(0).play(quarter.note('kick snare ride'));
});
Play a phrase by name:
session.track('drums', ({ track } => {
track.at(0).play.phrase('beat');
});
Define and play a phrase:
session.track('drums', ({ track } => {
track.at(0).play.phrase([
quarter.note('kick'),
quarter.note('snare'),
quarter.note('kick'),
quarter.note('snare'),
]);
});
Parameters:
Name | Type | Description |
---|---|---|
note |
* | |
proxy |
* |
volume(volume, proxy)
Set track volume in dB.
session.track('drums', ({ track }) => {
track.at(0).volume(-10);
});
Parameters:
Name | Type | Description |
---|---|---|
volume |
number |
volume in decibels |
proxy |
* |
pan(pan, proxy)
Set track panning (-1 to 1).
session.track('drums', ({ track }) => {
track.at(0).pan(-0.75);
});
Parameters:
Name | Type | Description |
---|---|---|
pan |
number |
pan from -1 (L) to 1 (R) |
proxy |
* |
mute(mute, proxy)
Mute the track.
Examples
Mute track at measure 5:
session.track('drums', ({ track }) => {
track.at(5).mute();
});
Mute entire track:
session.track('drums', ({ track }) => {
track.mute();
});
Mute for first 10 measures only:
session.track('drums', ({ track }) => {
track.at(0).mute();
track.at(9).mute(false);
});
Parameters:
Name | Type | Description |
---|---|---|
mute |
boolean |
mute value (default true) |
proxy |
* |
at(measure, beat, subdivision) → {Proxy}
Select a position on the timeline by measure, beat and subdivision.
Positions begin from 0, meaning that "measure 1, beat 1" in spoken word implies "measure 0, beat 0" in Harmonicon.
Examples
Set tempo to 120 at the beginning of song:
session('my-song', ({ session }) => {
session.at(0).tempo(120);
})
Play a C# on beat 2 of measure 1:
track('my-song', ({ session }) => {
track.at(1, 2).play(quarter.note('C#'));
})
Trigger multiple actions at the same position:
track('my-song', ({ session }) => {
session.at(0)
.meter([ 4, 4 ])
.tempo(120)
.key('C')
})
Parameters:
Name | Type | Description |
---|---|---|
measure |
Number |
Measure number starting from zero |
beat |
Number |
Beat number starting from zero |
subdivision |
Number |
Subdivision (between 0 and 1) |
- Inherited From:
- Source: