untamedfrontier
Well-known member
They published a distortion example for the pedal a few weeks ago and I messed around with it a bit last night.
The good news: It passes signal! Both hard & soft clip appear to be working. All 3 knobs work as well.
The bad news:The LEDs aren't lighting up, and I know the LED section of the code is a mess.
edit: LEDs now both light up and stay permanently lit up, not changing with effect state of either soft/hard clip footswitch.
Any suggestions would be lovely
EDIT 2: Check PedalPCB response below for update.
The good news: It passes signal! Both hard & soft clip appear to be working. All 3 knobs work as well.
The bad news:
edit: LEDs now both light up and stay permanently lit up, not changing with effect state of either soft/hard clip footswitch.
Any suggestions would be lovely
EDIT 2: Check PedalPCB response below for update.
C++:
#include "daisysp.h"
#include "daisy_petal.h"
#include "terrarium.h"
using namespace daisysp;
using namespace daisy;
using namespace terrarium;
// Declare a local daisy_petal for hardware access
static DaisyPetal petal;
dsy_gpio led1;
dsy_gpio led2;
float hardClip(float in)
{
in = in > 1.f ? 1.f : in;
in = in < -1.f ? -1.f : in;
return in;
}
float softClip(float in)
{
if (in > 0)
return 1 - expf(-in);
return -1 + expf(in);
}
bool bypassHard, bypassSoft;
static void AudioCallback(float **in, float **out, size_t size)
{
petal.UpdateAnalogControls();
petal.DebounceControls();
float Pregain = petal.knob[Terrarium::KNOB_1].Process() * 10 + 1.2;
float Gain = petal.knob[Terrarium::KNOB_2].Process() * 100 + 1.2;
float drywet = petal.knob[Terrarium::KNOB_3].Process();
bypassSoft = petal.switches[Terrarium::FOOTSWITCH_1].RisingEdge() ? !bypassSoft : bypassSoft;
dsy_gpio_toggle(&led1);
bypassHard = petal.switches[Terrarium::FOOTSWITCH_2].RisingEdge() ? !bypassHard : bypassHard;
dsy_gpio_toggle(&led2);
for(size_t i = 0; i < size; i ++)
{
for (int chn = 0; chn < 2; chn++)
{
in[chn][i] *= Pregain;
float wet = in[chn][i];
if (!bypassSoft || !bypassHard){
wet *= Gain;
}
if (!bypassSoft)
{
wet = softClip(wet);
}
if (!bypassHard)
{
wet = hardClip(wet);
}
out[chn][i] = wet * drywet + in[chn][i] * (1 - drywet);
}
}
}
int main(void)
{
petal.Init();
bypassHard = bypassSoft = false;
// start callback
petal.StartAdc();
petal.StartAudio(AudioCallback);
while(1)
{
//LED stuff
petal.SetFootswitchLed((DaisyPetal::FootswitchLed)0, !bypassSoft);
led1.pin = petal.seed.GetPin(22);
led1.mode = DSY_GPIO_MODE_OUTPUT_PP;
led1.pull = DSY_GPIO_NOPULL;
dsy_gpio_init(&led1);
petal.SetFootswitchLed((DaisyPetal::FootswitchLed)1, !bypassHard);
led2.pin = petal.seed.GetPin(23);
led2.mode = DSY_GPIO_MODE_OUTPUT_PP;
led2.pull = DSY_GPIO_NOPULL;
dsy_gpio_init(&led2);
for (int i = 0; i < 8; i++)
/* Pretty sure I don't need this, since it's specific to the petal encoder
{
petal.SetRingLed((DaisyPetal::RingLed)i, 1.f, 0.f, 0.f);
}
*/
petal.UpdateLeds();
dsy_system_delay(6);
}
}
Last edited: