{"id":13768240,"url":"https://github.com/colinbdclark/sf2-parser","last_synced_at":"2025-05-13T20:30:57.789Z","repository":{"id":34673275,"uuid":"38646185","full_name":"colinbdclark/sf2-parser","owner":"colinbdclark","description":"A JavaScript SoundFont 2 parser","archived":false,"fork":false,"pushed_at":"2018-05-14T16:21:09.000Z","size":107,"stargazers_count":54,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T07:35:11.799Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/colinbdclark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-06T21:05:58.000Z","updated_at":"2024-09-21T07:33:01.000Z","dependencies_parsed_at":"2022-08-29T10:40:40.715Z","dependency_job_id":null,"html_url":"https://github.com/colinbdclark/sf2-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbdclark%2Fsf2-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbdclark%2Fsf2-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbdclark%2Fsf2-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbdclark%2Fsf2-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colinbdclark","download_url":"https://codeload.github.com/colinbdclark/sf2-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020902,"owners_count":22000805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-03T16:01:18.599Z","updated_at":"2025-05-13T20:30:57.123Z","avatar_url":"https://github.com/colinbdclark.png","language":"JavaScript","funding_links":[],"categories":["Sound assets"],"sub_categories":["SoundFonts"],"readme":"SoundFont 2 (and 3) Parser\n==================\n\nA library for parsing SoundFont (SF2, SF3) files in JavaScript.\n\nLicense and Credits\n-------------------\n\nThis library is based on the SoundFont 2 parser from [sf2synth.js, a SoundFont Synthesizer for WebMidiLink](https://github.com/gree/sf2synth.js). It was written by imaya / GREE Inc and licensed under the MIT license. Modifications to the original are by Colin Clark.\n\nHow to Use It\n-------------\n\n1. Load your SoundFont file using XHR's arraybuffer responseType and wrap it as a \u003ccode\u003eUint8Array\u003c/code\u003e\n2. Instantiate a new parser instance\n3. Call the \u003ccode\u003eparse()\u003c/code\u003e method to parse the SoundFont file\n4. Use the \u003ccode\u003egetPresets()\u003c/code\u003e and \u003ccode\u003egetInstruments()\u003c/code\u003e methods to access preset and instrument data\n5. Sample data is stored in the parser's \u003ccode\u003esample\u003c/code\u003e member variable\n\n### Example Code ###\n\n    // Utility function to load a SoundFont file from a URL using XMLHttpRequest.\n    // The same origin policy will apply, as for all XHR requests.\n    function loadSoundFont(url, success, error) {\n        var xhr = new XMLHttpRequest();\n        xhr.open(\"GET\", url, true);\n        xhr.responseType = \"arraybuffer\";\n        xhr.onreadystatechange = function () {\n            if (xhr.readyState === 4) {\n                if (xhr.status === 200) {\n                    success(new Uint8Array(xhr.response));\n                } else {\n                    if (options.error) {\n                        options.error(xhr.statusText);\n                    }\n                }\n            }\n        };\n        xhr.send();\n    }\n\n    // Load and parse a SoundFont file.\n    loadSoundFont(\"sf_GMbank.sf2\", function (sfData) {\n        var parser = new sf2.Parser(sf2Data);\n        parser.parse();\n\n        // Do something with the parsed SoundFont data.\n    });\n\nSummary of Changes from the Original\n------------------------------------\n\n* Separated out the SoundFont parsing library from the rest of the sf2synth synthesizer\n* Removed the dependence on Google Closure\n* Renamed the namespace to \u003ccode\u003esf2\u003c/code\u003e for brevity\n* Added boilerplate to support most JS module loaders, including CommonJS, AMD, Node.js and browser globals\n* Added a Grunt-based build process\n* Created Bower and npm packages\n\nTo Do\n-----\n\n* Improve the API of the parser by making it stateless\n* Add support for parsing in a Web Worker so that the main browser thread doesn't block\n* Massively extend the unit test coverage\n* Add support for running the unit tests in Node.js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinbdclark%2Fsf2-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolinbdclark%2Fsf2-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinbdclark%2Fsf2-parser/lists"}