Tips on How to Manage Sample Rate Changes?

Hello, I’m working on my first module for VCV Rack. It’s a reverb module based on some code I put together for the STM32 earlier this year.

I originally designed it to run at a 48k sample rate, but now I want to update it to run at higher or lower rates. I typically utilize the sample rate or period to increment LFOs and calculate delay times.

I’m sure I could constantly poll something like args.sampleTime but I’m wondering if there is another approach? When the user changes the sample rate, is some sort of event generated where modules can update parameters?

I’ve also seen the use of the dsp::SampleRateConverter class in some modules on git but I don’t think I want to use that, since I actually want the module to run at a higher/lower rate, not the original rate.

1 Like

@Squinky Can you help here?

Module has onSampleRateChange(const SampleRateChangeEvent& e)

4 Likes

Yes, the count is correct. Of course polling args.sampleTime isn’t the worst thing in the world, but onSampleRateChange is the thing.

2 Likes