Author Topic: Help with resampling  (Read 6222 times)

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,146
  • Gender: Male
  • Operating System: Windows XP
Help with resampling
« on: August 15, 2009, 00:20:38 »
What is resampling? When do we need it? When shouldn't we use it? How does it work and when is it applied?

This information will need to go into the OHM but i've never bothered with it, so i don't know what to make of it.

Offline uncloned

  • Extreme artist
  • *****
  • Posts: 2,753
    • http://www.chrisvaisvil.com
  • Operating System: Sam Zen - RIP
Help with resampling
« Reply #1 on: August 15, 2009, 00:49:30 »
I believe resampling is:

consider a mono wave form at 44.1 kHz one second in length

it is a set of sequential numbers

if you want to recreate that sample with 22kHz quality one method is to skip every other data point. When you do that you have "resampled" that data to create an approximation of a lower quality sample.

I think one can get fancy with moving averages etc.

I could be wrong - its my understanding.

Offline Sam_Zen

  • Extreme artist
  • *****
  • Posts: 3,689
    • http://www.xs4all.nl/~samzen/
Help with resampling
« Reply #2 on: August 15, 2009, 01:04:01 »
Resampling down to a lower resolution means skipping sample points one way or the other.
Resampling up is another thing.
Duplicating a sample point to fill the gap, or calculating something in between.
0.618033988

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,146
  • Gender: Male
  • Operating System: Windows XP
Help with resampling
« Reply #3 on: August 15, 2009, 01:13:59 »
I think i've used the wrong term. In the Instrument page and the Player Options page, you can choose Linear phase, XXMS, Polyphase, etc. I saw the post that someone wrote up on it, but i didn't understand how all this works and why we would use it.

Offline g

  • Workaholic artist
  • ***
  • Posts: 280
Help with resampling
« Reply #4 on: August 15, 2009, 01:55:00 »
Those are basically the algorithms used for resampling. I usually stick with the default Polyphase (at least that's my default) unless I get some clicks (can happen when volume fading bass samples) in which case I try some XMMS. If I want 8-bit sound I use no resampling. Spline and Linear are afaik not really useful, I see them as legacy.

While on the subject, shouldn't the default setting be saved with the songs? I mean if we want songs to sound *exactly* the same on different computers...

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,507
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Help with resampling
« Reply #5 on: August 15, 2009, 05:33:27 »
g, I will refuse to add another silly OpenMPT-only feature to IT, XM and whatever files, but it might be possible for MPTM to add. However, that's IMHO what the instrument settings are for, because normally you would also choose the best resampling option for your CPU (which is, to be honest, a bit superficial these days).

Oh, and Harbinger, please don't demand exact definitions of each resampling mode, because it's a shitload of maths which you could easily look up on wikipedia and that nobody is really interested in. :P ;)
» 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 LPChip

  • Administrator
  • *****
  • Posts: 5,135
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
Help with resampling
« Reply #6 on: August 15, 2009, 09:35:25 »
For information that is actually relevant to be put in the manual, set it like this:

Resampling is used to calculate how that sample is being heard at other frequencies. Without resampling, it can sound bad when you have high quality samples. For that reason, the default is best in about all situations.

You might want to go for none or linear when you work with chiptunes, because they usually sound better without, as they require that sharp sound, and the designer might've aimed for that sound, especially if the sounds are low quality.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,507
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Help with resampling
« Reply #7 on: August 15, 2009, 09:40:11 »
Quote
Without resampling, it can sound bad when you have high quality samples.

WHAT? High quality samples do not need resampling. Low quality samples need resampling if they should not sound fuzzy. The thing about high quality is that it is already resampled. :P

EDIT: ModPlug's wording is very bad here, it should be "interpolation" like with all other programs. Low quality samples obviously "miss" information, so this information has to be restored. And that's done by doing interpolation between 2 or more points of the sample. High quality samples obviously don't lack information, so they can usally be used without resampling.
» 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 LPChip

  • Administrator
  • *****
  • Posts: 5,135
    • http://lpchip.nl
  • Operating System: Windows 10 Pro x64
Help with resampling
« Reply #8 on: August 15, 2009, 09:42:21 »
Quote from: "Jojo"
Quote
Without resampling, it can sound bad when you have high quality samples.

WHAT? High quality samples do not need resampling. Low quality samples need resampling if they should not sound fuzzy. The thing about high quality is that it is already resampled. :P


If high quality samples don't need resampling, then why do we still have such option? True, for backwards compatibility... I guess we need to shed a bit of light on this issue. I always thought you needed the resampling or it wouldn't sound good.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,507
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Help with resampling
« Reply #9 on: August 15, 2009, 09:42:57 »
Read the edited part of my previous post, I hope it explains everything.
» 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 g

  • Workaholic artist
  • ***
  • Posts: 280
Help with resampling
« Reply #10 on: August 15, 2009, 09:46:36 »
Quote from: "Jojo"
g, I will refuse to add another silly OpenMPT-only feature to IT, XM and whatever files, but it might be possible for MPTM to add.

