Closed ali1234 closed 1 year ago
If I specify the ADSR timings as integer (number of samples), then the crash does not happen.
Thanks for discovering this and letting me know! This should be fixed now.
Yes, this is due to bad rounding, which was always expected to cause an issue at some point. Here, a duration of 0.01e3
in sample rate 22050 results in a non-integer number of samples, which gensound can handle by itself. However, this ADSR uses two curves of duration 0.01e3
(for attack and then decay). If we compute the total duration before converting to number of samples (addition before rounding), we get one sample more than if we convert first, then concatenate (rounding then adding).
Not sure what is happening here. It only happens if the sample rate is 22050. 44100 and 11025 both work. Rounding error somewhere?
Code:
Trace: