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

Fixed random number generation that assumed that RAND_MAX == 2147483647. #12

Merged
merged 1 commit into from
Apr 30, 2014

Conversation

EdFuentetaja
Copy link
Contributor

Hi! I'm happy to contribute with a significant improvement to the audio quality of this library. It nagged me that the quality of the demodulated audio was quite "robotic," finally I think I've found one of the reasons: a silly bug in mbelib.c. The code assumes that RAND_MAX == 2147483647, which is not the case for at least the two compilers I'm using here. My RAND_MAX is 32767 and so this bug has the effect of always returning 0 as the random outcome (cannot be denied that it's still random, http://xkcd.com/221/).

With the fix, the quality of the audio is much nicer as can be noticed clearly on the file p25_raw_unencrypted_edf.wav from the dsd-samples repository. This fix also removes the ugly spikes in the output and now the AGC can do a better job.

szechyjs added a commit that referenced this pull request Apr 30, 2014
Fixed random number generation that assumed that RAND_MAX == 2147483647.
@szechyjs szechyjs merged commit 1e343f4 into szechyjs:master Apr 30, 2014
@tehmaze tehmaze mentioned this pull request Dec 13, 2015
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.

None yet

2 participants