Hi All,
I am very new to audio processing (current setup is PlatformIO, Arduino framework).
I am currently trying to add a bitcrush effect to my input signal. I have run the bitcrush example and hear the crushed signal on the oscillator but am having trouble converting that to crush my input signal instead of the osc.
With the code below I am not getting any sound on the output line.
Any help would be greatly appreciated! Thank you!
Setup:
bitcrush is a private member of the class
void BitCrush::Setup(size_t pNumChannels)
{
numChannels = pNumChannels;
depth = 1;
float sampleRate = DAISY.get_samplerate();
bitcrush.Init(sampleRate);
//set parameters for bitcrusher
bitcrush.SetBitDepth(6);
bitcrush.SetCrushRate(10000);
}
Callback:
audioInChannel and audioOutChannel are constants in the class, I have verified that I can bypass the input signal to the output signal with these channels. The error comes when I add the bitcrush.Process()
void BitCrush::AudioCallback(float **in, float **out, size_t size)
{
float sig;
for (size_t i = 0; i < size; i++)
{
sig = in[audioInChannel][i];
sig = bitcrush.Process(sig);
out[audioOutChannel][i] = sig;
}
}
My entire codebase is a little complex because I’m using an interface to allow me to swap between multiple effects (https://github.com/samiam21/DaisyLead). Everything in main.cpp is working as expected (I’ve used it successfully in a different repo to create a delay effect). This code lives in lib/BitCrush/