Skip to content

Synthio has fixed point overflow errors #10286

Open
@gamblor21

Description

@gamblor21

Synthio has one (and likely more) spots where it is possible to overflow the int32_t used as an intermediary while doing fixed point math.

This function multiplies an int32_t by int16_t which can exceed the 32 bit size.

static void sum_with_loudness(int32_t *out_buffer32, int32_t *tmp_buffer32, int16_t loudness[2], size_t dur, int synth_chan) {

There are likely other cases as well.

The probable fix is to add a function to ensure the values are saturated after every calculation.
audiofreeverb does this

static int16_t sat16(int32_t n, int rshift) {

This issue is most likely the cause for #10200.

Metadata

Metadata

Assignees

Labels

audiobugrp2Both RP2 microcontrollers

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions