giuliomoro wow thx! it works great! upwards of 18Khz per adc at a lower CPU usage
Since I have a workable sample rate, I'm now trying to send each of the 16 samples of the buffer (rather than average them into 1 value as before). The issue is that every other sample in the buffer seems to be empty.
This is my PD output:
print: 20 165 0 0 246 164 0 0 11 165 0 0 250 164 0 0 5 165 0 0 19 165 0 0 3 165 0 0 16 165 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 209 164 0 0 212 164 0 0 198 164 0 0 217 164 0 0 221 164 0 0 232 164 0 0 205 164 0 0 223 164 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 213 163 0 0 197 163 0 0 197 163 0 0 206 163 0 0 221 163 0 0 201 163 0 0 219 163 0 0 227 163 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 119 164 0 0 92 164 0 0 53 164 0 0 67 164 0 0 92 164 0 0 99 164 0 0 122 164 0 0 147 164 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 194 36 0 0 233 36 0 0 17 37 0 0 67 37 0 0 44 37 0 0 122 37 0 0 217 37 0 0 31 38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 28 0 0 148 28 0 0 206 28 0 0 8 29 0 0 40 29 0 0 54 29 0 0 144 29 0 0 187 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 96 9 0 0 174 9 0 0 213 9 0 0 47 10 0 0 133 10 0 0 191 10 0 0 142 10 0 0 239 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 67 4 0 0 189 4 0 0 164 4 0 0 45 5 0 0 126 5 0 0 181 5 0 0 207 5 0 0 221 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
and this is my C++ code:
#include <Bela.h>
#include <libraries/Pipe/Pipe.h>
#include <libraries/Serial/Serial.h>
#include <cmath>
#include <iostream>
#include <string>
#include <libraries/UdpClient/UdpClient.h>
float input; //from Bela->context
int array[8][16]; //eight ADC x 16 samples
UdpClient udpClient(4567, "192.168.7.1");
Serial gSerial;
Pipe gPipe;
AuxiliaryTask serialCommsTask;
void ioLoop(void* arg) {
while(!Bela_stopRequested())
{
udpClient.send(array, sizeof(array));
//usleep(1000);
}
}
bool setup(BelaContext *context, void *userData) {
gSerial.setup ("/dev/ttyGS0", 230400);
AuxiliaryTask serialCommsTask = Bela_createAuxiliaryTask(ioLoop, 0, "serial-thread", NULL);
Bela_scheduleAuxiliaryTask(serialCommsTask);
gPipe.setup("serialpipe", 1024);
return true;
}
void render(BelaContext *context, void *userData)
{
//READ FRAME BY FRAME OF THE BUFFER
for(unsigned int n = 0; n < context->audioFrames; n++) {
for(unsigned int ar = 0; ar < 8; ar++) {
input = analogRead(context, n, ar); //read from ADC/context
array[ar][n] = trunc(input*100000); //convert to int
}
}
}
void cleanup(BelaContext *context, void *userData) {}
any ideas? thanks again