3.21.14 • Published 12 months ago

spessasynth_lib v3.21.14

Weekly downloads
-
License
(MIT AND Apache-2...
Repository
github
Last release
12 months ago

spessasynth_lib

A powerful soundfont/MIDI JavaScript library for the browsers.

npm install --save spessasynth_lib

Project site (consider giving it a star!)

Demo

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);
}

Current Features

Easy Integration

Powerful SoundFont Synthesizer

  • Suitable for both real-time and offline synthesis
  • Excellent SoundFont support:
    • Full Generator Support
    • Full Modulator Support: First (to my knowledge) JavaScript SoundFont synth with that feature!
    • GeneralUserGS Certified: See more here!
    • SoundFont3 Support: Play compressed SoundFonts!
    • Experimental SF2Pack Support: Play soundfonts compressed with BASSMIDI! (Note: only works with vorbis compression)
    • Can load very large SoundFonts: up to 4GB! Note: Only Firefox handles this well; Chromium has a hard-coded memory limit
  • Soundfont manager: Stack multiple soundfonts!
  • DLS Level 1 and 2 Support: works with gm.dls!
  • Reverb and chorus support: customizable!
  • Export audio files using OfflineAudioContext
  • Custom modulators for additional controllers: Why not?
  • Written using AudioWorklets:
    • Runs in a separate thread for maximum performance
    • Supported by all modern browsers
  • Unlimited channel count: Your CPU is the limit!
  • Excellent MIDI Standards Support:
  • High-performance mode: Play Rush E! note: may kill your browser ;)

Built-in Powerful and Fast Sequencer

  • Supports MIDI formats 0, 1, and 2: note: format 2 support is experimental as it's very, very rare
  • Multi-Port MIDI support: More than 16 channels!
  • Smart preloading: Only preloads the samples used in the MIDI file for smooth playback (down to key and velocity!)
  • Lyrics support: Add karaoke to your program!
  • Raw lyrics available: Decode in any encoding! (Kanji? No problem!)
  • Runs in Audio Thread as well: Never blocks the main thread
  • Loop points support: Ensures seamless loops

Read and Write SoundFont and MIDI Files with Ease

Read and write MIDI files

  • Smart name detection: Handles incorrectly formatted and non-standard track names
  • Raw name available: Decode in any encoding! (Kanji? No problem!)
  • Port detection during load time: Manage ports and channels easily!
  • Used channels on track: Quickly determine which channels are used
  • Key range detection: Detect the key range of the MIDI
  • Easy MIDI editing: Use helper functions to modify the song to your needs!
  • Loop detection: Automatically detects loops in MIDIs (e.g., from Touhou Project)
  • First note detection: Skip unnecessary silence at the start by jumping to the first note!
  • Write MIDI files from scratch
  • Easy saving: Save with just one function!

Read and write RMID files with embedded SF2 soundfonts

  • Level 4 compliance: Reads and writes everything!
  • Compression and trimming support: Reduce a MIDI file with a 1GB soundfont to as small as 5MB!
  • DLS Version support: The original legacy format with bank offset detection!
  • Automatic bank shifting and validation: Every soundfont just works!
  • Metadata support: Add title, artist, album name and cover and more! And of course read them too! (In any encoding!)
  • Compatible with Falcosoft Midi Player 6!
  • Easy saving: As simple as saving a MIDI file!

Read and write SoundFont2 files

  • Easy info access: Just an object of strings!
  • Smart trimming: Trim the SoundFont to only include samples used in the MIDI (down to key and velocity!)
  • sf3 conversion: Compress SoundFont2 files to SoundFont3 with variable quality!
  • Easy saving: Also just one function!

Read and write SoundFont3 files

  • Same features as SoundFont2 but with now with Ogg Vorbis compression!
  • Variable compression quality: You choose between file size and quality!
  • Compression preserving: Avoid decompressing and recompressing uncompressed samples for minimal quality loss!

Read and play DLS Level 1 or 2 files

  • Read DLS (DownLoadable Sounds) files as SF2 files!
  • Works like a normal soundfont: Saving it as sf2 is still just one function!
  • Converts articulators to both modulators and generators!
  • Works with both unsigned 8-bit samples and signed 16-bit samples!
  • Covers special generator cases: such as modLfoToPitch!
  • Correct volume: looking at you, Viena and gm.sf2!
  • Support built right into the synthesizer!

Export MIDI as WAV

  • Save the MIDI file as WAV audio!
  • Metadata support: Embed metadata such as title, artist, album and more!
  • Cue points: Write MIDI loop points as cue points!
  • Loop multiple times: Render two (or more) loops into the file for seamless transitions!
  • That's right, saving as WAV is also just one function!

License

MIT License, except for the stbvorbis_sync.js in the externals folder which is licensed under the Apache-2.0 license.

3.21.14

12 months ago

3.21.13

1 year ago

3.20.2

1 year ago

3.20.1

1 year ago

3.20.4

1 year ago

3.20.3

1 year ago

3.20.18

1 year ago

3.20.19

1 year ago

3.20.15

1 year ago

3.20.16

1 year ago

3.20.17

1 year ago

3.20.10

1 year ago

3.20.11

1 year ago

3.20.12

1 year ago

3.20.29

1 year ago

3.20.25

1 year ago

3.20.26

1 year ago

3.20.27

1 year ago

3.20.28

1 year ago

3.20.21

1 year ago

3.20.6

1 year ago

3.20.22

1 year ago

3.20.5

1 year ago

3.20.23

1 year ago

3.20.8

1 year ago

3.20.24

1 year ago

3.20.9

1 year ago

3.20.20

1 year ago

3.21.1

1 year ago

3.21.0

1 year ago

3.21.3

1 year ago

3.21.2

1 year ago

3.20.37

1 year ago

3.20.32

1 year ago

3.20.34

1 year ago

3.20.35

1 year ago

3.20.30

1 year ago

3.20.31

1 year ago

3.21.5

1 year ago

3.20.43

1 year ago

3.21.4

1 year ago

3.21.7

1 year ago

3.21.6

1 year ago

3.21.9

1 year ago

3.21.8

1 year ago

3.20.40

1 year ago

3.21.12

1 year ago

3.20.41

1 year ago

3.21.11

1 year ago

3.20.42

1 year ago

3.20.0

1 year ago

3.17.0

1 year ago

3.16.5

1 year ago

3.16.4

1 year ago

3.16.3

1 year ago

3.16.2

1 year ago

3.16.1

1 year ago

3.16.0

1 year ago

3.15.1

1 year ago

3.15.0

1 year ago

3.14.5

1 year ago

3.14.2

1 year ago

3.14.1

1 year ago

3.14.0

1 year ago

3.13.1

1 year ago

3.13.0

1 year ago

3.12.3

1 year ago

3.12.2

1 year ago

3.12.0

1 year ago

3.11.2

1 year ago

3.11.1

1 year ago

3.11.0

1 year ago

3.10.0

1 year ago

3.9.23

1 year ago

3.9.22

1 year ago

3.9.21

1 year ago

3.9.20

1 year ago

3.9.19

1 year ago

3.9.18

1 year ago

3.9.17

1 year ago

3.9.16

1 year ago

3.9.15

1 year ago

3.9.14

1 year ago

3.9.13

1 year ago

3.9.12

1 year ago

0.0.1

1 year ago

3.9.10

1 year ago

3.9.9

1 year ago