Skip to content

Inline synthio_sat16 and use ssat - #11621

Merged
dhalbert merged 1 commit into
adafruit:mainfrom
MakerClassCZ:synthio-sat16-inline
Oct 19, 2026
Merged

dhalbert merged 1 commit into
adafruit:mainfrom
MakerClassCZ:synthio-sat16-inline

Conversation

@lynt-smitka

Copy link
Copy Markdown

synthio_sat16 runs at least once per sample in synthio, the biquad filter, Freeverb, Phaser and Flanger. It was a normal function in another file, so every call cost more than the work it did. It is now inline, rounds without a branch, and uses the ssat instruction on cores that have it.

Time per 1024-sample buffer on Fruit Jam (RP2350):

Effect Before After
Freeverb 7088 µs ~4200 µs
Phaser 4599 µs 2002 µs
Synth, 4 notes with biquad 613 µs 502 µs

On the PicoPad (RP2040), the synth with biquad is 4% faster. The output is the same, bit for bit. Flash is 96 bytes smaller on RP2350 and 8 bytes smaller on RP2040.

Tested on Fruit Jam and PicoPad by reading the output with audiocore.get_buffer(). The code was written with AI help.

It runs once or more per sample in synthio, the biquad filter and the audio effects, so the call cost more than the saturation. Rounding without a branch and using ssat where the core has it keeps the inlined copies small.

@dhalbert dhalbert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! Will be merged assuming the job that failed succeeds on a second run.

@dhalbert
dhalbert enabled auto-merge October 18, 2026 23:30
@dhalbert
dhalbert merged commit 159e636 into adafruit:main Oct 19, 2026
1058 of 1060 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.

2 participants