Content-Length: 233105 | pFad | http://github.com/adafruit/circuitpython/issues/10203

F8 audiofilters.Filter fails when assign 'filter' property · Issue #10203 · adafruit/circuitpython · GitHub
Skip to content
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

audiofilters.Filter fails when assign 'filter' property #10203

Closed
todbot opened this issue Mar 30, 2025 · 2 comments
Closed

audiofilters.Filter fails when assign 'filter' property #10203

todbot opened this issue Mar 30, 2025 · 2 comments

Comments

@todbot
Copy link

todbot commented Mar 30, 2025

CircuitPython version and board name

Adafruit CircuitPython 9.2.6 on 2025-03-23; Raspberry Pi Pico 2 with rp2350a

Code/REPL

import time, board, audiobusio, synthio, audiofilters

audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22)
synth = synthio.Synthesizer(channel_count=1, sample_rate=44100)
effect = audiofilters.Filter(buffer_size=1024, channel_count=1, sample_rate=44100, mix=1.0)
effect.filter = synth.low_pass_filter(frequency=2000, Q=1.25)
effect.play(synth)
audio.play(effect)

note = synthio.Note(261)
while True:
    synth.press(note)
    time.sleep(0.25)
    synth.release(note)
    time.sleep(5)

Behavior

Traceback (most recent call last):
  File "code.py", line 10, in <module>
TypeError: object in filter must be of type AnyBiquad, not float

Description

The above code is from the demo code in documentation for audiofillters.Filter https://docs.circuitpython.org/en/latest/shared-bindings/audiofilters/index.html#audiofilters.Filter

It fails with the same error if you try to use the newer BlockBiquad, e.g.:

effect.filter = synthio.BlockBiquad(synthio.FilterMode.LOW_PASS, frequency=2000, Q=1.25)

Additional information

No response

@todbot todbot added the bug label Mar 30, 2025
@tannewt tannewt added this to the Long term milestone Mar 31, 2025
@todbot
Copy link
Author

todbot commented Apr 4, 2025

Fixed by (I think) commit 05a50b8. Thanks @relic-se!

@todbot todbot closed this as completed Apr 4, 2025
@relic-se
Copy link

relic-se commented Apr 4, 2025

@todbot Tested this on my end with the new PR, and it works without error. The only other change is that in 10.x, you'll need to use synthio.Biquad instead of synthio.BlockBiquad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/adafruit/circuitpython/issues/10203

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy