You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

spessasynth_lib

Package Overview
Dependencies
Maintainers
0
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spessasynth_lib

MIDI and SoundFont2/DLS library for the browsers with no compromises

3.27.8
latest
Source
npmnpm
Version published
Weekly downloads
259
16.67%
Maintainers
0
Weekly downloads
 
Created
Source

SpessaSynth logo

A powerful SF2/DLS/MIDI JavaScript library for the browsers.

This is a WebAudioAPI wrapper for the spessasynth_core library.

It allows you to:

  • Play MIDI files using SF2/SF3/DLS files!
  • Read and write MIDI files!
  • Write SF2/SF3 files!
  • Convert DLS to SF2! (and back!)
  • and more!

The next major update (4.0) will include many breaking changes. The documentation will be updated when the update releases. The migration guide will be published here.

SpessaSynth Project index

TIP: Looking for a bare JS version that works without WebAudioAPI? Try spessasynth_core!

npm install --save spessasynth_lib

Project site (consider giving it a star!)

Made with spessasynth_lib

Complete documentation

Basic example: play a single note

import { Synthetizer } from "spessasynth_lib"

const sfont = await (await fetch("soundfont.sf3")).arrayBuffer();
const ctx = new AudioContext();
// make sure you copied the worklet processor!
await ctx.audioWorklet.addModule("./worklet_processor.min.js");
const synth = new Synthetizer(ctx.destination, sfont);
document.getElementById("button").onclick = async () =>
{
    await ctx.resume();
    synth.programChange(0, 48); // strings ensemble
    synth.noteOn(0, 52, 127);
}

Audio may sometimes sound distorted in Chromium-based browsers: Chrome, Edge, Brave, etc. due to a Chromium Bug. I can't do anything about it, only hope that it gets fixed. Please consider voting for it on the bug tracker to get it fixed!

Current Features

All the features of spessasynth_core!

On top of that...

  • Modular design: Easy integration into other projects (load what you need)
  • Detailed documentation: With examples!
  • Easy to Use: Basic setup is just two lines of code!
  • No external dependencies: Just spessasynth_core!
  • Reverb and chorus support: customizable!
  • Export audio files using OfflineAudioContext
  • Written using AudioWorklets:
    • Runs in a separate thread for maximum performance
    • Does not stop playing even when the main thread is frozen
    • Supported by all modern browsers
  • High-performance mode: Play Rush E! note: may kill your browser ;)

TODO

  • Enhance the built-in chorus and reverb effects (suggestions welcome!)

Special Thanks

  • FluidSynth - for the source code that helped implement functionality and fixes
  • Polyphone - for the soundfont testing and editing tool
  • Meltysynth - for the initial low-pass filter implementation
  • RecordingBlogs - for detailed explanations on MIDI messages
  • stbvorbis.js - for the Vorbis decoder
  • fflate - for the MIT DEFLATE implementation
  • foo_midi - for useful resources on XMF file format
  • Falcosoft - for help with the RMIDI format
  • Christian Collins - for various bug reports regarding the synthesizer
  • And You! - for checking out this project. I hope you like it :)

License

Copyright © 2025 Spessasus Licensed under the Apache-2.0 License.

SoundFont® is a registered trademark of Creative Technology Ltd.

Keywords

soundfont

FAQs

Package last updated on 30 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts