Control of Channels with Stereo Output on the Seed [Solved]

Hello all,

I am new to the Daisy universe and this forum, but am very excited to be part of both!

I have run into an a simple issue I can’t find a direct answer for, and I feel like I’m missing something.

In the audio callback function I get a compile time syntax error when I try to use two dimensional array syntax for stereo control of the channels. I have noticed that by default, as demonstrated by the bypass example, the channels are interleaved stereo. But in the Chorus example, the 2d [] syntax is used- output[0][i] and output[1][i] for L/R respectively. When I implement this syntax into the byass example to attempt to make it multichannel I get this error:

bypass.cpp:19:15: error: invalid types ‘float[size_t {aka unsigned int}]’ for array subscript
19 | out[0]**[**i] = chorus.GetLeft();

To put it in one sentence- How do I write different audio signals to the Seed’s L/R outputs in C++ in the Callback();

Thought this would be a good question to ask as I did not see it answered on the forum.



Relevant code snippet:

#include <string.h>
#include “daisy_seed.h”
#include “daisysp.h”

using namespace daisy;
using namespace daisysp;

DaisySeed seed;

Chorus chorus;

static void Callback(float *in, float *out, size_t size)
for (size_t i = 0; i < size; i++)
float sig = in[i];

    out[0][i] = chorus.GetLeft();
    out[1][i] = chorus.GetRight();


Chorus is initialized like it is in the example. It works great in this program when it is only outputting one channel: out[i] = chorus.GetLeft();

Thanks again!

You need to change the arguments to use 2d arrays.

AudioCallback(float** in, float** out, size_t size)

(Technically these are double pointers.)


Ah yes there it is.

Thanks for the reply, much appreciated!


1 Like