Hi,
So I have a stripped down version of the fmod_gain plugin working in fmod studio. My goal is to use this as a template for writing a granular effect. Since it requires working with live input instead of just using a file loaded in, i figure i need a delay line and history for storing incoming signal data into a circular buffer. are there any examples of this in the fmod_dsp examples? I’m seeing in the documentation there is something for delay which might be useful, but any guidance would be super helpful! Furthermore, the gain cpp is working with writing input to output data with a ramp of 256 samples. I’m guessing this iterates through 256 samples at a time, and resets at the next block of 256 samples, but my intuition might be wrong here. Please let me know of any helpful resources for this, or if my logic is flawed in any way. Thank you!
We don’t really have any examples that demonstrate use of ring buffers in a DSP callback. There are plenty of examples online though- I would recommend taking a look at Will Pirkle’s FXObjects library, which has an understandable and efficient circular buffer implementation in fxobjects.h (CircularBuffer
), along with several simple DSP effects that use it (SimpleDelay
,ImpulseConvolver
).
You could potentially leverage the FMOD Delay, but that won’t give you access to an arbitrary point in the delay line, which you will likely need for granular effects.
The 256 sample ramp comes in whenever the gain parameter changes. It linearly interpolates between the old gain value and the new value to create a smooth transition without any clicks or pops. After the 256 samples, the ramp isn’t applied again until the gain parameter again changes state. This is a pattern that you will want to apply to most parameter changes in your plugin to ensure no discontinuities in your signal.
You can get an intuition for what it’s doing by setting FMOD_GAIN_RAMPCOUNT
to 0 and listening to what happens when making large changes to the gain value.
Thank you Jeff!! Your support is super appreciated . I’ll definitely look into the Pirkle effects. Something else I noticed, some of the examples do not build into usable plugins, is this because they are more like DSP nodes to use within a read function than a standalone plugin, or am I missing something? I say this because initially I was going to use the dsp_custom to start with, but it doesn’t build into a studio plugin. Any advice on this as well would be awesome. I will likely be back with more questions on this project, since I am real new to FMOD. Thanks again
update!! I was able to write a simple echo plugin with the pirkle circular buffer, now its time to do granular stuff with it. thanks :3
The dsp_custom example is an executable application that demonstrates how to create and use a static plugin (a plugin existing entirely as code), whereas the other plugin examples are to show how to build a plugin as a dynamic library (an external file with exported methods).