Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const parse = (buffer: ArrayBuffer, bpm: number): INotes => {
const json = new Midi(buffer);
const bps = bpm / 60;
const notes: INote[] = [];
json.tracks.forEach((track) => {
track.notes.forEach((note) => {
notes.push({
name: note.name,
start: note.time * bps,
duration: note.duration * bps,
velocity: note.velocity,
});
});
});
return notes;
};