Skip to content

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

@todbot

Description

@todbot

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions