Show HN: Koelsynth – a simple FM synthesis library

by graphitouton 11/11/2023, 8:52 PMwith 22 comments

This is part of my journey on pybind11. I wrote a tiny FM Synthesis library in C++ and a Python wrapper for that using pybind11.

There is a command-line piano app in the examples directory if you want to play with it. Here is the link: https://github.com/charstorm/koelsynth/tree/main/examples/si...

My next target is to attach this to some kind of physics simulation - like a bunch of balls moving around in a box with some internal walls. When the ball hits certain trigger points, it produces the sound.

by chaosprinton 11/12/2023, 7:20 AM

nice work!

Have you tried to port it to WASM?

Python can also call the wasm with wasmer

I ported https://github.com/chaosprint/glicol for my Python audio project using the same method

for your physics idea, with wasm, perhaps it can be something like this?

https://jackschaedler.github.io/karplus-stress-tester/

by nightowl_gameson 11/12/2023, 12:27 AM

Omg..I have that physics simulation and made crappy sound tones in audacity for it. I want to use this to make better sounds.

I added a music block to Goober Dash level editor:

https//gooberdash.winterpixel.io/

When your Goober, or a physics crate, hits the music block, it plays a note. I didn't release this branch yet. Can I use the piano notes from this lib in our game? I wouldn't be adding the generator code to the game, I just need sound files.

by tempodoxon 11/12/2023, 7:33 AM

Nice, I like simple projects like this.

However, Wikipedia has a better diagram and explanation of ADSR:

https://en.wikipedia.org/wiki/Envelope_(music)

by briancron 11/14/2023, 1:25 PM

As a newbie I really enjoyed your explanation of the synthesis process and why everybody should Fourier-sum phases rather than amplitudes.

by driggson 11/12/2023, 2:20 AM

Why is it that FM synthesis was so well-suited to relatively simple early digital hardware (eg. Yamaha's DX/TX line)?

Does that also make for relatively simple software FM synthesis?