danigb/smplr

Or schedule events at a given time

Closed this issue · 4 comments

Here's how to schedule activities at a given time, just like soundfont-player:
soundFont.schedule(0, [
{ note: key, duration: lengthInMs / 1000, gain: sampleVolume * this.GainMultiplier },
]);

@danigb Hello, are you there

To schedule notes in time, use the time option of the start function: https://github.com/danigb/smplr#schedule-notes

The important thing is how am I going to set the gain at the start

With the velocity param. 0 means gain = 0. 127 means gain = 1

piano.start({ note: "C4", velocity: 80, time: 5, duration: 1 });