Set new sample rate?

Hey :slight_smile:

I am playing around with some of the examples. Right now the Daisy Seed “Osc” example.

I would like to change the sample rate and not 100% sure that what I am thinking about doing is correct.

In the Osc example I see:

//How many samples we'll output per second
float samplerate = hardware.AudioSampleRate();

Is it as simple as just doing this instead?
float samplerate = 48000;

But I am thinking that won’t change the hardware sample rate?

I would have to set the sample rate somewhere else, right, where that hardware.AudioSampleRate() calls from?

Any tips appreciated :wink:

Correct, that will not change the sample rate.


Yes that was what I kind of thought.

I checked the daisy_board.h and found these:
struct AudioData
// Needs to be tweaked in Clock settings to be exact.
float sample_rate = 48014.0f;
size_t block_size = 48;
float callback_rate = sample_rate / block_size;
size_t num_channels = 2;
float sr_recip = 1.0f / sample_rate;

It seems that it could be the right place :slight_smile:

So I guess next is to find out where the clock settings are located :slight_smile:

Without seeing anything else, my eye is drawn to the unusual 48014. Weird numbers usually indicate a deeper complexity worth understanding.

Yes I though that number was a bit odd too. But it refers to the “clock settings” for tweaking, which I am trying to locate atm.

Or maybe that:
“// Needs to be tweaked in Clock settings to be exact.”

Is just a personal note for the developer, to remind that the clock still needs a bit of tweaking?

Clocks in computers tend to be expressed in ratios applied to actual crystal frequencies, and so funny numbers are sometimes needed to achieve specific rates.

1 Like

Yeah I wanted to try 96000 and see how much it can be pushed.

Would love to hear what other people set the samplerate to for 96k :slight_smile:

The original implementation of the audio portion of the library had a fixed sample rate, but it is entirely possible to change.

We should have a patch in the next week or so that allows for setting other standard samplerates (32k, 48k, 96k), and there are plans for a future update where sample rate can be set to pretty much any frequency between 8kHz and 96kHz with decent accuracy.


I had read that the sample rate was to be 192k, is this not true? My plans for the daisy was to make a high end mastering quality adc dac with multiple functionality of metering and display of sample rates.
Am I barking up the wrong tree?
I’m fine with turning the daisy into a reverb pedal but I’d like to know if I should continue working on making it a mastering adc dac?

@omniaarts The Codec can do 192k so technically you should be able to get it to work, even if libdaisy / DaisySP doesn’t support it (yet.)

You would need different algorhythms anyways so DaisySP wouldn’t be so helpful in your context.

1 Like

Has this been implemented yet?


Hello @Jaffasplaffa , nice to see you here.

I’m switching to the Daisy as an alternative to the Axoloti… but i had some Axoloti projects to finish before experimenting with my 5 Daisy seeds. I chose to use the Arduino IDE.

As far as I browsed the libraries it is still not possible to change the effective (hardware) sample rate ?

Hey @SmashedTransistors

Thanks, you too :slight_smile:

Though Daisy is a bit harder for me than Axoloti is, I really like the Daisy too.

As far as I know I think in the near future some more options will be available, better script, etc… I think I saw somewhere in here, that an easier way to set sample rate is one of the options. I did search the code, but never really found out how to do it.

These things are a bit over my level, so I am waiting patiently to see what the future brings. Waiting eagerly for the script and some examples of how to set up inputs for Daisy Seeds :slight_smile:

@SmashedTransistors unfortunately the audio code is still lagging a bit behind libdaisy.

I’ll try to carve out some time soon to at least get the audio updated. As the c++ library now supports multiple samplerates.


In the meantime,
for my personal experiments,
i can implement my code as if it was 96000 sample rate and port/use the /2 downsampler i have already coded for the Axoloti (O2_to_SR_59 59 tap 1/2 downsampler) .

I found some time to experiment and implement the 59 tap decimator.

