Skip to content(if available)orjump to list(if available)

Synthesizing Music from JSON

Synthesizing Music from JSON

18 comments

·January 6, 2025

a1o

I wrote this JS thing 9 years ago and it still runs in the browser

https://ericoporto.github.io/bgmJs/

Much simpler implementation, you can read the JS code that was manually written. There is a link to the repository in the page.

luismedel

Why the "from JSON" part? JSON is the storage/representation format and, IMHO, the less interesting thing about this.

Is like saying "Synthesizing Music from a binary file" if you write a S3M player.

Outside of that, congrats. I think the author has enough "fame credits" to make any project an instant success. Kudos for that.

omnibrain

Because JSON today is some sort of "lingua franca" of data exchange and there is a vast library of tools to handle JSON. If you have something that "plays sound" from JSON it becomes easy to imagine using existing JSON based tools to create music. Building a "graphical music editor" for example would be easy for most web devs.

deathanatos

"Synthesizing Music from JSON" to me means something I could feed JSON into, and it would somehow transform it into music.

This is just using JSON as an encoding format. (And as a "legacy" one, too, it seems like its moved to JS.)

> it becomes easy to imagine using existing JSON based tools to create music.

No … it really doesn't? I am trained in both music and JSON, and I have no idea how that'd work.

Because you don't have "something that 'plays sound' from JSON" you have something that plays sound from application/sonant-x+json ; the interesting bits are in the "application/sonant-x" but your tooling only understands the "+json".

null

[deleted]

throwaway2046

It's amazing to see FOSS music trackers still being made, each time a bit more modernized. Although the new "single instrument tracks" model may take a while to click for me, I think it may allow for more dynamic songs.

P.S. what's the license for pl_synth? I couldn't find one on the repo.

p0w3n3d

This is from the same guy who created QOI - fast lossless compression

bityard

And the same guy that wrote a portable (+WASM) wipEout from leaked PSX sources: https://phoboslab.org/log/2023/08/rewriting-wipeout

8bitsrule

Massively fine. Thanks much for sharing! The instrument-generating part alone is Csound-grade stuff.

chaosprint

very nice. really love the ui.

for wasm you can have a look on my work:

https://glicol.org/

https://github.com/chaosprint/glicol

I wrote the audio engine in Rust and load it in JS with AudioWorklet and SharedArrayBuffer

tomduncalf

That's super cool!

For WASM with C++, I recently created a simple example using the new-ish AudioWorklet support in Emscripten, showing how to create an AudioWorklet oscillator with parameters. It removes a lot of the boiler plate you used to have to do, but the docs are a bit lacking.

https://github.com/tomduncalf/emscripten-audio-worklet-examp...

elihu

I get no audio when I try to use the live demo on Linux/Chromium, though Firefox is fine.

bugglebeetle

I’ve been working with Tone.Js recently and it’s been quite pleasant! Seems like it could handle this use case as well, fairly trivially. Worst part has been finding good royalty free sample sources for instruments.

scraggo

I wrote a small utility to create rhythmic melodies with Tone.js: https://github.com/scraggo/tone-rhythm

It's used in a side project I've had around for a while: https://random-music-generators.onrender.com/

chaosprint

bugglebeetle

I dug around on Freesound, but the search UI is pretty poor and sometimes broken. Seems like a great resource, but in need of a lot of work on the discovery side of things.

ladyanita22

Looks really nice. Any similar projects in Rust?

to11mtm

... would be interesting to find a way to meld this with Sonic-Pi somehow...