3 ms·
Instead of exporting to a file is there a way to just make the sounds on the fly and then reuse them? For example in a JavaScript browser game?
by deadbabe 1y ago
Instead of exporting to a file is there a way to just make the sounds on the fly and then reuse them? For example in a JavaScript browser game?
- fenomas 1y agoI got way into webaudio and made some libraries to that effect. For something close to TFA, try wafxr: https://fenomas.github.io/wafxr/ https://fenomas.github.io/wafxr/ It can export wav files, but its main purpose is to generate code snippets for playing the sound effect through webaudio, underneath using a much more general library. But people familiar with audio synthesis might prefer just using the underlying dependency directly - it basically turns arbitrary config into webaudio. This playground shows how it works: https://fenomas.github.io/wasgen/ https://fenomas.github.io/wasgen/
- jezzamon 1y agoSFXR is this is the canonical tool for doing that, and yes, you can do that! I'm not sure what this webpage is, jsxfr is the name of the JavaScript library on nodejs which is a different url to this page. But yeah once you start generating things procedurally you can do things like generate 10 sounds with subtle variations to make things less repetitive.
- fenomas 1y ago> I'm not sure what this webpage is, jsxfr is the name of the JavaScript library Basically: - The original sfxr was a win32 app, ca. 2007 - There was later a widely-used Flash port called as3sfxr, ca. 2010 - This page (TFA) is a JS port of sfxr, ca. 2011. - `jsfxr` on npm was originally a separate JS port of as3sfxr, ca 2014 - Current `jsfxr` on npm appears to have changed hands in 2022, and is now a fork of TFA with somebody else's contributions (and a paid version, confusingly branded as "sfxr")
- chickenzzzzu 1y agoDont know about the library but any byte array in javascript can be converted to base64 and referenced via a data url
- whilenot-dev 1y agoHere's the docs for the API: https://github.com/chr15m/jsfxr?tab=readme-ov-file#api https://github.com/chr15m/jsfxr?tab=readme-ov-file#api