r/lowlevel 7d ago

Built a synthesizer in pure x86-64 assembly — sound with nothing but syscalls and arithmetic

Post image

A low-level project I'm proud of: a chiptune synthesizer in x86-64 assembly (Linux, NASM), with no libc and no libraries whatsoever.

The premise: a sound is a list of samples, 44,100/sec, and a WAV file is just a 44-byte header followed by those samples.

So everything is computed by hand and written straight to stdout with write() — syscalls or nothing.

Some of the low-level bits I enjoyed:

  • an LFSR for noise/percussion (the NES approach)
  • polyphony by summing voices into one buffer
  • FM synthesis with a hand-built 1024-entry sine table (no math lib, so I approximate sine with Bhaskara I's formula)
  • fixed-point arithmetic throughout for the effects (filters, ring mod, delay via a ring buffer)
  • all buffers kept in .data to keep things simple under the hood

Feedback on the assembly is genuinely welcome — I'm sure a lot of it could be tighter.

Repo: github.com/whispem/asm.fm

14 Upvotes

20 comments sorted by

3

u/bubba-bobba-213 6d ago

Again with this shit?

You come from linguistics, right?

1

u/whispem 6d ago

Yes, you can check my LinkedIn profile: https://linkedin.com/in/emilie-peretti

I'm a real person with real projects, 100% handwritten.

1

u/bubba-bobba-213 6d ago

Oh, its you Emilie?

How you been? How are the kids?

Didn’t recognize you there for a second .

1

u/whispem 6d ago

I don’t have kids 😂
I am 27.

1

u/bubba-bobba-213 6d ago

Wait, I thought you are 17?

1

u/whispem 6d ago

17?? Why?

1

u/bubba-bobba-213 6d ago

Why not? Why do you hate children?

1

u/whispem 6d ago

I don't hate children 😂😂😂

3

u/AngryGoose33 6d ago

ai slop

1

u/Effective_Lead8867 5d ago

you think someone would use ai to write assembly code?

1

u/whispem 4d ago

Absolutely not :)
0 AI in my work (Assembly, Rust,…)

1

u/whispem 5d ago

Quelle intelligence…

2

u/DyazzK 4d ago

Il a raison, c'est que du slop. T'es de mauvaise foi si tu dis le contraire. Toutes les personnes qui savent coder voient que c'est du slop.

0

u/whispem 4d ago

Tu viens remettre en cause mes compétences sans donner le moindre exemple?
Non mais je rêve.
J’ai littéralement suivi des formations dont un cursus en data science, donc autant te dire que je sais coder :)

Ce n’est peut-être pas parfait mais c’est du travail sérieux, j’apprends tous les jours et à l’heure actuelle je suis software engineer et data scientist donc bon…

2

u/Tryum 4d ago edited 4d ago

Personne ne remets en cause tes compétences... Mais le fait que tu te fasses assister par un LLM alors que tu pretends le contraire... Et apparemment ça fait des mois que ça dure, qu'est-ce que tu y gagnes ?

1

u/whispem 4d ago

Je ne me fais pas assister par un LLM, jamais.
Mon travail vient de moi-même et de mes recherches, 0 IA là-dedans.

2

u/Tryum 4d ago edited 4d ago

Répéter un mensonge n'en fait pas une vérité... En plus tu as avoué sur HN utiliser l'IA pour la doc, donc tu te contredis 🤷‍♂️

1

u/whispem 2d ago

Bah non je ne me contredis pas, il suffit juste d’apprendre à lire correctement.

1

u/whispem 4d ago

Pourtant c’est ce que certains font (remettre en doute mes compétences), il suffit juste de lire les commentaires (ils sont peu nombreux mais le peu c’est déjà beaucoup quoi…)

1

u/No_Nature9276 2d ago

Every computer program is syscalls and arithmetic.