Author Topic: Possibly improve Nearest Neighbor filter  (Read 483 times)

Offline PiotrGrochowski

  • Active artist
  • *
  • Posts: 14
  • Operating System: Windows 10
Possibly improve Nearest Neighbor filter
« on: September 11, 2017, 09:46:46 »
Currently, OpenMPT takes a magic number. In case of 2 samples to 14 samples, it's 0.142857142857142857. The mistake? Sample 7 incorrectly is done as 7 times this magic number, or 0.999999999999999999. Instead, directly the division 7/7 should be used instead.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,232
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Possibly improve Nearest Neighbor filter
« Reply #1 on: September 11, 2017, 11:14:21 »
For everyone missing the context of this cryptic post, you can find it here, including the explanation why this is not going to change: https://bugs.openmpt.org/view.php?id=1007

Quote
Instead, directly the division 7/7 should be used instead.
This is simply not possible. What you want OpenMPT to be is a symbolic calculator, i.e. a calculator that does not immediately calculate the result of a "lossy" operation, but there is no reason in the world why a sampler should do such expensive operations. Upsampling or downsampling by 7 octaves at great precision is way out of the intended resampling range of OpenMPT. If you really insist on having such perfect resampling of a square wave, you will have to draw the square wave yourself.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline PiotrGrochowski

  • Active artist
  • *
  • Posts: 14
  • Operating System: Windows 10
Re: Possibly improve Nearest Neighbor filter
« Reply #2 on: September 11, 2017, 11:58:50 »
Then I blame you for telling me to use the forum.

Offline PiotrGrochowski

  • Active artist
  • *
  • Posts: 14
  • Operating System: Windows 10
Re: Possibly improve Nearest Neighbor filter
« Reply #3 on: September 11, 2017, 13:48:46 »
Wouldn't it possible to give users the option to use fast version or accurate version, like in the pitch and tempo change in Audacity?

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,232
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Possibly improve Nearest Neighbor filter
« Reply #4 on: September 11, 2017, 15:57:32 »
If you start by taking e.g. a square wave sample that is 256 points long instead of a combination of 2-point, 4-point, 8-point, etc. samples, you won't have any of these problems. We won't add another analytically "correct" (the current one is not any less correct) resampling mode just for this use case. Please re-read and understand manx' comment on this matter, it also applies to this issue.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline PiotrGrochowski

  • Active artist
  • *
  • Posts: 14
  • Operating System: Windows 10
Re: Possibly improve Nearest Neighbor filter
« Reply #5 on: September 12, 2017, 11:09:33 »
I want a real solution, not a workaround. Please add a Symbolic Calculator resampling, which is like No Interpolation but correct. Your method (use a magic number and multiply it) simply fails. It's twice the issue than normally because there is no generator of any type, in this case, square wave type of generator is needed.

Also, note that if you make a 2x2 image in Paint and resize it to 14x2, it's correct. Magic? I think not.
« Last Edit: September 12, 2017, 11:14:59 by PiotrGrochowski »

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,232
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Possibly improve Nearest Neighbor filter
« Reply #6 on: September 12, 2017, 11:14:21 »
It's not a workaround if it produces the correct solution. What you want to be done is simply beyond anything that's remotely sensible. We do not use any magic numbers, we simply use 64-bit fractional integers which is already very high precision. OpenMPT is not suitable for your wish of analytical perfection, please use another piece of software for such things.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline PiotrGrochowski

  • Active artist
  • *
  • Posts: 14
  • Operating System: Windows 10
Re: Possibly improve Nearest Neighbor filter
« Reply #7 on: September 12, 2017, 11:16:09 »
I'm sure 256 samples square wave instead of 2 is a workaround. I'm sure it will still fail for some astronomic size.

Audacity told me to use another program for 8-bit PCM
OpenMPT told me to use another program for correct nearest neighbor
What's next? I don't like lazy developers.

