Access DACs using DaisyDuino

Greetings everyone, I am playing around with the seed using DaisyDuino and want to output audio on the DACs instead of the audio outputs. The only example I found donig this is the Lfo code for Patch but I cannot figure out how to apply this to other codes.

I understand that “DaisyHardware patch;” has to be initialized in order to get access to PIN_PATCH_CV_1 and PIN_PATCH_CV_2 (on pin 29 and 30) but I don’t know how send the signal there instead of “out[chn][i] = sig;” for example.

Could anyone help me out with this and explain how to initialize and use the DACs as an output?

Thank you in advance!

Hi, did you try something like analogWrite(29,value);

Hi @cebersp, yes I tried it that way but no success…

Oh, I see, Daisy’s compatibility is incomplete.
There is an example “CV_Output.ino” in Patch SM examples. I would try from there.

Welcome @leheltorok!

The Daisy Patch’s Sequencer example shows an example of using the analogWrite function to write to the DACs from the audio callback.
The default range of the analogWrite is 0 to 255 and the audio float range is -1 to +1, so we can map like this:

for(int i = 0; i < size; i++)
{
  analogWrite(PIN_PATCH_CV_1, in[0][i] * 128 + 128);
  analogWrite(PIN_PATCH_CV_2, in[1][i] * 128 + 128);
}

However, the DACs are designed to output CV at control rate, so they are DC coupled. And I’m not sure how well they’ll actually keep up with audio rate data, so this probably won’t work perfectly. Although, it might be serviceable for some use cases!

Also, the DAC outputs have a range of 0-5V, so the “audio” they output will actually be unipolar. Eurorack audio is usually bipolar +/-5V.

If you use DACs that way in the callback, they won’t be clocked correctly for audio.

I’m sorry I missed this, but yes, you are right.

The point isn’t ’keeping up’ with audio rate. Even if each analogWrite is fast enough, the spacing between the analogWrite calls will not match the sample rate.