Hello, I’ll try be as detailed as possible. This is a v1.2 Rev 7 Daisy Seed 65MB.
It’s set into a Terrarium pedal PCB. I’m really wanting to get this working so any expertise on this would be greatly appreciated.
I’ve tried other example projects (built for the Terrarium), but same issue.
Checks
Blink example
Able to control switches/LEDs
Output Oscillator as audio
Glow LED on input (as a float above a threshold)
Here’s the code, I have audio files for reference but i can’t upload them here as a new user, so please find them on Google Drive (sorry!)
Please listen to these audio examples as they might give you clues
Note : The “banging on guitar” has been normalised, when recording, it was basically no signal at all
Also, note that the oscillator is also probably broken, as this is NOT an A note even though it’s 440hz
https://drive.google.com/drive/folders/1hqY_TT27TKOOEZtGciOPSVlDvUnum0ex?usp=sharing
#include "daisy_petal.h"
#include "daisysp.h"
#include "terrarium.h"
#include <cmath>
using namespace daisy;
using namespace daisysp;
using namespace terrarium;
DaisyPetal hw;
dsy_gpio led1;
Oscillator osc;
void AudioCallback(AudioHandle::InputBuffer in, AudioHandle::OutputBuffer out, size_t size)
{
hw.ProcessAllControls();
float threshold = 0.01f;
for(size_t i = 0; i < size; i++) {
out[0][i] = osc.Process();
if (std::abs(in[0][i]) > threshold) {
dsy_gpio_write(&led1, true);
} else {
dsy_gpio_write(&led1, false);
}
}
}
int main(void)
{
hw.Init();
hw.SetAudioBlockSize(4); // number of samples handled per callback
hw.SetAudioSampleRate(SaiHandle::Config::SampleRate::SAI_48KHZ);
hw.StartAdc();
hw.StartAudio(AudioCallback);
led1.pin = hw.seed.GetPin(22);
led1.mode = DSY_GPIO_MODE_OUTPUT_PP;
led1.pull = DSY_GPIO_NOPULL;
dsy_gpio_init(&led1);
osc.Init(hw.AudioSampleRate());
osc.SetWaveform(osc.WAVE_SIN);
osc.SetAmp(1.0f);
osc.SetFreq(440.0f); // A4 note
while(1) {}
}