luk hen running the audio-expander example, the audioRead() data appeared to be noise, unless this is due to the change in range from -1 through 1 to 0 through 1 on the expander.
Maybe you didn't put the jumpers in place? Did you follow the instructions here ?
luk I also understand that we might not hear anything off the output lines through a pair of headphones since we do not have a preamp immediately available. So what are we not setting up right?
You should still hear something, though it will be a bit worse than with a proper headphone amplifier.
This code would work as a passthrough for the analog inputs. Additionally, it loops back the analog inputs 0 and 1 to audio outputs L and R. In order to run this you should enable the audio expander capelet in the IDE and tick all the boxes.
bool setup(BelaContext* context, void* userData)
{
return true;
}
void render(BelaContext* context, void* userData)
{
// loopback the analog channels
for(unsigned int n = 0; n < context->analogFrames; ++n)
{
for(unsigned int ch = 0; ch < context->analogOutChannels; ++ch)
{
analogWriteOnce(context, n, ch, analogRead(context, n, ch));
}
}
// additionally loopback analog inputs 0 and 1 to audio outputs L and R
for(unsigned int n = 0; n < context->audioFrames; ++n)
{
for(unsigned int ch = 0; ch < context->audioOutChannels; ++ch)
{
// the /2 below assumes the analogSampleRate is half the audioSampleRate
audioWrite(context, n, ch, analogRead(context, n / 2, ch));
}
}
}
void cleanup(BelaContext* context, void* userData){}