Ok so for one thing, in your file you are querying channels in your Csound code that don’t have any corresponding widgets in your Cabbage code. For example, “Window”. I assume this is because you copied over Iain’s csound code but sort of rewrote his Cabbage code. I don’t think this is causing the crashing, though.
the line
giHanning ftgen 0, 0, 4097, 20, 2
generates an f-table using GEN20. The ftgen
opcode generates an f-table from the orchestra, and when the first argument is zero, it automatically generates a table number instead of the user having to manual set the table number as they do if they were to use an f-statement in the score for the purpose. when ftgen
sets the table number automatically, it makes sure there are no conflicting table numbers. In any case, the output argument, “giHanning” in this case, contains the number of the ftable. So the user can use this variable instead of remembering a specific table number.
Now, in Iain’s original code, he calls ftgen
multiple times in the Csound header. This relies on another trick that ftgen does. When it automatically chooses a table number it does so in sequential order. Whatever the last ftgen came up with for a table number, this time it goes one higher (unless there is already a table defined with that number, in which case it will avoid overwriting). So in Iain’s original code, giTriangle (the number of the Triangle ftable) is going to be one greater than giHanning (the number of the Hanning ftable). giHalfSine will be one greater than giTriangle. Etc.
This trick is used by this line in instr 1.
iWfn = giHanning + i(kWindow) - 1
See how by choosing a different window in the GUI, the user changes the value of kWindow, which then adds to the value of giHanning to tell Csound which table to read (iWfn) for the window function.
You copied this line into your code, but you aren’t generating all the ftables, only the first one (Hanning).
Again, no guarantees that there isn’t another issue causing the crash, but I’m guessing this is the root of it, because Csound will usually crash with a seg violation (instead of giving an error) when you do things like tell it to read an ftable that doesn’t exist… which you may be doing.