Frequencies higher than 22000 Hz in 96 kHz sample rate?

Hi, this is my first post - I’ve looked for some hints on the subject on the forum, but haven’t found much, so I’m starting a new topic (hopefully not redundant).

I’m doing some experiments with tape recording and it came out that Daisy Seed is perfect for mixing the audio from a microphone with a high frequency sinusoid used as a bias oscillator. It basically works, BUT the bias osc should be well above the hearing range (something along the lines of 40kHz at least). It came out that - even when the Daisy sample rate is declared in the code as 96 kHz - the highest possile sinusoid frequency I’ve been able to get is 22000 Hz (at least that’s what my oscilloscope says). What I mean by that is: when I try to increase the value in Arduino code above the aforementioned 22 kHz, the frequency doesn’t get any higher (in 96 kHz it has to be doubled, i.e. 44000 Hz gives 22000 Hz output).

Is it at all possible to have a higher than 22 kHz sinusoid oscillator on a Dasiy Seed?


I believe that the Daisy (seed-patch-pod-field-etc) is capable of generating-driving out the DAC somewhere close to the ‘nyquist’ frequency - with a 96 KHz (just K from now on) sampling rate say 48 K and maybe bump it down a bit for margin-slop. So you should be able to do 40 K, but there may be limitations in software you’re using. I know very little about Arduino. I think PureData in one of its incarnations (plugdata, pd2dsy) or Max-MSP is capable of it. I’m almost certain you could do it with DaisySP and C++ or whatever your favorite language is to call it from.

Keep in mind that I’m just giving you my thoughts without checking, I’m no expert and don’t work for Electro-Smith. They may have a better answer.

My guess - the samplerate isn’t being set correctly.

EDIT: hmmm, I just tried this with Arduino. Yes, there’s something weird when setting non-default sample rate. And the DSP stuff in DaisyDuino is not the same as DaisySP for C++.
I’d suggest trying to use C++.

1 Like

This ought to set the sample rate to 96 kHz and then produce a (very loud!) tone at Nyquist.

#include <string.h>
#include "daisy_seed.h"

using namespace daisy;

DaisySeed hw;

float phase = 1;
static void Callback(AudioHandle::InterleavingInputBuffer  in,
                     AudioHandle::InterleavingOutputBuffer out,
                     size_t                                size)
    for (size_t i = 0; i < size; i += 2)
        out[i] = out[i + 1] = phase;
        phase *= -1;

int main(void)
    while(1) {}
1 Like

Ha! I like the “very loud!” description, and I think I know what you mean - there’s a good chance you would regret using headphones-earbuds because the Daisy Seed will try to be as loud as it can be. But really, it will only be as loud as the volume is set to on whatever you have after the Seed, hopefully driving your speakers…

Thanks everyone for all your hints! @alo.bu I’ll try out your solution.

It will be tricky to find an amp that would amplify such high frequency sound, but that’s yet another story…

The OP is referring to sinusoid wave on Arduino.