davy7125 / polyphone

A soundfont editor for quickly designing musical instruments.
https://www.polyphone.io
GNU General Public License v3.0
348 stars 46 forks source link

Importing 32-bit float .wav file at peak level causes very ugly clicking noise #131

Closed ipatix closed 2 years ago

ipatix commented 3 years ago

This bug, which is causing very nasty sounds, is very easy to reproduce:

This is not a playback problem but an actual sample data problem. When I export the sine wave back to Audacity, you can see the following difference:

glitch

So most likely the maxmimum positive float value is improperly converted to int and causing an overflow.

davy7125 commented 2 years ago

I generated a sine wave as you described and then exported it as 32-float .wav (among other options). The bug cannot be reproduced, maybe it's been already fixed.

ipatix commented 2 years ago

Well, I haven't been able to try it again, but my instructions theoretically might not be sufficient to reproduce this problem since depeding on the caluclation accuracy a sine wave might not contain a critical value (like in the image not all cycles have this phenomenon).

Since I usually do not build Polyphone from source, which version should I try to see if this problem still exists?

davy7125 commented 2 years ago

Fixed! I reproduced the bug with an amplified sample (using Audacity and allowing saturation). IEEE float wav files possibly contain values exceeding 1.0 and I didn't take it into account.