add .tone + helpers

This commit is contained in:
Felix Roos 2022-02-16 20:11:21 +01:00
parent 71023fc09c
commit 70f858361f
2 changed files with 93 additions and 4 deletions

View file

@ -62,7 +62,8 @@ function scaleTranspose(scale: string, offset: number, note: string) {
Pattern.prototype._mapNotes = function (func: (note: NoteEvent) => NoteEvent) {
return this.fmap((event: string | NoteEvent) => {
const noteEvent = toNoteEvent(event);
return func(noteEvent);
// TODO: generalize? this is practical for any event that is expected to be an object with
return { ...noteEvent, ...func(noteEvent) };
});
};