[GH-ISSUE #4] Noise shaping bug? #2

Closed
opened 2026-05-05 22:01:06 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @aceaudio on GitHub (Feb 20, 2018).
Original GitHub issue: https://github.com/airwindows/airwindows/issues/4

1fc3148c06/plugins/MacAU/Acceleration/Acceleration.cpp (L268)

This looks to me like a bug. On the line above fpTemp = inputSample; then on the line linked above
fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew); this is equivalent to
fpNShapeA = (fpNShapeA*fpOld)+((inputSample-inputSample)*fpNew); which is equivalent to
fpNShapeA = (fpNShapeA*fpOld)+(0*fpNew); which is equivalent to
fpNShapeA = (fpNShapeA*fpOld);

I'm assuming that is not intentional?

Originally created by @aceaudio on GitHub (Feb 20, 2018). Original GitHub issue: https://github.com/airwindows/airwindows/issues/4 https://github.com/airwindows/airwindows/blob/1fc3148c06290bb569384375549979ea74ad785d/plugins/MacAU/Acceleration/Acceleration.cpp#L268 This looks to me like a bug. On the line above `fpTemp = inputSample;` then on the line linked above `fpNShapeA = (fpNShapeA*fpOld)+((`**`inputSample-fpTemp`**`)*fpNew);` this is equivalent to `fpNShapeA = (fpNShapeA*fpOld)+((`**`inputSample-inputSample`**`)*fpNew);` which is equivalent to `fpNShapeA = (fpNShapeA*fpOld)+(0*fpNew);` which is equivalent to `fpNShapeA = (fpNShapeA*fpOld);` I'm assuming that is not intentional?
Author
Owner

@airwindows commented on GitHub (Feb 20, 2018):

On 2/19/18, at 7:59 PM, Anthony Nicholls notifications@github.com wrote:

1fc3148c06/plugins/MacAU/Acceleration/Acceleration.cpp (L268)

This looks to me like a bug. On the line above fpTemp = inputSample; then on the line linked above
fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)fpNew); this is equivalent to
fpNShapeA = (fpNShapeA
fpOld)+((inputSample-inputSample)fpNew); which is equivalent to
fpNShapeA = (fpNShapeA
fpOld);

I'm assuming that is not intentional?

Look more closely at the variable types. inputSample, fpNShapeA and fpNShapeB are long doubles. fpTemp is 32 bit only, so it truncates whataver’s left over in the long double and then I’m subtracting only what’ll get through to the output of the plugin (which can only send 32 bits to the buffer).

Not only is it intentional, it’s the whole point of the exercise. :) thank goodness, if it was actually equivalent to (inputSample - inputSample) I’d have to revise basically every plugin ;)

Chris
<!-- gh-comment-id:366847175 --> @airwindows commented on GitHub (Feb 20, 2018): > On 2/19/18, at 7:59 PM, Anthony Nicholls <notifications@github.com> wrote: > > https://github.com/airwindows/airwindows/blob/1fc3148c06290bb569384375549979ea74ad785d/plugins/MacAU/Acceleration/Acceleration.cpp#L268 > > This looks to me like a bug. On the line above fpTemp = inputSample; then on the line linked above > fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew); this is equivalent to > fpNShapeA = (fpNShapeA*fpOld)+((inputSample-inputSample)*fpNew); which is equivalent to > fpNShapeA = (fpNShapeA*fpOld); > > I'm assuming that is not intentional? Look more closely at the variable types. inputSample, fpNShapeA and fpNShapeB are long doubles. fpTemp is 32 bit only, so it truncates whataver’s left over in the long double and then I’m subtracting only what’ll get through to the output of the plugin (which can only send 32 bits to the buffer). Not only is it intentional, it’s the whole point of the exercise. :) thank goodness, if it was actually equivalent to (inputSample - inputSample) I’d have to revise basically every plugin ;) Chris
Author
Owner

@aceaudio commented on GitHub (Feb 20, 2018):

Haha I thought I was probably missing something obvious, thanks Chris.

<!-- gh-comment-id:366847409 --> @aceaudio commented on GitHub (Feb 20, 2018): Haha I thought I was probably missing something obvious, thanks Chris.
Author
Owner

@airwindows commented on GitHub (Feb 20, 2018):

You're welcome. It's the only way I could think of to 'dither' a floating point number properly :)

<!-- gh-comment-id:366849031 --> @airwindows commented on GitHub (Feb 20, 2018): You're welcome. It's the only way I could think of to 'dither' a floating point number properly :)
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/airwindows#2
No description provided.