Cabbage Logo
Back to Cabbage Site

Duplicating a reverb'd signal down 1octave

Hello! Sorry for the dumb question but I’m really new to csound. I have a hacked reverb plugin example and I’m trying to duplicate the already reverberated signal down an octave (so that there’s 2 reverbs happening), I just can’t wrap my head around the syntax.

Do i need to first convert the current reverb output to something else? I tried the octave function but just got build errors.

Please use small words because I’m reaaaaaaally new to csound :confused:

Welcome to Cabbage and Csound!

Do you want the pitch shifter to be before or after the reverb? I would recommend placing it before the reverb, that way the reverb will smear any artefacts introduced by the pitch shifter.

What way do you want to implement the pitch shifter? Using time domain processing (delays) or frequency domain processing (pvs opcodes)? I would recommend time domain in this context.

To implement the pitch shifter you could look at the example Examples/Effects/Spectral/PitchShifter.csd. It implements the time domain pitch shifter as a UDO so you should be able to transplant the code for the pitch shifter to your own project reasonably easily.

A rather nice thing you can do is to implement an FDN reverb and insert a pitch shifter within the global feedback loop. This creates an arpeggiating effect in which the pitch shifter interval is repeated over and over.

I hope this is of some help. If you need any clarification on any of this, please ask.

Thanks Iain!

I think I’d put the pitch shifter before the reverb like you suggest. I’m looking at the example now and I’ve copied the opcode for the first type of pitch shifter over, as well as calling the opcode in the instrument, this results in an undefined variable “gihanning” but when I copy that over and paste it in the same spot as the example (under the sample rate stuff), and build, Cabbage crashes. I have no idea what gihanning is supposed to do but I assume it’s necessary.

reverb_plugin_firsttest.csd (4.4 KB)

Sorry for the ugly code, I’ve left in some variables and stuff that I’m not sure if I need yet or not.

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.

1 Like