TWID #17: Exploring Gen
Using gen and dsp thinking to figure out what kind of synthesizer to build.
This week I was continuing my journey to building my own synthesiszer.
It is a really broad field an I struggle a bit to find my way on how to do it properly.
Right now I am trying to figure out which directions there are and what kind of synthesizer I even want to build. To do a little first step I bought a book about gen written by the inventor of this programming language.
The audio world at that level is really new to me and I have a hard time understanding what is going on there, so my progress is really slow. But beeing in a completely new world is also kind of exciting, so i’ll share what I have learned to maybe notice some progress over time.
Thinking about time
So time is a nice keyword, since the first chapter of the book deals with ways to think about time and control stuff with it. It focusses around the concept of counting sample by sample (which is on of the main aspects of gen) and using this ever increasing number as the base timing.
By dividing that number by the sample rate and feeding it into a wrap operator you get an always repeating ramp from 0 to 1 of which you can base timing events on.
By doing that we can take a sample operator which is reading from a buffer of audio and playing back parts of that buffer based on a 0 to 1 fraction of the whole thing. This is really helpful, since we can speed the playback up order down as we like, based on the speed of the ramp we use.
Using Ramps
The main idea I take away from that is, that we can use repeating ramps based on a certain frequency we define. There is a phasor operator that takes a frequency in Hz as an input a then outputs a ramp based on the frequency.
We can use a number as BPM and divide it by 60 to have the frequency in Hz that we use to control the phasor. By diving it further we can use it for longer samples to play them back in the appropriate speed.
To get back to the sample operator which is playing that portion of the sample based on where we are at at the 0 to 1 cycle, we can use a fraction of that cycle to play back only a specific part of the sample.
Looping a ramp
We can take a ramp and multiply it by the number of slices and feed it back through a wrap 0-1 to get a sequence of smaller, but faster ramps. We the divide by the number of slices and have a sequence that is running through the fraction of the sample we want. By offsetting the amount before we divide again, we can choose which part we want to have.
This is very powerful so that we only use functions to choose which part we want to use for that.
Conclusion
This all sounds very weird to me, but I want to write it down to reflect on what I have learned so far and to not feel completely lost in this new world for me.
Other things I did this week
Animations
Drawing
That’s it for this week. Hope you liked it.





