Cabbage Logo
Back to Cabbage Site

Synthesizer with waveform modification

I have this synthesizer that reads a function table (Made in GEN16 routine) and I want to control its values with slider widgets.

The values of the table in GEN16 are the waveform of the synthesizer.

In the image below you can see small sliders that should control the values of the table in GEN16 (beg, dur1, type1, val2, etc.).

The values should be able to be updated in real time, and see the change in real time on the graph.

I don’t know a correct way to make this work; I’m someone very basic in programming. I have tried to do it with tablew but I can’t seem to get the hang of it.

Any way you can help me?

Hi @Carambolo, check out the gentable examples in the widgets examples menu. that is the best starting point for dynamically updating a table in real time. let me know if you have any questions. :+1:

1 Like

The examples were very helpful! I can now make changes to the table with my sliders, although I only see them after pressing a key.

I know I can figure that out later.
For now I want to ask you; what routine would be the most suitable for putting together my own waveforms, plus the common ones (Sine, triangle, square, saw, etc)?

At the moment I am working with GEN16 but it is complicated for me to put together waveforms like square.


I think GEN16 will give you most scope but you can generate the waveforms using line segments with GEN07 too, but any kind a wave generation like this likely to result in aliasing when you play back at higher pitches. You should look at the vco2 opcode to avoid this.

So let’s say I use vco2.
And I generate the GEN16 table with my waveform, there wouldn’t be an aliasing problem, right?

you’d then need to use vco2init to create a set of tables to use based on your waveform :+1:

1 Like

I was able to get vco2 to read my table with vco2init already. And was able to reproduce it.

But when using my sliders to change the table values, I don’t get a sound change.

Can you share your CSD file so we can take a look?

Sure! It’s a pretty small file…
CabbageSintetizador2.csd (4.4 KB)

I see 2 issues here.

  1. vco2init is only called once. it should be called each time you update a table - but I’m not sure it is was ever meant to be used this way

  2. instr UpdateTable is being called each note, that’s not right. it should only be called when a slider changes. the quick fix, remove that code and put it in an always on instrument as in the attached.

CabbageSintetizador2.csd (4.5 KB)

Note the table does not display correctly because the data sent to it doesn’t add up right as far as i can tell, although I’ve not used gen16 before…

I’d return o the vco2init issue once the table displays the correct shape…

I added your modifications to the code!

Although, I really think the values that are introduced to the gen16 table are at least minimally adequate.

In the version of the code without your modifications I could see the changes, at least when pressing a key.

Maybe it’s another reason why we don’t see the values in the table this time?

Can you send me that .CSD?

CabbageSintetizador1 (oscil).csd (4.3 KB)

this doesn’t show any waveform for me?

Only changes when you press something on the keyboard.
Like in the video I uploaded before, try to do it while pressing a key.

It’s like, half the work it should do.
But in the new code, it doesn’t even show an update in the table when you press a key or at some point.

yeah, I’m not even getting that? strange. when i press and hold a note the waveform doesn’t show. if i swap out a gen16 for gen10 in the code i sent yesterday it works as expected. that’s why i feel there must be something up with gen16… :thinking:

Do you think you still have your gen10 version?
I would like to take a look at it for comparison.

I am using Cabbage 2.9.0 which I believe is the latest version. I don’t think we are using different versions of the program!

Try fixing the GEN16. Two things to consider:

• when creating single cycle waveforms with GEN16, the table should start and end on a value (preferably the same value), so there should be a multiple of 3 parameters + 1

ie. val1, dur1, type1, val2, dur2, type2, val3

Your table ends on a type.

• the sum of all dur should be = table size

Try modifying your table (here it’s altered to keep the ratio of dur1 & dur2):

itmp ftgen 1, 0, 2048, 16, -1, 1000, 0, 1, 2400, 3, -1, 2, 0

itmp2 ftgen 2, 0, 2048, 16, -1, 600, 0, 1, 1448, 3, -1

They now add up to 2048.

apart from @ST_Music advise, you should grab the latest beta for sure. details here

edit: here is a modified version of yours using the first 3 sliders to manipulate the waveform

CabbageSintetizador2.csd (4.6 KB)