Git Product home page Git Product logo

Comments (6)

mudcube avatar mudcube commented on July 17, 2024

Hi Pepe, I'm planning on rewriting the .sh scripts into NodeJS, and this will be one of the improvements once this is complete. In the meantime, whenever you parse a soundfont you'll have to remove that trailing comma manually. It's kinda a bother, but luckily it only has to be once for each instrument.

from midi.js.

pete-otaqui avatar pete-otaqui commented on July 17, 2024

Got any thoughts about the API of the node script? Presumably it would be more focused towards a command line client in the first instance.

How about something like this:

$ sf2js my_soundfont_file.sf2 # uses all defaults
$ sf2js --skip-ogg my_soundfont_file.sf2 # skips ogg
$ sf2js --skip-mp3 my_soundfont_file.sf2 # skips mp3
$ sf2js --skip-jgz my_soundfont_file.sf2 # skips jgz
$ sf2js --dir=/path/to/somewhere my_soundfont_file.sf2 # outputs everything to specified dir
$ sf2js --base-filename=my_clarinet_soundfont my_soundfont_file.sf2 # sets the base filename, appending -ogg.js for example
$ sf2js --fluidsynth-options "-C 0 -R 1 -g 0.5" my_soundfont_file.sf2 # sets options for fluidsynth
$ sf2js --oggenc-options "-m 32 -M 64" my_soundfont_file.sf2 # sets options for oggenc
$ sf2js --lame-options "-v -b 8 -B 32" my_soundfont_file.sf2 # sets options for lame

from midi.js.

mudcube avatar mudcube commented on July 17, 2024

I really like the direction you're going. One additional configuration could be:

sf2js --ms 3000 my_soundfont_file.sf2 # sets length of sample to 3 seconds (default)

And, perhaps including specific build types instead of using exclusion:

sf2js --generate "mp3 ogg mp3json oggjson jgz" my_soundfont_file.sf2 # build everything (default)

Where mp3 and ogg are the raw filesโ€”this can be useful when packaged for iOS or other packaged apps that don't take advantage of the benefits of JSON reducing http queries; raw files are faster on the client side in this case. And then the JSON versions are the packaged files for web apps served from a URL (when the browser can handle it). At some point it would be nice to work in WebM support also (for formats), as it's supposed to have more efficient compression than OGG.

And here's a few other ideas:

sf2js --notes "A1>C8" my_soundfont_file.sf2 # build notes A1 through C8
sf2js --notes "A1,B2,C3" my_soundfont_file.sf2 # build notes A1, B2, and C3
sf2js --volume 85 my_soundfont_file.sf2 # generate with MIDI volume set to 85%

I'm not sure how FluidSynth volume vs. MIDI volume compares, but I think FluidSynth is more of a gain control.

On the note generation... do you have ideas for handling non-musical instruments? It might be confusing for someone to call A1 when they're talking about say a Siren sound-effect. Maybe it would be better to use a numeric system... or a choice of using either, as it makes more sense to think of musical notes as octaves.

Thanks for taking the time to crack down on this, it's very helpful & motivating!

from midi.js.

pete-otaqui avatar pete-otaqui commented on July 17, 2024

That looks great.

As a style thing, I'd probably make "--generate" use the same comma-delimited style as your --notes. In my experience it's really only where you're passing in options to another command that you need to more messing about. Not sure about the state of nodejs command line option parsers, there might be one that has a better style for doing just that kind of thing. Not very important though!

I think it would definitely be better as you said to specify formats rather than exclude them, and the other options also look great.

I don't see any problems with referring to notes either by octave & step, or just by number. I'd probably use "-" rather than ">" to mean a range though, as I think that's fairly common.

No need to thank me - thank you for making MIDI.js in the first place ๐Ÿ‘

from midi.js.

PatrickWolleb avatar PatrickWolleb commented on July 17, 2024

I've created a CLI for converting wav to MIDI.js compatible soundfont.js files.
The cool thing is that you can now use your favourite DAW to create the sounds with.
https://github.com/SHMEDIALIMITED/SoundFontJS

Let me know how it goes...

from midi.js.

mudcube avatar mudcube commented on July 17, 2024

The Shell script has been removed from the repo. The Shell script has been replaced with a NodeJS module for combining multiple wavs, or a Ruby script for generating MIDI (the Ruby script is a direct replacement for the Shell script and much nicer, thanks 0xFE!). Also, as @PatrickWolleb mentioned, he's created a fantastic collection of soundfonts ready to use.

from midi.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.