Hello,
I will take the sound from microphone and give directly to the speakers.
#include <Bela.h>
#include <algorithm>
#include <libraries/Scope/Scope.h>
int gAudioChannelNum; // number of audio channels to iterate over
int gAnalogChannelNum; // number of analog channels to iterate over
// instantiate the scope
Scope scope;
bool setup(BelaContext *context, void *userData)
{
// Check that we have the same number of inputs and outputs.
if(context->audioInChannels != context->audioOutChannels ||
context->analogInChannels != context-> analogOutChannels){
printf("Different number of outputs and inputs available. Working with what we have.\n");
}
// If the amout of audio and analog input and output channels is not the same
// we will use the minimum between input and output
gAudioChannelNum = std::min(context->audioInChannels, context->audioOutChannels);
// tell the scope how many channels and the sample rate
scope.setup(8, context->audioSampleRate);
return true;
}
void render(BelaContext *context, void *userData)
{
for (unsigned int n = 0; n < context->audioFrames; n++) {
float in = audioRead(context, n , 4); // only read channel 4
scope.log(in);
for (unsigned int channel = 0; channel < context->audioOutChannels; channel++) {
audioWrite(context, n, 8, in); // write the same signal to all output channels
}
}
}
void cleanup(BelaContext *context, void *userData)
{
}
When I open the scope i see nothing, only a straight line. And i can hear no sound on the speakers.
Now i am not sure if it is a hardware or saftware problem.
As microphone i used a normal headset with an included microphone. Thanks in advance.
