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-31 13:05|
|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.
I don't see where the rounding error should be, and I don't see division by 7 either.
Upsampling by a factor of 7 means that the step increment is 1/7. So OpenMPT needs to step in increments of 0.142857142857142857... through the sample per sample, and that is a periodic number as said.
Piotr, this is the last warning. I told you before that your behaviour of discussing with developers about things they have already justified is not welcome. If you do this once more, I will have to remove your access to the bug tracker. If you have specific questions about resampling, ask them on the forum, but not on the bug tracker.
How about using different division, like 7/7, not multiplying 1/7 by 7?
Also, once again, I'm not registered to forum!
You can register at https://forum.openmpt.org/index.php?action=register
|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|
|2017-08-31 05:49||Piotr||Status||closed => feedback|
|2017-08-31 05:49||Piotr||Resolution||no change required => reopened|
|2017-08-31 05:49||Piotr||Note Added: 0003198|
|2017-08-31 05:54||Piotr||Status||feedback => new|
|2017-08-31 10:09||Saga Musix||Note Added: 0003200|
|2017-08-31 10:10||Saga Musix||Status||new => closed|
|2017-08-31 10:10||Saga Musix||Resolution||reopened => no change required|
|2017-08-31 10:14||Saga Musix||Note Edited: 0003198||View Revisions|
|2017-08-31 12:47||Piotr||Status||closed => feedback|
|2017-08-31 12:47||Piotr||Resolution||no change required => reopened|
|2017-08-31 12:47||Piotr||Note Added: 0003201|
|2017-08-31 12:48||Piotr||Note Added: 0003202|
|2017-08-31 12:48||Piotr||Status||feedback => new|
|2017-08-31 13:05||Saga Musix||Note Added: 0003203|
|2017-08-31 13:05||Saga Musix||Status||new => closed|
|2017-08-31 13:05||Saga Musix||Resolution||reopened => no change required|