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

synthio: Calculate LFO.value at construction #9247

Merged
merged 1 commit into from
May 18, 2024

Conversation

jepler
Copy link
Member

@jepler jepler commented May 14, 2024

Originally, the only (non-debug) way to make an LFO calculate its value was to associate it with a playing synthesizer.

This posed a problem for LFOs that had "power on values" other than 0, and where the value was used other than to internally drive a note property.

Now, an initial, possibly non-zero value is calculated at object construction time:

>>> l = synthio.LFO(offset = 1)
>>> l.value
1.0

Note that this happens just once at construction; it does not happen when updating LFO properties:

# immediately following the above
>>> l.offset = 2
>>> l.value
1.0

ping @kevinjwalters

@jepler jepler changed the title synthion: Calculate LFO.value at construction synthio: Calculate LFO.value at construction May 14, 2024
Originally, the only (non-debug) way to make an LFO calculate its value
was to associate it with a playing synthesizer.

This posed a problem for LFOs that had "power on values" other than 0,
and where the value was used other than to internally drive a note
property.

Now, an initial, possibly non-zero value is calculated at object
construction time:

```py
>>> l = synthio.LFO(offset = 1)
>>> l.value
1.0
```

Note that this happens just once at construction; it does not happen when
updating LFO properties:
```py
>>> l.offset = 2
>>> l.value
1.0
```
@jepler jepler force-pushed the improve-lfo-initial-value branch from a0b55ec to 9e878f7 Compare May 14, 2024 23:28
Copy link
Member

@gamblor21 gamblor21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried on an UM FeatherS2, worked as expected.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and @gamblor21, thanks for testing!

@dhalbert dhalbert merged commit e0f745c into adafruit:main May 18, 2024
376 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants