Fluid synth bindings for node.
Install with:
npm i fluid4node
See the file test.js
for an example of how to use the library, once installed.
The default export of the library is a constructor that takes an optional spec
object:
const f4n = require('fluid4node')({});
If you pass in an empty object, or nothing, the library will attempt to detect your operating system and configure itself accordingly.
The RPi can be ARM v6 or v7, each of which require a different build of libfluidsynth
. You can install the correct binary build with your package manager, and pass the file path into the constructor.
On a Debian distro on RPi, you can use dpkg -L libfluidsynth1
to get a list of all the files installed for libfluidsynth
(use apt install libfluidsynth1
to install it).
Find the path to the libfluidsynth.so.1
, and pass this in as the value for libs
, for example:
const f4n = require('fluid4node')({
libs: ['/usr/lib/arm-linux-gnueabihf/libfluidsynth.so.1'],
drivers: ['alsa'],
soundFonts: ['./sf2/Harmonium.sf2']
});
On a Mac, use brew install fluidsynth
, then brew list fluidsynth
to get the path to the libfluidsynth.X.Y.Z.dylib
file:
const f4n = require('fluid4node')({
libs: ['/usr/local/Cellar/fluid-synth/2.1.5/lib/libfluidsynth.2.3.5.dylib'],
drivers: ['coreaudio'],
soundFonts: ['./sf2/Harmonium.sf2']
});
The soundFonts
argument to the constructor is an array of paths to sound fonts that will be loaded.
If you are looking for a sound font, try General User.
You can pass a sampleRate
to the API constructor, like this:
const f4n = require('./dist/fluid4node.js')({
sampleRate: 48000
});
You can emit some debugging information by setting the environment variable DEBUG=fluid4node
.