Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISE_BT randomState is Infinity; causes NaN values in decoded data #10

Closed
phoboslab opened this issue Jun 15, 2016 · 1 comment
Closed

Comments

@phoboslab
Copy link
Contributor

This line causes randomState to be Infinity after a few iterations.

this.randomState *= 1664525 + 1013904223;

~ https://github.com/audiocogs/aac.js/blob/master/src/ics.js#L234

A few lines later these "random" values will be multiplied with a scale factor of -0 (because energy is Infinity as well), resulting in NaN.

Proposed fix, cast it to an integer:

this.randomState = (this.randomState * (1664525 + 1013904223))|0;
@devongovett
Copy link
Member

Sounds good, can you make a pull request?

devongovett added a commit that referenced this issue Jun 17, 2016
Fix random noise generator, see #10
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

No branches or pull requests

2 participants