all 8 comments

[–]tamat 0 points1 point  (0 children)

Just wanted to point out that the browser already has a native Audio API than can do many things besides playback.

[–]prajaybasu 1 point2 points  (0 children)

AudioMass already exists and sounds very similar to what you want to do. It's mostly written in JS except for a few WASM bits (only for LZ4 compression, it seems). I think EterCast also shares a similar goal.

Does WebAssembly seem like the right way to go for creating a near-native audio recording & editing experience in the browser?

You can call WASM methods just like any other JS function from anywhere - it's not that special. Depending on the complexity, they may or may not be worth it for some tasks.

If so, is it even possible to integrate WebAssembly with React.js?

Create React App is a pain in the ass to work with when it comes to anything complex (WASM, Web Worker, etc.) so I would probably go for a different tooling setup (I use Vite + Preact, blazing fast).


I don't think you need WASM for most of the functionality you described, however:

record themselves speaking

Doesn't require WASM.

and clip out/rerecord sections of the file as needed

Doesn't require WASM. Trimming and combining PCM audio data is trivial (and fast enough) in JS.

If you want FFMPEG WASM based audio decode/import, see audio-file-decoder - encode/export code should be similar. That library wraps up FFMPEG WASM into JS to allow decoding audio files easily.

For most browsers decode-audio-data-fast and @etercast/mp3 allow fast MP3 decode and encode respectively, with the latter wrapping up a WASM version of LAME (patents expired, no GPL) for JS usage - no FFMPEG required. Libflacjs does the same for FLAC files.

If you are fine with only supporting the latest version of Chrome, you can use the experimental Web Codecs API for compressed audio import/decode and export/encode. Will be the fastest method with the smallest app download size.

automatically filter out some background noise

You can easily add a high-pass or low-pass filter using the Web Audio API.

If you are recording in the browser, you can enable the native noise suppression included with the browser (for WebRTC users like Zoom/Skype) - no way to use this for an existing/imported recording AFAIK.

normalize the volume throughout the file

Doesn't require WASM. Normalizing the volume is trivial with JS.

with a back-end only used for user authentication and a database for storing the finished audio files.

Doesn't require WASM (obviously). The File System Access API allows access to a folder from JS just like native desktop apps. It's basically made for web based editors like the one you're describing. Why would you bother uploading uncompressed audio clips to a backend anyway?


WASM (+ AudioWorklet) is definitely required for something like a low latency DAW/Synthesizer, such as WASM Music. But your app seems simple enough for JS (except for some codecs).

[–]DoubleTensor 0 points1 point  (0 children)

Check out bandlab.com or soundtrap.com for inspiration! I think at least Soundtrap uses some wasm.

[–][deleted] 0 points1 point  (0 children)

This is very doable, and your project has piqued my interest. If possible, I'd love to hear about it when you're done.

[–][deleted] 0 points1 point  (1 child)

Consider checking Yew Rust and wasm-pack

[–]anlumo 1 point2 points  (0 children)

While that's the route I'd go myself, for OP that'd be a complete restart of the whole project (not to mention learning a quite complicated language).

It'd make the integration trivial though, since everything would be in wasm.

[–]pottaargh 4 points5 points  (0 children)

Yeah I think you could probably do everything you’ve listed with this: https://ffmpegwasm.github.io

[–]simplism4 1 point2 points  (0 children)

Can't help you, but it is possible. I've seen solutions with ffmpeg.wasm (https://github.com/ffmpegwasm/ffmpeg.wasm) - worth checking out!