Skip to content

Conversation

@djtuBIG-MaliceX
Copy link

Address Issue #16

  • Fix integer overflow wrapping causing audio distortion for loud resulting signals with reverb enabled.

Copy link
Author

@djtuBIG-MaliceX djtuBIG-MaliceX left a comment

Choose a reason for hiding this comment

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

Would like some thoughts from anyone else. While this will address the immediate integer overflow distortion issue as tested, it does not address other deficiencies such as the fact stereo signals are downmixed to mono reverb.


#ifdef _WIN32
#define snprintf _snprintf
//#define snprintf _snprintf
Copy link
Author

@djtuBIG-MaliceX djtuBIG-MaliceX Jan 6, 2021

Choose a reason for hiding this comment

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

I had to comment this out as it was failing to build under MSYS2 MinGW-w64. This seems like a dirty hack anyway that likely no longer applies with more recent versions of MinGW-w64 GCC compiler suite.

in1 = smp;
smp = ou0>>2;

b[i] = (smp > INT_MAX) ? INT_MAX :
Copy link
Author

Choose a reason for hiding this comment

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

Thinking more work might be needed to prevent double-clipping.

b[i] = ou0l;
ou0l = ((smp * a0)/32768) + ((in1l * a1)/32768) + ((ou0l * b1)/32768);
in1l = smp;
b[i] = (ou0l > INT_MAX) ? INT_MAX :
Copy link
Author

Choose a reason for hiding this comment

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

As above, this may contribute to double-clipping.

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.

1 participant