I am currently using two analog input and one audio out each sampled at 44.1kHz. I want to use filter high pass cutoff frequency 500 Hz and low pass cut off frequency 2000Hz. I used a single Biquad filter for all and I am getting erroneous results. Should I use three different filters with each having same cutoff frequencies for each channel?
Filtering of signal
You need to use one filter per each channel.
Thank you. Big help.
Another question the sampling of Bela changes abnormally after I tried to introduce down sampling ( like sampling one for each 8 samples). All the analog and audio sampling for current case is 44.1kHz. When I log them to scope the sampling from the time interval is observed to be multiples of 44.1kHz i.e. 3 times, 12 times. I have attached the outline of my code below for the render part.
` void render(BelaContext *context, void *userData) {
for (unsigned int n = 0; n < context->audioFrames; n++) {
// Analog read from channel 0 and 1
. . .
. . .
// Apply filters
. . .
. . .
// Initialize some variables
. . .
. . .
// Down sampling
if (n % m == 0) {
// m is the downsampling index which actually controls how much actual sample to be skipped
// Do all necessary things
. . . . .
. . . . .
}
// Audio write with filtering
. . . .
// Scope values out
. . . . . .
}}`
Here you can see the sampling is 3 times 44.1kHz. ### Current audio frame size is 256 and m=16.
A couple of things so far:
- if
m
is not a submultiple ofcontext->audioFrames
, then you should have a global (orstatic
within render) variable that gets incremented at each frame and which you then use to checkcount % m == 0
. - the durations showed in the scope window depends on the sampling rate specified in the
scope.setup()
call. E.g.: if you are sending to the scope once everym
audio samples, then you should havescope.setup(..., context->audioSampleRate / m, );
ACMLKgp I have attached the outline of my code below for the render part.
You have attached a lot of comments, hard to see what's going on there. If the problem persists, can you post a minimal example that shows the actual lines you are running? A