danigb / smplr

A web audio sampler instrument
https://danigb.github.io/smplr/
186 stars 19 forks source link

Store the SoundFont objects in a list, and cannot reference them #48

Closed 747745124 closed 1 year ago

747745124 commented 1 year ago

The reason I'm doing this is trying to have arbitary number of instruments (from MIDI files), it seems like it won't produce a sound after the instrument is being pushed to the array

instruments = [];
const instr = new Soundfont(context, { instrument: this.trackSettings[0].instrument });

instr.load.then(() => {
    this.instruments.push(instr);
  }

this.instruments[0].start({ note: "C4", velocity: 80, time: 5, duration: 1 })