As for the software side of things, you can either decide to rescale your signal so that it is between 0 and 1, e.g.:
void render(BelaContext* context, void* userData)
{
...
float out = sinf(phase);
out = (out+1)*0.5f; // shift and scale the signal from -1:1 to 0:1
analogWriteOnce(context, frame, channel, out);
}
alternatively, you can enable in software the audio expander capelet on the desired channel (see the options in the IDE here), at which point you can write signals between -1 and 1 to the analog output, e.g.:
void render(BelaContext* context, void* userData)
{
...
float out = sinf(phase);
analogWriteOnce(context, frame, channel, out); // write the signal scaled between -1:1
}
alternatively, you can enable in software the audio expander capelet on the desired channel (see the options in the IDE here), at which point you can write signals between -1 and 1 to the analog output, e.g.: