mmorise / World

A high-quality speech analysis, manipulation and synthesis system
http://www.kisc.meiji.ac.jp/~mmorise/world/english
Other
1.17k stars 251 forks source link

Fix a bug in the random number generator. #60

Closed Sleepwalking closed 6 years ago

Sleepwalking commented 6 years ago

https://github.com/mmorise/World/blob/master/src/matlabfunctions.cpp#L242

randn function implements an iterated xorshift random number generator that generates an approximately normal-distributed random variable (RV) by summing 12 uniform RVs in [0, 2^32 / 16].

Due to an incomplete initial iteration, it was empirically found that the values for w at the 2nd and 4th iterations will be nearly identical, breaking the i.i.d. assumption. The output RV will have a variance of (10 + 4) / 12 = 1.1667. This can be verified by feeding the vocoder a Gaussian white noise and measuring the variance of the output.

screenshot from 2018-02-23 15-18-06

screenshot from 2018-02-23 16-22-31

The bug has been fixed by putting back the initial iteration on w. In addition, all occurrences of unsigned int have been replaced by uint32_t for good portability.

m-toman commented 6 years ago

Interesting, did you notice a perceivable difference in the vocoded speech too?

Sleepwalking commented 6 years ago

@m-toman Absolute discrimination? No. Differential discrimination? Barely able to tell. This is really just a 0.67 dB gain on the unvoiced part. For some reason WORLD vocoder makes speech sound more breathy to me and I started looking for why. In the process of doing so this bug was found but it seems only tangentially relevant to the breathy voice problem. My current bet is on the rectangular-windowed STFT for noise synthesis. Nevertheless bug fixes are always good to have, for sanity's sake.

mmorise commented 6 years ago

Thank you for your comment and discussion. I'm in a business trip, so I will check it after a few days.

perceivable difference

I also perceived that difference, but I cannot judge this difference is caused by the bug. In particular, the difference was perceived in plosive. I have thought that the difference was caused by the random seed.

mmorise commented 6 years ago

I checked your request and accept it. Thank you for your cooperation.

Since I am going to close this thread, please make a new thread if needed. I think that noise perception is an interesting but difficult topic.