byte-music.js icon indicating copy to clipboard operation
byte-music.js copied to clipboard

Drums

Open audionerd opened this issue 9 years ago • 0 comments

I have drum sequencing working on local branch. The problem is with the samples, and specifically the SoundFont conversion. For some reason, the audio buffers generated by the MIDI.js SoundFont converter are extracting only a few of the samples, and mapping them to unexpected note numbers. The map currently look like this:

var drumsAsNotes = {
  "Kick": 36,
  "Snare": 38,
  "Clap": 39,
  "Hat": 42,
  "Glitch": 37,
  "Tambourine": 40,
  "Whistle": 41
}

So I can only get 7 drums samples to work. The rest aren't even extracted to MP3/OGG.

I think I'll have to modify the SoundFont converter to extract all the samples, and map them properly to MIDI note numbers 35 to 50.

I could also manually create the SoundFont by playing it back via AUSampler to a .aiff recording, and then cutting the samples in an audio program one-by-one. Wouldn't take long, but if the SoundFont ever changes I'll have to do the whole process over again.

Another issue that may cause problems is the way MIDI.js references audio buffers. It uses string concat of the instrument # with noteId to determine where audio is stored, e.g.: audioBuffers[instrument + '' + noteId]. This could have conflicts, e.g.: 1121 = channel 1 + noteId 121 AND channel 11 + noteId 21. Really odd scheme.

audionerd avatar Sep 07 '15 19:09 audionerd