Generally when I speak of OpenMPT-specific features I mean MPTM. Another option would be that rather having "default" as a setting at all, the default setting (from the player settings" would be selected by default. E.g. in my case, if I select "default" on the instrument tab it would revert directly to polyphase (because that's my default setting).

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,146
  • Gender: Male
  • Operating System: Windows XP
Help with resampling
« Reply #11 on: August 15, 2009, 21:30:37 »
Quote from: "Jojo"
Oh, and Harbinger, please don't demand exact definitions of each resampling mode, because it's a shitload of maths which you could easily look up on wikipedia and that nobody is really interested in. :P ;)


First of all i'm not demanding anything.

Second of all, i'm not looking for exact definitions, just practical ones.

Thirdly, how am i supposed to know that wikipedia is going to have answers for specific functions of any given application?!

Fourthly, who are YOU to decide who's interested. I AM!

Fifthly, how does the syntax and wording of your question match your little emoticons? Are they supposed to alleviate your negative statements?

Sixthly, leave the profanity for your bathroom. We're civilized here.

Seventhly, before you post, check to make sure that what your about to put into the forum is helpful or at least positive. Otherwise, just delete it out of your mind and take out your moodiness on someone else.

Eighthly, oh, you don't like being told what to do. Neither do I!

Ninthly, out of all people that could have helped with determining how we should best use this resampling/interpolation, it would be you. But i'll do without the knowledge in your brain if i can avoid the crappy attitude. If you offer positive help and knowledge, you have our undying respect. If you're not interested in our respect, begin braying like you did here. :x

Quote from: "Jojo"

ModPlug's wording is very bad here, it should be "interpolation" like with all other programs. Low quality samples obviously "miss" information, so this information has to be restored. And that's done by doing interpolation between 2 or more points of the sample. High quality samples obviously don't lack information, so they can usally be used without resampling.


Now that's what i need! Thank you! Why interject all that negativity -- you had the information all along. :wink:
I trust in the next build you'll trade the "resampling" term for "interpolation"; i agree -- that's a better more descriptive term.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,507
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Help with resampling
« Reply #12 on: August 16, 2009, 11:05:08 »
Quote

Thirdly, how am i supposed to know that wikipedia is going to have answers for specific functions of any given application?!

See, it's not like Olivier invented some terms that are specific to ModPlug.
http://en.wikipedia.org/wiki/Linear_interpolation
http://en.wikipedia.org/wiki/Spline_interpolation#Cubic_spline_interpolation
http://en.wikipedia.org/wiki/Polyphase_matrix (not sure if this is the right one as there's another article which could be the right one :P)
http://en.wikipedia.org/wiki/XMMS

Now that was easy, wasn't it?

Quote
Fourthly, who are YOU to decide who's interested. I AM!

I never told you not to be interested in Interpolation algorithms. I just decided NOT to look up complex mathematical terms in the ModPlug sourceocode for you to show you how cubic spline interpolation works.

Quote

Fifthly, how does the syntax and wording of your question match your little emoticons? Are they supposed to alleviate your negative statements?

A "tongue" smiley is a warning for something called IRONY and "READ BETWEEN THE LINES", things that people nowadays seem to be not able to do anymore.

Quote
Sixthly, leave the profanity for your bathroom. We're civilized here.

Sorry for prejudices, but I have indeed found out that many Americans seem to have a problem with this. I, for once, don't. And I don't care if other people have problems with words like "shitload".

Quote
Seventhly, before you post, check to make sure that what your about to put into the forum is helpful or at least positive. Otherwise, just delete it out of your mind and take out your moodiness on someone else.

Oh thanks, it's not like I've never posted in a forum and don't know how to post. :P (<--- WARNING! IRONY DETECTED!)

Quote
Eighthly, oh, you don't like being told what to do. Neither do I!

I didn't tell you anything. I told you that you CAN look up interpolation algorithms on wikipedia, but you obviously did not get the message.

Quote

I trust in the next build you'll trade the "resampling" term for "interpolation"; i agree -- that's a better more descriptive term.

Well, I dunno if it should be changed for historic reasons, but then again, I just renamed a shitlo...errr, quite a bunch of variables in the sourcecode which had pretty bad names due to historic reasons!
» 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 LB

  • Active artist
  • *
  • Posts: 16
    • http://www.LB-Stuff.com/
Help with resampling
« Reply #13 on: August 16, 2009, 17:01:42 »
I don't know about you, but when people cuss, it gives me a bad impression on them. /out
Don't feed the bunnies. They will bring thier friends next time.

~MMF2 Developer user~
LB-Stuff - My Website

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,146
  • Gender: Male
  • Operating System: Windows XP
Help with resampling
« Reply #14 on: August 22, 2009, 04:10:48 »
I apologize for my "touchiness" (thanks uncloned! :x  :P ) but with Obama trying to wrestle away our liberties, and people classifying us as "mobsters", "nazis", and "racists" simply because we are petitioning our government and protesting their takeover of our personal lives, i'm a bit edgy these days. (Not to mention my life is about to be turned upside down soon.)

I still say people should choose their words more carefully. ::)

And Jojo, i rely heavily on your word. Either answer the question or don't, it's certainly your right to not help. But don't tease or mock for trying to find out everything; i told you from the beginning i wanted to know more than i needed to, so i could do this manual right. :wink:

Are we cool? 8)