{"id":41349439,"url":"https://github.com/spessasus/spessasynth_core","last_synced_at":"2026-01-30T20:04:40.837Z","repository":{"id":287883054,"uuid":"966088980","full_name":"spessasus/spessasynth_core","owner":"spessasus","description":"JavaScript MIDI + SoundFont/DLS Library","archived":false,"fork":false,"pushed_at":"2026-01-21T21:00:37.000Z","size":1511,"stargazers_count":29,"open_issues_count":5,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-22T01:46:18.624Z","etag":null,"topics":["dls","downloadable-sounds","midi","midi-parser","midi-player","midi-sequencer","sf2","sf3","sound-synthesis","soundfont","soundfont-player","soundfont-synthesizers","soundfont2","soundfont2-synthesizer-library","soundfonts"],"latest_commit_sha":null,"homepage":"https://spessasus.github.io/SpessaSynth","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spessasus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-14T11:40:31.000Z","updated_at":"2026-01-21T20:16:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"00a8fdee-d142-493c-8a4c-de2ab718372b","html_url":"https://github.com/spessasus/spessasynth_core","commit_stats":null,"previous_names":["spessasus/spessasynth_core"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/spessasus/spessasynth_core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spessasus%2Fspessasynth_core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spessasus%2Fspessasynth_core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spessasus%2Fspessasynth_core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spessasus%2Fspessasynth_core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spessasus","download_url":"https://codeload.github.com/spessasus/spessasynth_core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spessasus%2Fspessasynth_core/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28682738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dls","downloadable-sounds","midi","midi-parser","midi-player","midi-sequencer","sf2","sf3","sound-synthesis","soundfont","soundfont-player","soundfont-synthesizers","soundfont2","soundfont2-synthesizer-library","soundfonts"],"created_at":"2026-01-23T07:16:19.887Z","updated_at":"2026-01-30T20:04:40.830Z","avatar_url":"https://github.com/spessasus.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003c!--suppress HtmlDeprecatedAttribute, HtmlRequiredAltAttribute, HtmlExtraClosingTag --\u003e\n\u003cp align='center'\u003e\n\u003cimg src='https://raw.githubusercontent.com/spessasus/SpessaSynth/refs/heads/master/src/website/spessasynth_logo_rounded.png' width='300' alt='SpessaSynth logo'\u003e\n\u003c/p\u003e\n\n_A powerful SF2/DLS/MIDI TypeScript/JavaScript library. It works with any modern JS environment that supports\nWebAssembly._\n\nIt allows you to:\n\n- Play MIDI files using SF2/SF3/DLS files!\n- Read and write MIDI files!\n- Write SF2/SF3 files!\n- Convert DLS to SF2! (and back!)\n- [and more!](#current-features)\n\n### v4.0.0 TypeScript Update is here!\n\n[**Read about breaking changes here.**](https://spessasus.github.io/spessasynth_core/extra/3-28-migration-guide)\n\n\u003e **Tip:**\n\u003e\n\u003e Looking for an easy-to-use WebAudioAPI browser wrapper?\n\u003e Try [spessasynth_lib](https://github.com/spessasus/spessasynth_lib)!\n\n### [Project site (consider giving it a star!)](https://github.com/spessasus/spessasynth_core)\n\n### Made with spessasynth_core\n\n- [SpessaSynth Online SF2/DLS MIDI Player](https://spessasus.github.io/SpessaSynth)\n- [SpessaFont Online SoundFont/DLS Editor](https://spessasus.github.io/SpessaFont)\n\n### [Documentation](https://spessasus.github.io/spessasynth_core)\n\n**SpessaSynth Project index**\n\n- [spessasynth_core](https://github.com/spessasus/spessasynth_core) (you are here) - SF2/DLS/MIDI library\n- [spessasynth_lib](https://github.com/spessasus/spessasynth_lib) - spessasynth_core wrapper optimized for browsers and\n  WebAudioAPI\n- [SpessaSynth](https://github.com/spessasus/SpessaSynth) - online/local MIDI player/editor application\n- [SpessaFont](https://github.com/spessasus/SpessaFont) - online SF2/DLS editor\n\n## Current Features\n\n### Easy Integration\n\n- **Modular design:** _Easy integration into other projects (load what you need)_\n- **Flexible:** _It's not just a MIDI player!_\n- **Easy to Use:** _Basic setup is\n  just [two lines of code!](https://spessasus.github.io/spessasynth_core/getting-started#minimal-setup)_\n- **No dependencies:** _Batteries included!_\n- **TypeScript definitions:** _Autocompletion in IDEs!_\n\n### Powerful MIDI Synthesizer\n\n- Suitable for both **real-time** and **offline** synthesis\n- **Excellent SoundFont support:**\n    - **Full Generator Support**\n    - **Full Modulator Support:** _First (to my knowledge) JavaScript SoundFont synth with that feature!_\n    - **GeneralUserGS Compatible:**\n      _[See more here!](https://github.com/mrbumpy409/GeneralUser-GS/blob/main/documentation/README.md)_\n    - **SoundFont3 Support:** Play compressed SoundFonts!\n    - **Experimental SF2Pack Support:** Play soundfonts compressed with BASSMIDI! (_Note: only works with vorbis\n      compression_)\n    - **Can load very large SoundFonts:** up to 4GB! _Note: Only Firefox handles this well; Chromium has a hard-coded\n      memory limit_\n- **Great DLS Support:**\n    - **DLS Level 1 Support**\n    - **DLS Level 2 Support**\n    - **Mobile DLS Support**\n    - **Correct articulator support:** _Converts articulators to both modulators and generators!_\n    - **Tested and working with gm.dls!**\n    - **Correct volume:** _Properly translated to SoundFont volume!_\n    - **A-Law encoding support**\n    - **Both unsigned 8-bit and signed 16-bit sample support (24-bit theoretically supported as well!)**\n    - **Detects special articulator combinations:** _Such as vibratoLfoToPitch_\n- **Soundfont manager:** Stack multiple soundfonts!\n- **Unlimited channel count:** Your CPU is the limit!\n- **Excellent MIDI Standards Support:**\n    - **MIDI Controller Support:** Default supported\n      controllers [here](https://spessasus.github.io/spessasynth_core/extra/midi-implementation#default-supported-controllers)\n    - **Portamento Support:** _Smooth note gliding!_\n    - **Sound Controllers:** _Real-time filter and envelope control!_\n    - **MIDI Tuning Standard Support:**\n      _[more info here](https://spessasus.github.io/spessasynth_core/extra/midi-implementation#midi-tuning-standard)_\n    - [Full **RPN** and limited **NRPN**\n      support](https://spessasus.github.io/spessasynth_core/extra/midi-implementation#supported-registered-parameters)\n    - **SoundFont2 NRPN Support**\n    - [**AWE32**\n      NRPN Compatibility Layer](https://spessasus.github.io/spessasynth_core/extra/midi-implementation#awe32-nrpn-compatibility-layer)\n    - Supports some [**Roland GS** and **Yamaha XG**\n      system exclusives](https://spessasus.github.io/spessasynth_core/extra/midi-implementation#supported-system-exclusives)\n\n### Powerful and Fast MIDI Sequencer\n\n- **Supports MIDI formats 0, 1, and 2:** _note: format 2 support is experimental as it's very, very rare._\n- **[Multi-Port MIDI](https://spessasus.github.io/spessasynth_core/extra/about-multi-port) support:** _More than 16\n  channels!_\n- **Smart preloading:** Only preloads the samples used in the MIDI file for smooth playback _(down to key and\n  velocity!)_\n- **Lyrics support:** _Add karaoke to your program!_\n- **Raw lyrics available:** Decode in any encoding! _(Kanji? No problem!)_\n- **Loop points support:** _Ensures seamless loops!_\n\n### Read and Write SoundFont and MIDI Files with Ease\n\n#### Read and write MIDI files\n\n- **Smart name detection:** _Handles incorrectly formatted and non-standard track names!_\n- **Raw name available:** Decode in any encoding! _(Kanji? No problem!)_\n- **Port detection during load time:** _Manage ports and channels easily!_\n- **Used channels on track:** _Quickly determine which channels are used!_\n- **Key range detection:** _Detect the key range of the MIDI!_\n- **Easy MIDI editing:**\n  Use [helper functions](https://spessasus.github.io/spessasynth_core/writing-files/midi#modifymidi) to modify the\n  song to your needs!\n- **Loop detection:** _Automatically detects loops in MIDIs (e.g., from **Touhou Project**)_\n- **First note detection:** _Skip unnecessary silence at the start by jumping to the first note!_\n- **Lyrics support:** _Both regular MIDI and .kar files!_\n- **[Write MIDI files from scratch](https://spessasus.github.io/spessasynth_core/midi/creating-midi-files)**\n- **Easy saving:** _Save with\n  just [one function!](https://spessasus.github.io/spessasynth_core/writing-files/midi#writemidi)_\n\n#### Read and write [RMID files with embedded sound banks](https://github.com/spessasus/sf2-rmidi-specification#readme)\n\n- **[Level 4](https://github.com/spessasus/sf2-rmidi-specification#level-4) compliance:** Reads and writes _everything!_\n- **Compression and trimming support:** _Reduce a MIDI file with a 1GB sound bank to **as small as 5MB**!_\n- **DLS Version support:** _The original legacy format with bank offset detection!_\n- **Automatic bank shifting and validation:** Every sound bank _just works!_\n- **Metadata support:** Add title, artist, album name and cover and more! And of course, read them too! _(In any\n  encoding!)_\n- **Compatible with [Falcosoft Midi Player 6!](https://falcosoft.hu/softwares.html#midiplayer)**\n- **Easy saving:**\n  _[As simple as saving a MIDI file!](https://spessasus.github.io/spessasynth_core/writing-files/midi#writermidi)_\n\n#### Read and write SoundFont2 files\n\n- **Easy info access:** _Just\n  an [object of strings!](https://spessasus.github.io/spessasynth_core/sound-bank#soundbankinfo)_\n- **Smart trimming:** Trim the sound bank to only include samples used in the MIDI _(down to key and velocity!)_\n- **SF3 conversion:** _Compress SoundFont2 files to SoundFont3 with variable quality!_\n- **Easy saving:** _Also just [one function!](https://spessasus.github.io/spessasynth_core/sound-bank#write)_\n\n#### Read and write SoundFont3 files\n\n- Same features as SoundFont2 but with now with **Ogg Vorbis compression!**\n- **Variable compression quality:** _You choose between file size and quality!_\n- **Compression preserving:** _Avoid decompressing and recompressing uncompressed samples for minimal quality loss!_\n- **Custom compression function:** _Want a different format than Vorbis? No problem!_\n\n#### Read and write DLS Level One or Two files\n\n- Read DLS (DownLoadable Sounds) files like SF2 files!\n- **Native support:** _Saving it as sf2 is\n  still [just one function!](https://spessasus.github.io/spessasynth_core/sound-bank#write)_\n- _That's right, saving as DLS is\n  also [just one function!](https://spessasus.github.io/spessasynth_core/sound-bank#writedls)_\n- Converts articulators to both **modulators** and **generators**!\n- Works with both unsigned 8-bit samples and signed 16-bit samples!\n- **A-Law encoding support:** _Sure, why not?_\n- **Covers special generator cases:** _such as modLfoToPitch_!\n- **Correct volume:** _looking at you, Viena and gm.sf2!_\n- Support built right into the synthesizer!\n- **Convert SF2 to DLS:** [limited support](https://spessasus.github.io/spessasynth_core/extra/dls-conversion-problem)\n\n### Export MIDI as WAV\n\n- Save the MIDI file as WAV audio!\n- **Metadata support:** _Embed metadata such as title, artist, album and more!_\n- **Cue points:** _Write MIDI loop points as cue points!_\n- **Loop multiple times:** _Render two (or more) loops into the file for seamless transitions!_\n- _That's right, saving as WAV is\n  also [just one function!](https://spessasus.github.io/spessasynth_core/writing-files/wav#audiobuffertowav)_\n\n### Limitations\n\n- Synth's performance may be questionable sometimes\n- [SF2 to DLS Conversion limits](https://spessasus.github.io/spessasynth_core/extra/dls-conversion-problem)\n\n#### TODO\n\n- Improve the performance of the engine\n- Potentially port the system to Emscripten\n\n### Special Thanks\n\n- [FluidSynth](https://github.com/FluidSynth/fluidsynth) - for the source code that helped implement functionality and\n  fixes\n- [Polyphone](https://www.polyphone-soundfonts.com/) - for the soundfont testing and editing tool\n- [Meltysynth](https://github.com/sinshu/meltysynth) - for the initial low-pass filter implementation\n- [RecordingBlogs](https://www.recordingblogs.com/) - for detailed explanations on MIDI messages\n- [stbvorbis.js](https://github.com/hajimehoshi/stbvorbis.js) - for the Vorbis decoder\n- [fflate](https://github.com/101arrowz/fflate) - for the MIT DEFLATE implementation\n- [tsup](https://github.com/egoist/tsup) - for the TypeScript bundler\n- [foo_midi](https://github.com/stuerp/foo_midi) - for useful resources on XMF file format\n- [Falcosoft](https://falcosoft.hu) - for help with the RMIDI format\n- [Christian Collins](https://schristiancollins.com) - for various bug reports regarding the synthesizer\n- **And You!** - for checking out this project. I hope you like it :)\n\n**If you like this project, consider giving it a star. It really helps out!**\n\n### Short example: MIDI to wav converter\n\n```ts\nimport * as fs from \"fs/promises\";\nimport {\n    audioToWav,\n    BasicMIDI,\n    SoundBankLoader,\n    SpessaSynthProcessor,\n    SpessaSynthSequencer\n} from \"spessasynth_core\";\n\n// Process arguments\nconst args = process.argv.slice(2);\nif (args.length !== 3) {\n    console.info(\n        \"Usage: tsx index.ts \u003csoundbank path\u003e \u003cmidi path\u003e \u003cwav output path\u003e\"\n    );\n    process.exit();\n}\nconst sf = await fs.readFile(args[0]);\nconst mid = await fs.readFile(args[1]);\nconst midi = BasicMIDI.fromArrayBuffer(mid.buffer);\nconst sampleRate = 44100;\nconst sampleCount = Math.ceil(44100 * (midi.duration + 2));\nconst synth = new SpessaSynthProcessor(sampleRate, {\n    enableEventSystem: false,\n    enableEffects: false\n});\nsynth.soundBankManager.addSoundBank(\n    SoundBankLoader.fromArrayBuffer(sf.buffer),\n    \"main\"\n);\nawait synth.processorInitialized;\nconst seq = new SpessaSynthSequencer(synth);\nseq.loadNewSongList([midi]);\nseq.play();\n\nconst outLeft = new Float32Array(sampleCount);\nconst outRight = new Float32Array(sampleCount);\nconst start = performance.now();\nlet filledSamples = 0;\n// Note: buffer size is recommended to be very small, as this is the interval between modulator updates and LFO updates\nconst BUFFER_SIZE = 128;\nlet i = 0;\nconst durationRounded = Math.floor(seq.midiData!.duration * 100) / 100;\nconst outputArray = [outLeft, outRight];\nwhile (filledSamples \u003c sampleCount) {\n    // Process sequencer\n    seq.processTick();\n    // Render\n    const bufferSize = Math.min(BUFFER_SIZE, sampleCount - filledSamples);\n    synth.renderAudio(outputArray, [], [], filledSamples, bufferSize);\n    filledSamples += bufferSize;\n    i++;\n    // Log progress\n    if (i % 100 === 0) {\n        console.info(\n            \"Rendered\",\n            Math.floor(seq.currentTime * 100) / 100,\n            \"/\",\n            durationRounded\n        );\n    }\n}\nconst rendered = Math.floor(performance.now() - start);\nconsole.info(\n    \"Rendered in\",\n    rendered,\n    `ms (${Math.floor(((midi.duration * 1000) / rendered) * 100) / 100}x)`\n);\nconst wave = audioToWav([outLeft, outRight], sampleRate);\nawait fs.writeFile(args[2], new Uint8Array(wave));\nconsole.info(`File written to ${args[2]}`);\n```\n\n### Building\n\nTo build the NPM package, do:\n\n```bash\nnpm install\nnpm run build\n```\n\nThe files will be placed in the `dist` folder.\n\n## License\n\nCopyright © 2026 Spessasus\nLicensed under the Apache-2.0 License.\n\n#### Legal\n\nThis project is in no way endorsed or otherwise affiliated with the MIDI Manufacturers Association,\nCreative Technology Ltd. or E-mu Systems, Inc., or any other organization mentioned.\nSoundFont® is a registered trademark of Creative Technology Ltd.\nAll other trademarks are the property of their respective owners.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspessasus%2Fspessasynth_core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspessasus%2Fspessasynth_core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspessasus%2Fspessasynth_core/lists"}