-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using LyraT to sample input, IIR functions to process, then output. The dsps_biquad_gen_xxx_f32 function creates garbage coefficients, I can't validate dsps_biquad_f32 as working. (DSP-111) #73
Comments
I should have spent a little more time investigating before putting this post up. Reducing the change in frequency to 0.001 i have been able to hear the filter working somewhat correctly as i go from f=0.5 and up. It starts off with okay values (still a lot of distortion)
And as it increases, the values become greater and greater creating a decimation effect
These values continue to climb before i start seeing nan values. |
Hi @mrSilkie , Thank you for the feedback. I've planed to release the demo application this week with LyraT board and processing audio. There will be just playing samples with volume/bass/treble. Thank you, |
I got it working, I wasn't converting the int buffer to a float and back correctly. Now that I've got it working all I can say is that it sounds like trash. A lot of digital distortion. It's getting tricky to debug the Lyra-T as SD card and Aux in both interfere with JTAG. I'll probably have to code in a file or oscillator to atleast have some test data for verification. I have been using my button to sweep Q's and filter frequencies. Is the Q in log 10? so values 0.001 and 100 are both valid in some sense? Anyway, here is my code so far.
|
I'm working on this project for my Uni DSP course. I have the option of doing it in matlab or python, but we all know ESP32 + audio input / output is far more fun!
I am finding that the code is pretty undocumented. There should be different dsps_biquad_f32 functions for different types of filters but I will assume that it is correct for the coefficients generated (they are a function pair after all). Since I am working with a DAC and ADC, I have to convert int to float before processing, this is another consideration. Another consideration is that the ADC/DAC buffers are populated using [L,R,L,R,L,R] so i have my IIR function that takes the odd values of the ADC buffer, and creates a half length array that is then processed before converting the float array back into ints in the odd n positions of the DAC buffer. It operated again for the opposing channel. Since I have made some modifications and this is a 'practical application' of this project, I think there is a lot of value in this post for future readers.
The function that performs the IIR maths on the float array is
I modified show_iir into the following that is now stereo compatible.
My main loop
Looking at the code, I assume that the coefficient generator is working from values 0-1, with 1 being the cutoff frequency equal to that of the sampling frequency. If so, does that mean only values 0 to 0.5 are valid since we are sampling at twice the maximum frequency?
I have found that I have no effect regardless of LPF or HPF coefficients being desired, the audio is silent up till the 60-70s where coefficient 4 starts to increase and continues to increase. I go from silence, to crackling, to a very loud and distorted output. True for both LPF and HPF.
My next plan of attack is to figure out what coefficients to use and hard code them in just so I can validate the IRR math funtion because I am not sure if it is my stereo->mono->float and float->int process is the problem, or if there are implementation problems within my code. Has anybody else had some success and is able to provide a bit more information on how to use this library?
The text was updated successfully, but these errors were encountered: