Using ICS-43434 #13
-
I'm trying to use the library with an ICS-43434 but I'm getting I'm attempting to apply the filter shown in Ivans repo here https://github.com/ikostoski/esp32-i2s-slm/blob/b643efa1beae51b84d4ad9b2bfa35d439c81e9b6/esp32-i2s-slm.ino#L122-L132 This is the config I've created
Am I just misunderstanding how to specify the filter in yaml? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, first I'd ensure you're not getting nans without filter. If it works without filter, then you have to convert transfer function coefficients to SOS form (a chain of biquad or 2nd order filters). Note, that those coefficients from comments are not SOS, those are numerator (B) and denominator (A) coefficients of transfer function (4th order in this case). // TDK/InvenSense ICS-43434
// Datasheet: https://www.invensense.com/wp-content/uploads/2016/02/DS-000069-ICS-43434-v1.1.pdf
// B = [0.477326418836803, -0.486486982406126, -0.336455844522277, 0.234624646917202, 0.111023257388606];
// A = [1.0, -1.93073383849136326, 0.86519456089576796, 0.06442838283825100, 0.00111249298800616]; To convert them to SOS you have to use from scipy.signal import tf2sos
from numpy import set_printoptions
B = [0.477326418836803, -0.486486982406126, -0.336455844522277, 0.234624646917202, 0.111023257388606]
A = [1.0, -1.93073383849136326, 0.86519456089576796, 0.06442838283825100, 0.00111249298800616]
sos = tf2sos(B, A).astype('float32')
set_printoptions(suppress=True)
print(sos[:, [0, 1, 2, 4, 5]]) Output:
Then yaml config should be: groups:
- filters:
- type: sos
coeffs:
# ICS-43434:
# b0 b1 b2 a1 a2
- [ 0.47732642, 0.46294358, 0.11224797, 0.06681948, 0.00111522]
- [ 1., -1.9890593, 0.98908925, -1.9975533, 0.99755484] |
Beta Was this translation helpful? Give feedback.
Hi, first I'd ensure you're not getting nans without filter.
If it works without filter, then you have to convert transfer function coefficients to SOS form (a chain of biquad or 2nd order filters). Note, that those coefficients from comments are not SOS, those are numerator (B) and denominator (A) coefficients of transfer function (4th order in this case).
To conv…