Here are the results for a sine sweeping from 9KHz to 48KHz.

  1. without Dec59 connected to the PC
  • aliasing (freq folding) when the sine goes above 48KHz
  • background noise caused by the PC
  1. with Dec59 still connected to the PC
  • the aliasing is mostly suppressed
  • the background noise is still there
  1. with Dec59 and powerbank powered

The remaining artefacts are sidelobes infered by the pitch sweep and maybe some artefacts related to the EIEpro.


  #ifndef TIAR_DEC59_H
    #define TIAR_DEC59_H

    namespace tiar
    /**           /2 decimator  */
    class Dec59
        Dec59() {}
        ~Dec59() {}
    	void init();
        float proc(float x1,float x0);

      float R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, 
    R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R30;


    } // namespace tiar



#include "dec59.h"

using namespace tiar;

void Dec59::init(){

float Dec59::proc(float x1, float x0){
  float h1x1  = x1*0.3167967114236291f;     float h3x1  = x1*-0.10164126581474016f;
  float h5x1  = x1*0.056472878314649574f;   float h7x1  = x1*-0.03590356425550024f;
  float h9x1  = x1*0.023854182328325296f;   float h11x1 = x1*-0.015966909428751137f;
  float h13x1 = x1*0.010553528578562761f;   float h15x1 = x1*-0.006794829937625732f; 
  float h17x1 = x1*0.004212042043030732f;   float h19x1 = x1*-0.002484841082005066f;
  float h21x1 = x1*0.0013753503068182293f;  float h23x1 = x1*-0.0007008749315804081f;
  float h25x1 = x1*0.00031898286827647583f; float h27x1 = x1*-0.00012279053509672562f;
  float h29x1 = x1*0.000035881628440564505f;

  R30 = R29 + h29x1;  R29 = R28 + h27x1;
  R28 = R27 + h25x1;  R27 = R26 + h23x1;  R26 = R25 + h21x1;
  R25 = R24 + h19x1;  R24 = R23 + h17x1;  R23 = R22 + h15x1;
  R22 = R21 + h13x1;  R21 = R20 + h11x1;  R20 = R19 +  h9x1;
  R19 = R18 +  h7x1;  R18 = R17 +  h5x1;  R17 = R16 +  h3x1;
  R16 = R15 +  h1x1;
  R15 = R14 + h1x1 + 0.50000063464071f * x0;
  R14 = R13 +  h3x1;  R13 = R12 +  h5x1;  R12 = R11 +  h7x1;
  R11 = R10 +  h9x1;  R10 = R9  + h11x1;  R9  = R8  + h13x1;  
  R8  = R7  + h15x1;  R7  = R6  + h17x1;  R6  = R5  + h19x1;
  R5  = R4  + h21x1;  R4  = R3  + h23x1;  R3  = R2  + h25x1;
  R2  = R1  + h27x1;  R1 = h29x1;
  return R30;


#include <Dec59.h>
#include "DaisyDuino.h"

using namespace tiar;
Dec59 dec;
DaisyHardware hw;
size_t num_channels;
Oscillator osc;

float f=440.0f;

void MyCallback(float **in, float **out, size_t size){

  // frequency sweep to test aliasing
  f *= 1.0005f;
  if(f > 48000.0f) f=440.0f;
  for (size_t i = 0; i < size; i++)  {
      out[0][i] = out[1][i] = dec.proc(osc.Process(), osc.Process());

     // osc.Process();
     // out[0][i] = out[1][i] = osc.Process();

void setup() {
  Serial.begin(); // no rate needed since this isn't really a UART
  float sample_rate;

  // BUT MODULES BELIEVE SO... and the Dec59
  // makes it right.
  hw = DAISY.init(DAISY_SEED, AUDIO_SR_96K);
  num_channels = hw.num_channels;
  sample_rate = DAISY.get_samplerate();

  // Initialize Oscillator, and set parameters.


void loop() {