Fixed detuned resampling

Apparently the most noticeable detuning issues were caused by rounding
error by integer division.