szechyjs/mbelib — pull request #12 by EdFuentetaja (2014-04-29 15:22:38+00:00)
Title: Fixed random number generation that assumed that RAND_MAX == 2147483647.

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.