Skip to content

synthio.Envelope properties cannot be modified after creation #10902

@kevinjwalters

Description

@kevinjwalters

CircuitPython version and board name

Adafruit CircuitPython 10.1.4 on 2026-03-09; Raspberry Pi Pico W with rp2040

Code/REPL

Adafruit CircuitPython 10.1.4 on 2026-03-09; Raspberry Pi Pico W with rp2040
>>>
>>>
>>> import synthio
>>> test_env1 = synthio.Envelope(release_time=1.0)
>>> test_env1.release_time
1.0
>>> test_env1.release_time = 2.0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: can't set attribute

>>> test_env2 = synthio.Envelope(release_time=synthio.Math(synthio.MathOperation.ABS, 1.0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: release_time must be of type float, not Math

Behavior

The properties are read only and cannot be changed. Using synthio.Math as a variable can't be used as a workaround.

Description

The envelope cannot be modified after it's been created. I mentioned this a while ago in a forum post but never tested it til now. This would include the case when the envelope is being actively used as an amplitude envelope for a synthio.Note. One case where this would be useful is changing the release time (based on a MIDI CC 72 message) while a note is being played and typically before the key is released.

If the properties are mutable then a decision would be needed on whether they affect a note in that phase, e.g. attack_level is changed during the attack phase. If the behaviour is documented I'm fine either way.

Additional information

@todbot and @relic-se may be interested in this or know of a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions