Show HN: What if your synthesizer was powered by APL (or a dumb K clone)? (octetta.github.io)

52 points by octetta 6 hours ago

I built k-synth as an experiment to see if a minimalist, K-inspired array language could make sketching waveforms faster and more intuitive than traditional code. I’ve put together a web-based toolkit so you can try the syntax directly in the browser without having to touch a compiler:

Live Toolkit: https://octetta.github.io/k-synth/

If you visit the page, here is a quick path to an audio payoff:

- Click "patches" and choose dm-bell.ks.

- Click "run"—the notebook area will update. Click the waveform to hear the result.

- Click the "->0" button below the waveform to copy it into slot 0 at the top (slots are also clickable).

- Click "pads" in the entry area to show a performance grid.

- Click "melodic" to play slot 0's sample at different intervals across the grid.

The 'Weird' Stack:

- The Language: A simplified, right-associative array language (e.g., s for sine, p for pi).

- The Web Toolkit: Built using WASM and Web Audio for live-coding samples.

- AI Pair-Programming: I used AI agents to bootstrap the parser and web boilerplate, which let me vet the language design in weeks rather than months.

The Goal: This isn't meant to replace a DAW. It’s a compact way to generate samples for larger projects. It’s currently in a "will-it-blend" state. I’m looking for feedback from the array language and DSP communities—specifically on the operator choices and the right-to-left evaluation logic.

Source (MIT): https://github.com/octetta/k-synth

jodrellblank 3 hours ago

Marshall Lochbaum's APL-derived language BQN has some nods towards audio synthesis too:

https://mlochbaum.github.io/BQN-Musician/synth/index.html

bradrn an hour ago

octetta an hour ago

Wowie! I'M NOT WORTHY! Cool stuff!

bradrn an hour ago

octetta 2 hours ago

BQN kicks-ass and I've spent hours listening to the Array Cast podcast while in SoCal traffic. I'll check his stuff out with an eye towards the audio stuff.

I'm an APL newb... while I've been writing code-for-cash forever (C, etc.) I've had a long-time interest in APL languages, but I'm just messing around after working on waveform generation for another sound project I have in the works (https://github.com/octetta/skred ... https://youtu.be/L5-3gBpJsAo?si=JdBlntzn4doY-c3s).

While I was working on this I remember the first book I saw in the public library on computer programming was about APL (probably sometime around 1976)... I didn't have access to a "real computer" for another year after that and no APL for decades, but some ideas stick around, LOL.

octetta an hour ago

On the C-side, I'm going to add a UDP listener to the code so I can send k-synth incantations live from Emacs (something I did for my skred program at the suggestion of an Emacs user). Let me know if anyone wants to know about this when it's usable. On the desktop app side, I use miniaudio (thank's Macron) so this is portable to the usual suspects. I also made a single header file cross platform midi library which I have some devious plans for in this space. Stay tuned.

octetta an hour ago

A warning... if you save a setup to JSON, it naively stores the generated waveforms put in slots and the notebook, so the files can become quiet large. I have a plan to just keep the code behind the waves and regenerate the waveforms at load time.

jart 3 hours ago

How do we get it to play Kompressor? https://youtu.be/9tlA0IyKjiI

octetta 3 hours ago

Wowie... Jart commented! I'm on it my friend. Certainly sequencing is a good thing to add.

octetta 3 hours ago

I have a CLI and desktop versions on github (all MIT license)

https://github.com/octetta/k-synth https://github.com/octetta/ksynth-desktop/

it's been a blast to play with... and a great excuse to learn array languages

UncleEntity 43 minutes ago

> ...and the right-to-left evaluation logic.

The evaluation order doesn't matter as much as you don't really know what kind of function/operator you have at parse time so have to do a bunch of shenanigans to defer that decision until runtime while still keeping it efficient. Kind of fiddly to get right but once it works, it just works.

Claude and me (and a ton of decades old research) pretty much figured out all the complications in the APL parse/eval stack (https://github.com/dan-eicher/AiPL).

octetta 29 minutes ago

I'm looking forward to checking out your stuff...

hmokiguess 4 hours ago

Pretty cool, one suggestion for the site would be to have templates you can quickly load, copy, edit, and share. Sort of like strudel.cc has!

octetta 2 hours ago

At any rate, in case it's hard to see, definitely try loading the dm-bell.ks patch, putting it in slot one so the melodic pad can play it... it's quick and dirty to see what's capable in a few keystrokes... although I'm sure the PD and ChucK and SC and ... wizards could put me to shame in a showdown, LOL.

octetta 3 hours ago

i wimped out and just have the patches being loaded from my github repo. good suggestion though.

xrd 3 hours ago

Did you know you can embed strudel?

https://strudel.cc/technical-manual/project-start/

octetta 2 hours ago

hmokiguess 2 hours ago

steveBK123 3 hours ago

This is great

octetta 3 hours ago

thanks!

jdontillman 2 hours ago

See also: Stanley Jordan, "APL For Music".

https://dl.acm.org/doi/pdf/10.1145/75144.75174

(!!!)

(Wait, what? That Stanley Jordan?) (Yep.)

octetta 2 hours ago

Wow! I had no idea, will look here for inspiration too. Thanks!