AI generated code for modular?


just had a fast play with ChatGTP, AI chat bot…
blew my mind, check my screen-capturing.
I asked the bot for the following:

"This is an idea for a modular synthesizer module. can you write me code for arduino Nano 3 based on the The Kuramoto model. The idea is that the output pins go high inspired/influenced by the The Kuramoto model. The full process is clocked from an external clock coming in on a pin. This clock can be divided. An analog potentiometer influences the amount of spontaneous synchronization of the oscillators. "

I am not a coder, so it’s difficult to judge for me. But I think that is pretty amazing science-(fiction).
I interrupted the recording halfway or so.

1 Like

The other day I asked it to generate a simple VCO in C++, then add MinBLEP to it, then convert it to Python code. It’s extremely impressive: this knowledge is pretty niche, and it wasn’t a straight copy-paste from open-source code. I didn’t verify the code, but it looked sane.

But while it’s extremely impressive, it remains a language model: an absurdly powerful autocomplete.
It has no understanding of what it talks about, and is prone to hallucinations (it is the term of the art). The more arcane the subject domain, the more it hallucinates, the more it returns patent nonsense with a cocksure air of authority.

This project would pipe together multiple uncommon, poorly documented domains. It seems likely you’d have to debug subtly nonsensical code very soon into the project, even if the general idea might look correct.


You should at least try to compile the code to see if the syntax is OK.

If it worked at all, it could have been interesting to see what it puts out,
but right from the start, it declares pin 2 a both the clock input and one of the 16 outputs, so that won’t work.

16 floating point oscillators in an 8-bit micro-controller also seems quite ambitious.
How fast does this need to run?
I’m assuming the oscillators are not meant to running at audio speed in this hardware.

1 Like

Yeah, even if the model didn’t hallucinate, performance would trip it up, in a MCU like this it’s common to use lookup tables for things like sines rather than make expensive calculations every sample. But there seems to be no prior art using those equations in a synth, much less in an embedded platform, so all the code online comes from use cases that value scientific precision. It would take something fundamentally different from a LLM to deduce performance would be a concern, and that LUTs would be a good compromise, yet it’s rather obvious to a human. I guess that’s the kind of pitfalls to expect.

A great example of the kind of problems you will run into, how the computer can be really smart and stupid at the same time.

I’m asking it to explain the Nyquist–Shannon theorem, and it does a great job—then gets completely tripped up when I ask what’s so magical about the 44,100 Hz value.

Of course, any human who knows this stuff can immediately make the connection: 22 kHz is a bit above the hearing range of a child, that’s why we use this value. But see how the computer tries to act like a cornered rat, never willing to admit it doesn’t know:

Open for chatlog pics

Chat GPT can generate bug free code pretty reliably. usually python in my exp. If you have a bug, you just put in the error code and it tends to fix itself.

I hate it! :slight_smile:

Your mentioning this made me think, can ChatGPT just do my current project in my stead? This is crazy, even if the code is wrong lol.

Click for big long chatlog


A new module by @HAGIWO (and Chat GPT :slight_smile: )

all details here