There IS a magic number. In case of that 2 to 14 resampling, it's 0.1428571428571429. Isn't it a magic number that's multiplied (or added) each time?

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,232
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Possibly improve Nearest Neighbor filter
« Reply #8 on: September 12, 2017, 11:19:56 »
If you call developers lazy, do not expect to get any help from them. We are not your coding slaves. We decide what's reasonable to implement and what you propose is absolutely unreasonable in the context of OpenMPT.
If both programs are not suitable for your needs, you will need to find another program, or write your own. Maybe then you will realize how difficult the things you want to be implemented are, and why pretty much everyone else is happy enough with almost-perfect solutions.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline PiotrGrochowski

  • Active artist
  • *
  • Posts: 14
  • Operating System: Windows 10
Re: Possibly improve Nearest Neighbor filter
« Reply #9 on: September 12, 2017, 11:22:53 »
If they ask people to use another program instead of implementing it themselves, they are by definition lazy. Why in the world would anyone think there is another program with same features?

Roses are red
Violets are blue
Paint does it right
And so should you
« Last Edit: September 12, 2017, 11:27:39 by PiotrGrochowski »

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,232
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Possibly improve Nearest Neighbor filter
« Reply #10 on: September 12, 2017, 11:32:32 »
Neither OpenMPT nor Audacity are meant to be "Swiss Army Knives" of audio processing. They both can do a lot but there is also a lot they cannot do (intentionally). Generally you can assume that both projects implement features they consider to be worthwhile for the majority of users. If they implemented every single feature that was ever requested (and if they actually had the time to, which they don't!), they would be unusable bloatware because their menus would be filled with options and features that only a single person ever needs. OpenMPT also cannot import Cubase project files. Does that mean that its developers are lazy? No, absolutely not. It's reasonable that such a feature doesn't exist.

If you call me or any other open-source developer lazy, then you have zero understanding that I have a live too that is not only about implementing your wishes about OpenMPT. OpenMPT is a spare time project, not my job, and while I already invest more time than is probably healthy, the last thing I need is being called lazy. You have no demands from me unless you pay me for implementing features (and believe me, you cannot afford that).

And before you call the developers anything else in addition to "lazy", I would recommend you to the read the forum rules.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline PiotrGrochowski

  • Active artist
  • *
  • Posts: 14
  • Operating System: Windows 10
Re: Possibly improve Nearest Neighbor filter
« Reply #11 on: September 12, 2017, 11:54:52 »
Not being able to import Cubase project files is not lazy because it wasn't requested. But an actually good nearest neighbor filter is requested, and you told me to use another program, which is being lazy.

Offline Rakib

  • Crazy artist
  • ****
  • Posts: 882
  • Operating System: win7x64
Re: Possibly improve Nearest Neighbor filter
« Reply #12 on: September 12, 2017, 12:07:16 »
Saga Musix I envy your patience.
^^

Offline PiotrGrochowski

  • Active artist
  • *
  • Posts: 14
  • Operating System: Windows 10
Re: Possibly improve Nearest Neighbor filter
« Reply #13 on: September 12, 2017, 12:28:50 »
8-bit PCM is a legacy feature, and so is Nearest Neighbor that works. So it would make OpenMPT consistent.

Offline MiDoRi

  • Shy artist
  • Posts: 9
  • Gender: Male
    • BotB profile
  • Operating System: Windows 8.1 x64 and XP SP3 x86
Re: Possibly improve Nearest Neighbor filter
« Reply #14 on: September 12, 2017, 13:14:14 »
Quote
What's next? I don't like lazy developers.
Considering the amount of work Saga and manx are putting into MPT's development, and how many smaller or bigger improvements are being made every iteration of it "lazy" is the last thing that comes into mind, especially given the fact that they do this in their damned spare time.

I'm genuinely curious at this point tho; Why do you insist on this feature so much? Is it stopping you from making quality music with OpenMPT anyhow, or you want it just for the sake of unnecessary perfection?