Skip to content

Conversation

@earlephilhower
Copy link
Owner

By rendering into a 32b int we don't have to saturate check in the inner loop of the voice render, which is called multiple times per actual output block. That check is very expensive.

In tsf_render_short make the input short *buffer have 2x the space as normal to allow the full 32b quantity for each sample to accumulate. After all voices have been rendered, then resample with saturation into int16_t values.

About 24% faster on the Pico while still saturating properly.

By rendering into a 32b int we don't have to saturate check in the inner
loop of the voice render, which is called multiple times per actual output
block.  That check is very expensive.

In tsf_render_short make the input `short *buffer` have 2x the space as
normal to allow the full 32b quantity for each sample to accumulate.
After all voices have been rendered, then resample with saturation into
int16_t values.

About 24% faster on the Pico while still saturating properly.
@earlephilhower
Copy link
Owner Author

image

@earlephilhower earlephilhower merged commit 41b96ef into master Oct 23, 2025
22 checks passed
@earlephilhower earlephilhower deleted the turbo2 branch October 23, 2025 01:32
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