View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001007||OpenMPT||[All Projects] General||public||2017-08-11 04:36||2017-08-11 12:55|
|Status||closed||Resolution||no change required|
|Product Version||OpenMPT 1.26.12.00 / libopenmpt 0.2-beta26 (upgrade first)|
|Target Version||Fixed in Version|
|Summary||0001007: Nearest Neighbor - wrong result|
If I have 2 samples, 1, -1 (8000Hz) and resample it to specific even numbers, such as 14 samples (56000Hz) with nearest neighbor, it gives me
|Steps To Reproduce|
Have 2 samples, 1, -1 (8000Hz) and resample it to specific integer multiple (such as 56000Hz for 14 samples) with no interpolation.
|Tags||No tags attached.|
|Has the bug occurred in previous versions?|
|Tested code revision (in case you know it)|
Computers are bad at periodic numbers. The ratio of 8/56 (or 1/7) is periodic (0.142857142857142857...) and thus cannot be stored perfectly. As a result, the sampler cannot hit every sampling point precisely and sometimes is of by +/-1. In any other resampling mode than Nearest Neighbour, this is not a problem because they look at the fractional part of the sample position as well, but it's in the definition of Nearest Neighbour that we do not look at fractional sample positions.
Hence, there is nothing we can do here. Resampling by almost three octaves using Nearest Neighbour is a very bad idea anyway. You will have to fix your sample yourself and live with that fact.
I did not intend to resample. I intended to replace 2 period by 14 period.
Please show me debug log
No matter what you wanted to do, you can manually fix the result by using the sample draw feature: Click the pen icon and correct the one offending sample point.
|2017-08-11 04:36||Piotr||New Issue|
|2017-08-11 11:01||Saga Musix||Status||new => closed|
|2017-08-11 11:01||Saga Musix||Resolution||open => no change required|
|2017-08-11 11:01||Saga Musix||Note Added: 0003156|
|2017-08-11 12:54||Piotr||Status||closed => feedback|
|2017-08-11 12:54||Piotr||Resolution||no change required => reopened|
|2017-08-11 12:54||Piotr||Note Added: 0003159|
|2017-08-11 12:55||Saga Musix||Status||feedback => closed|
|2017-08-11 12:55||Saga Musix||Resolution||reopened => no change required|
|2017-08-11 12:55||Saga Musix||Note Added: 0003160|