{"id":13433603,"url":"https://github.com/chr15m/jsfxr","last_synced_at":"2025-03-17T13:30:33.277Z","repository":{"id":35504061,"uuid":"39773933","full_name":"chr15m/jsfxr","owner":"chr15m","description":"JavaScript sound effects generator.","archived":false,"fork":true,"pushed_at":"2023-05-04T07:15:03.000Z","size":623,"stargazers_count":313,"open_issues_count":3,"forks_count":31,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-08T20:49:13.897Z","etag":null,"topics":["8-bit","8bit","audio","game-development","javascript","library","music","retro","sound","sound-effects"],"latest_commit_sha":null,"homepage":"http://sfxr.me","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"grumdrig/jsfxr","license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chr15m.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-27T12:45:55.000Z","updated_at":"2025-03-08T08:51:51.000Z","dependencies_parsed_at":"2023-01-16T22:29:37.709Z","dependency_job_id":null,"html_url":"https://github.com/chr15m/jsfxr","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/chr15m%2Fjsfxr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chr15m%2Fjsfxr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chr15m%2Fjsfxr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chr15m%2Fjsfxr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chr15m","download_url":"https://codeload.github.com/chr15m/jsfxr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244041327,"owners_count":20388218,"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":["8-bit","8bit","audio","game-development","javascript","library","music","retro","sound","sound-effects"],"created_at":"2024-07-31T02:01:30.559Z","updated_at":"2025-03-17T13:30:32.819Z","avatar_url":"https://github.com/chr15m.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Quick 'n' easy game sound effects generator.\n\nApp 👉 https://sfxr.me\n\n[About](#about) | [Use as a library](#library) | [Jsfxr Pro](#jsfxr-pro)\n\n# About\n\nA port of [sfxr](http://www.drpetter.se/project_sfxr.html) to HTML5 by Eric Fredricksen.\nMaintained by Chris McCormick.\n\n![jsfxr screenshot](screenshot.png)\n\n# Library\n\nYou can use the jsxfr library to generate and play sounds in your JavaScript game code.\n\n## Node\n\nInstall it:\n\n```\nnpm i jsfxr\n```\n\nRequire it:\n\n```\nconst sfxr = require(\"jsfxr\").sfxr;\n```\n\nSee [API](#API) below for usage examples.\n\n## Browser\n\nInclude the scripts in your page:\n\n```\n\u003cscript src=\"https://sfxr.me/riffwave.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://sfxr.me/sfxr.js\"\u003e\u003c/script\u003e\n```\n\nYou can then directly use the `sfxr` namespace without requiring it.\n\n## API\n\nGenerate a sound effect using a preset algorithm and play it using webaudio API.\n\n```javascript\nconst sfxr = require(\"jsfxr\").sfxr;\n\nconst preset = \"pickupCoin\";\nconst sound = sfxr.generate(preset);\n\nsfxr.play(sound);\n```\n\nAvailable presets are `pickupCoin`, `laserShoot`, `explosion`, `powerUp`, `hitHurt`, `jump`, `blipSelect`, `synth`, `tone`, `click`, and `random`.\n\nYou can also use the interface at https://sfxr.me to find the sound you want and then use the sound definition.\nClick the \"serialize\" button and copy the JSON code for the sound you want.\nYou will get a datastructure that you can use like this:\n\n```javascript\nvar sound = {\n  \"oldParams\": true,\n  \"wave_type\": 1,\n  \"p_env_attack\": 0,\n  \"p_env_sustain\": 0.31718502829007483,\n  \"p_env_punch\": 0,\n  \"p_env_decay\": 0.2718540993592685,\n  \"p_base_freq\": 0.2612\u003cF2\u003e6191208337196,\n  \"p_freq_limit\": 0,\n  \"p_freq_ramp\": 0.43787689856926615,\n  \"p_freq_dramp\": 0,\n  \"p_vib_strength\": 0,\n  \"p_vib_speed\": 0,\n  \"p_arp_mod\": 0,\n  \"p_arp_speed\": 0,\n  \"p_duty\": 1,\n  \"p_duty_ramp\": 0,\n  \"p_repeat_speed\": 0.7558565452384385,\n  \"p_pha_offset\": 0,\n  \"p_pha_ramp\": 0,\n  \"p_lpf_freq\": 1,\n  \"p_lpf_ramp\": 0,\n  \"p_lpf_resonance\": 0,\n  \"p_hpf_freq\": 0,\n  \"p_hpf_ramp\": 0,\n  \"sound_vol\": 0.25,\n  \"sample_rate\": 44100,\n  \"sample_size\": 8\n};\n\nvar a = sfxr.toAudio(sound);\na.play();\n```\n\nYou can also use the short URL compressed version of the sound:\n\n```javascript\nvar a = sfxr.toAudio(\"5EoyNVSymuxD8s7HP1ixqdaCn5uVGEgwQ3kJBR7bSoApFQzm7E4zZPW2EcXm3jmNdTtTPeDuvwjY8z4exqaXz3NGBHRKBx3igYfBBMRBxDALhBSvzkF6VE2Pv\");\na.play();\n```\n\nYou can also access an array of samples.\nBy default the buffer contains audio rendered at a sample rate of `44100`.\n\n```\nvar buffer = sfxr.toBuffer(sound);\nconsole.log(buffer);\n```\n\nAdditionally you can get a dataURI for a wav file of the sound:\n\n```\nvar a = sfxr.toWave(sound);\nconsole.log(a.dataURI);\n```\n\nYou can convert between the base58 short-url encoded format and JSON using `b58encode` and `b58decode`:\n\n```\nvar b58string = sfxr.b58encode(sound);\nvar sound = sfxr.b58decode(b58string);\n```\n\nYou can also access the lower level classes `SoundEffect` and `Params` if you need to.\nThis can be useful for caching the internal representation for efficiency, or mutating the sound with `params.mutate()`.\n\n# Jsfxr Pro\n\nA [Pro version of Jsfxr](https://pro.sfxr.me/) is available with enhanced features like the ability to save sounds to packs and download a zip file of all wavs.\n\n[![Jsfxr Pro Screenshot](./jsfxr-pro-screenshot.png)](https://pro.sfxr.me)\n\n# Links\n\n* Application:  http://sfxr.me/\n* Source code:  https://github.com/chr15m/jsfxr/\n\n# Thanks\n\n* Dr. Petter for inventing sfxr.\n* Eric Fredricksen for creating this port.\n* riffwave.js: http://www.codebase.es/riffwave/\n* jquery-ui:   http://jqueryui.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchr15m%2Fjsfxr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchr15m%2Fjsfxr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchr15m%2Fjsfxr/lists"}