Commit graph

14 commits

Author SHA1 Message Date
de9b0b6b1b
Merge pull request #9772 from relic-se/audiofilters_filterlist 2024-11-10 09:13:34 -06:00
dcooperdalrymple
c96d1428e1 Remove unnecessary m_malloc_fail and deinit from memory allocation routines. 2024-11-07 19:06:25 -06:00
dcooperdalrymple
5f8ec0afc6 Validate type of filter tuple items. 2024-11-07 13:58:01 -06:00
dcooperdalrymple
941e1228f2 Rename filters back to filter and support individual Biquad object and tuple of Biquad objects. 2024-11-07 13:03:59 -06:00
f8afdcb729 Add audiodelays & audioeffects to unix coverage port
.. and add a very basic audioeffects test, showing that it plausibly
is working

I had to address several build errors that occurred in the Unix build,
mostly related to conversion from FP types to integral types (replaced
by explicit casts) and by
accidental mixing of regular & f-suffixed floating constants (replaced
with the MICROPY_FLOAT_CONST macro)

Particularly this change could use consideration:
```diff
-    self->max_echo_buffer_len = self->sample_rate / 1000.0f * max_delay_ms * (self->channel_count * sizeof(uint16_t)); // bytes
+    self->max_echo_buffer_len = (uint32_t)(self->sample_rate / 1000.0f * max_delay_ms) * (self->channel_count * sizeof(uint16_t)); // bytes
```

The buffer length is being calculated in floating point based on the
millisecond delay & the sample rate. The result could then be a fractional
number such as 529.2 for a 12ms delay at 44.1kHz. Multiplying a floating
number by the size required for each echo buffer item
(`(self->channel_count * sizeof(uint16_t))`) could yield a number of bytes
that doesn't correspond to an integral number of buffer items. I grouped
the float->int conversion so that it converts the number of echo buffer
items to an integer and then multiplies by the size of the item.
2024-11-05 09:36:18 -06:00
dcooperdalrymple
14b1383b6b Remove trailing whitespace to fix pre-commit. 2024-11-05 08:47:24 -06:00
dcooperdalrymple
0aab00d7e5 Fix 16-bit unsigned integer silence within audio effects. 2024-11-05 08:41:23 -06:00
dcooperdalrymple
63c3e394d3 Fix error with NULL sample handling in audiofilters.Filter. 2024-11-03 18:30:19 -06:00
dcooperdalrymple
6badb92de8 Add support for list of Biquad objects within audiofilters.Filter. 2024-10-29 12:52:27 -05:00
dcooperdalrymple
c7e87cfae3 Remove unnecessary double buffer on filter_buffer. 2024-10-22 21:33:28 -05:00
dcooperdalrymple
e7c02bd561 Biquad filter processing. 2024-10-22 12:09:28 -05:00
dcooperdalrymple
db540c67ec Avoid processing sample if filter is None. 2024-10-22 12:09:07 -05:00
dcooperdalrymple
1bf400d2dd Rename biquad property to filter. 2024-10-22 12:08:33 -05:00
Cooper Dalrymple
5246053563 Initial structure for biquad filter effect. 2024-10-22 09:17:58 -05:00