danigb / soundfont-player

Quick soundfont loader and player for browser
MIT License
453 stars 60 forks source link

Problems when attempting to play a custom soundfont #93

Open karmaral opened 2 years ago

karmaral commented 2 years ago

Hello! I generated a custom soundfont using MIDI.js tools, and placed it inside my public folder (I'm using Svelte) When creating the new instrument, I tried the following: let inst = Soundfont.instrument(ac, 'http://localhost:8080/soundfonts/acoustic_grand_piano-mp3.js'); let inst = Soundfont.instrument(ac, './soundfonts/acoustic_grand_piano-mp3.js');

And they both throw:

Uncaught TypeError: Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer
    at ArrayBuffer.slice (<anonymous>)
    at AudioContext.<anonymous> (index.js:68:64)

Do you have any idea what it could be?

Here's the generated js file too, just in case acoustic_grand_piano-mp3.txt

Thank you!

luisscholl commented 1 year ago

Hi, I have the same problem. Some info for reproducing the problematic file.

OS: Windows 10

  1. Installed oggenc2, lame, fluidsynth, ruby, Node.js
  2. Cloned MIDI.js
  3. Installed all npm packages for generator/nodejs/packageWAVs.js
  4. gem install midilib
  5. Created directories "generator/ruby/soundfont" and "generator/sf2"
  6. Placed sf2 file into generator/sf2
  7. Edited soundfont_builder.rb such that
    OGGENC = "oggenc2"
    LAME = "lame"
    FLUIDSYNTH = "fluidsynth"
  8. Executed ruby soundfont_builder.rb from generator/ruby

Any help would be appreciated!