mudcube / MIDI.js

:musical_keyboard: Making life easy to create a MIDI-app on the web. Includes a library to program synesthesia into your app for memory recognition or for creating trippy effects. Convert soundfonts for Guitar, Bass, Drums, ect. into code that can be read by the browser. Supports multiple simultaneous instruments and perfect timing.
http://mudcu.be/midi-js/
MIT License
3.82k stars 641 forks source link

How to use custom sf2 #218

Open marcway opened 7 years ago

marcway commented 7 years ago

Hi,

I'm using the soundfont_builder.rb to convert my custom sf2 into an appropiate format. But I don't understand why the script makes me choose an instrument. The instrument is not configured in the sf2 itself?

hmoffatt commented 7 years ago

The sf2 might contain multiple instruments. But mainly because the converter script is dumb and doesn't inspect the sf2 at all, it just runs fluidsynth for every note of every instrument you specify to create a set of samples, encodes them and writes them out as .js.

There's a ton of obvious improvements which could be made to increase quality and reduce file size. The sound font size is excessive when used on iPad. Aac encoding, omitting unused sounds (in drum sound fonts), and not encoding a fixed 3 seconds for every note (especially drums), and mono versus stereo etc.

Sent from my android device.

-----Original Message----- From: marcway notifications@github.com To: "mudcube/MIDI.js" MIDI.js@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Sent: Thu, 07 Sep 2017 11:37 Subject: [mudcube/MIDI.js] How to use custom sf2 (#218)

Hi,

I'm using the soundfont_builder.rb to convert my custom sf2 into an appropiate format. But I don't understand why the script makes me choose an instrument. The instrument is not configured in the sf2 itself?

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/mudcube/MIDI.js/issues/218

mk-pmb commented 7 years ago

There's a ton of obvious improvements which could be made to increase quality and reduce file size.

Output file size is also the foremost problem with midijssf-timgm6mb-pmb currently. I've implemented trimming of trailing silence, and de-duplication of leading data bytes (yeah, very small effect) in midijssf-from-sf2-pmb but I'm cautious about how low a bitrate or OGG quality can be acceptable so I copied the rates from the ruby generator. Would you mind checking my package for whether you can find ways to optimize it and/or the defaults further?

mk-pmb commented 6 years ago

I started collecting approaches to shrink sample collection file sizes.