ce billet existe aussi en français

Take Firefox, FluidSynth, js-ctypes, a sf2 soundfont, shake all of that, tadaaa... a real synthetizer, usable in real-time or as a sequencer, inside my browser :) .

FluidSynth is a cross platform C library that uses sf2 soundfonts.
At the beginning, it was an experiment, opening this lib via js-ctypes in Firefox, to play with it.

But it worked so well, so I have created 3 little apps, combined in a collection named Music Toys, which can be launched as a Firefox extension, or as a standalone XULRunner application (launchable with Firefox).
These apps are all in JavaScript, using part of the FluidSynth API through js-ctypes.


  • The first app is a Keyboard, real-time and polyphonic, with 128 available instruments. You can play with your mouse, or the physical keyboard of your computer.


  • The second app is a Drum Machine. It consists in a list of tracks, divided in bars, beats per bar, and divisions per beat, containing buttons to switch on notes (with variable velocity).
    47 different percussion instruments are available, and you can change the drumkit.
    Change the tempo, play in real time your pattern in a loop. And you can save/open your patterns in files.


  • The third app is a Midi Player. It can read standard mid files (SMF), RMI encapsulated or not, and kar files.
    You can seek in the file, pause, change the volume, modify the tonality.

A little screencast of all of that:

direct links to the video:
musictoys.mp4 | musictoys.webm | musictoys.ogv

If you want to try it, you can download it from its dedicated page: Music Toys.
There's standalone versions for Linux, Windows, and Mac OSX (with the FluidSynth lib embedded and a default soundfont), and the Firefox extension.
All the source code is MPL 2.

We can imagine more.

It is conceivable to create an extension for Firefox which expose only the FluidSynth wrapper lib, and extension authors can access it.
More, why not expose some basic objects like a Synth to web page, it should be possible (but need to be careful with security).

Secondly, perhaps it's possible to compile FluidSynth on Android, some Web research reveals that some seems able to, so an extension for Firefox Mobile may be possible.
And perhaps FluidSynth can be compiled for Firefox OS too (Fluidsynth need glib)?

But for now, let me know what you think about that, and if this beta works for you, I've tested mostly under Linux, so your feedback from various Windows, 32 or 64 bit, and Mac, will be precious ;) .