Live data from Hacker News

Show HN: Koelsynth – a simple FM synthesis library

github.com

1–10 of 23 posts

Show HN: Koelsynth – a simple FM synthesis library

#1
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.

Show HN: Koelsynth – a simple FM synthesis library
github.com

Re: Show HN: Koelsynth – a simple FM synthesis library

#2
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.

Re: Show HN: Koelsynth – a simple FM synthesis library

#4
post #3

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?

I think the reason the DX stuff broke out besides the different sound was they could do it on a cpu at the time and have a lot of voices without incurring the hardware transitor cost for each voice as much. I'm not an audio programmer but I've heard trying to emulate subtractive synthesis can be difficult.

In the github section the author somewhat alludes to this : "Next, there is "subtractive" synthesis (not really a surprise after "additive" synthesis, is it?). It involves taking a waveform with many harmonics (triangular wave, sawtooth wave, etc) and using a time-varying filter to remove the higher harmonics. I tried that too once, but it wasn't great either, at least for the effort involved in coding and tweaking the parameters."

Re: Show HN: Koelsynth – a simple FM synthesis library

#5

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 th…

Fun little game! Nice work

Re: Show HN: Koelsynth – a simple FM synthesis library

#6
post #3

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?

I think the reason the DX stuff broke out besides the different sound was they could do it on a cpu at the time and have a lot of voices without incurring the hardware transitor cost for each voice as much. I'm not an audio programmer but I've heard trying to emulate subtractive synthesis can be difficult. In the github section the author somewhat alludes to this : "Next, there is "subtractive" synthesis (not really…

FM synths used dedicated ASICs to generate audio. It wasn't possible for mainstream CPUs of the era to do it in real time.

Re: Show HN: Koelsynth – a simple FM synthesis library

#7
post #3

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?

FM is designed to be calculated digitally, and with a few hacks (like a lookup table for a function involving sin() and log()) can be calculated very cheaply.

In the DX7 it was done on custom digital circuitry, but modern CPUs are just as happy to do a few additions and a table lookup once in a while.

Re: Show HN: Koelsynth – a simple FM synthesis library

#8
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/

Re: Show HN: Koelsynth – a simple FM synthesis library

#10
post #3

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?

I think the reason the DX stuff broke out besides the different sound was they could do it on a cpu at the time and have a lot of voices without incurring the hardware transitor cost for each voice as much. I'm not an audio programmer but I've heard trying to emulate subtractive synthesis can be difficult. In the github section the author somewhat alludes to this : "Next, there is "subtractive" synthesis (not really…

> I've heard trying to emulate subtractive synthesis can be difficult.

Just filtering frequencies isn't that difficult, but to get a digital filter sounding equivalent to a specific analog audio filter is an art. There's an entire industry trying to recreate the 'character' of certain imperfections found in old synthesizers. Some FM synthesizers also have subtractive filters. There are even analog synthesizers with FM so it's not an either/or.

Post reply on HN