ModPlug Central

OpenMPT => Technical Documents => Topic started by: Sylus101 on June 09, 2008, 21:17:40

Title: Converting from IT to MOD, bad sample quality loss...
Post by: Sylus101 on June 09, 2008, 21:17:40
Hello everyone,

Just getting started with OpenMPT and enjoying it quite a bit. I ran through the tutorial on creating a first song and that went quite smoothly.

I saved it and saw that MOD was not a save type, only IT so I found the option on how to change it to .mod and was quite surprised to find that the sample quality became completely distorted.

I tried from a freshly created file and pulling instruments over into samples from the provided folders (Midi and GM.DLS) sound just as bad.

Is there a way to work with mod and retain decent sample quality? I've downloaded a few mods from modarchive and they sound pretty good, so I'm sure it's possible...

I'm working on creating music for a game and mod is my only option...

Thanks ahead of time,
Sylus
Title: Converting from IT to MOD, bad sample quality loss...
Post by: LPChip on June 09, 2008, 21:29:47
Hi and welcome.

The .mod module format is really old and outdated. You really should not want to mess with it. Seen that there currently is alot of support for other module filetypes, like .xm and .it, I doubt that there isn't a library available that you can use instead.

There is another misconception possible. Although .mod stands for module, all other tracker formats are known as modules too. So an .IT file is also considered to be a module. If you're not the developer, you should verify if you can use .xm or .it files. (.xm is most likelly possible).

If it really isn't possible, then try to convince the developer to switch to another library that supports atleast .xm files. (or if possible .it)

The old .mod file really has limited support and not only will you get really crappy sample quality, you'll loose alot of abilities, like having instruments, panning per sample, amount of channels, length of a sample, mono samples, samples at a fixed pitch, no volume effects column, etc...

The only reason why those old .mod files sound decent, is because the crappy quality was taken into consideration when making the samples.

To point out what happened: Basically, if you're a painter and your colours are all messed up, but you know exactly how they're messed up, you can still make a very good painting with it. If you however use those colours to paint a painting the normal way, it will look really ugly.

So my advice is: go talk with the developer and see if you can deliver .xm or .it files (last one prefered)

There are alot of libraries available. I even seen .it support for a mobile phone game. If there's no support for other module types, you can also suggest .mp3 or .ogg support. That should be available too. You can always export your song to .wav and convert from there to any streamed format.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: Sylus101 on June 09, 2008, 22:44:23
Sadly, I'm working on project for home written Nintendo DS game and it appears that mod is the only format that works for longer music files. It can take raw data too, but that seems to be reserved for shorter sound affect files.

I do have a question though. I found some samples, coverted to wav, cropped a bit and loaded one (a distorted guitar) into a mod file and it sounded just fine, but only when a certain range of notes was played. Playing it at lower tones made it get slower and slower where higher tones got faster.

Any way to stop/adjust for this or would I be screwed to finding samples at every note I needed to make it sound right?
Title: Converting from IT to MOD, bad sample quality loss...
Post by: bvanoudtshoorn on June 09, 2008, 23:03:16
Quote from: "Sylus101"I do have a question though. I found some samples, coverted to wav, cropped a bit and loaded one (a distorted guitar) into a mod file and it sounded just fine, but only when a certain range of notes was played. Playing it at lower tones made it get slower and slower where higher tones got faster.

That's the way sample playback works. Play the sound more slowly, and its pitch is lowered. You should be able to get away with an octave or two per sample, though.

If you're using instruments (extracted from the GM soundbank, for example), try loading them as an instrument in an IT file first, then going to the "samples" tab and exporting (or copying and pasting) the samples across from there. You need to do this because using a GM sound in a MOD will only give you one sample from the patch, whereas in an IT / XM file, it will give you a much wider selection of the samples.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: Sam_Zen on June 10, 2008, 01:02:57
BvO is right, that's how using samples works. Consider it as changing the playback speed of a tape-recorder.

So let's assume you're stuck with the MOD format. It has his own properties.
First, you were not correct that MOD is not a save type. It's one of the options in the 'save as' dialog (Protracker).
The same choice is there when opening a new file for a module, behind the button 'Song properties'.

If you choose the MOD format, the first thing you will notice is the lacking 'instruments' tab.
It has to be done just with the samples, no options for volume or panning envelopes for example.
So if you seek for quality, pay extra attention to the quality of each sample before importing it into OMPT.
Panning of samples is specific too :
As a default, a MOD has organized the channels of a pattern as : L-R-R-L and so on.
This can be overruled by a panning code of a sample note with '8xy' (see Help file)
Another escape to this is using a stereo sample with a predefined panning.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: mrvegas on June 10, 2008, 03:37:23
There was a similar topic some time ago, but I still don't really understand what's going on with samples when they are loaded into a .mod file.  They play back at a different pitch.  It seems that MPT (probably copying ProTracker) always converts a file to a standard length and/or sample rate.

Anyway, we could probably help the starter of this thread if someone could explain how to get a sample to play back normally in ProTracker.  (Or how to convert a sample to a form that will play properly.)  If anyone knows, help would be appreciated.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: Sylus101 on June 10, 2008, 05:47:18
Quote from: "Sam_Zen"First, you were not correct that MOD is not a save type. It's one of the options in the 'save as' dialog (Protracker).
The same choice is there when opening a new file for a module, behind the button 'Song properties'.

I found the option to start the different types under File, New, but once in a particular type, I'm 99% sure after trying a handful of times, you can't change the file type when choosing "Save As." Not looking for any trouble, just pretty sure what I'm seeing and hell, since you can change it in the song properties it's no big deal. I'm using 1.17.02.28 (1.17RC2) for Athlon64/P4's in case anyone is interested.

Anyway, that's hardly worth arguing about. The good news, is that I think I found a development library for my platform that supports the better formats and I'm running a couple of tests right now. I did get one actual MOD file working after playing with some samples and it didn't sound half bad, but not near as nice as the first IT format track I played with.

Thanks to everyone for clarifying things. I found the tutorial extremely helpful in getting started.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: älskling on June 10, 2008, 08:56:33
Quote from: "Sylus101"I found the option to start the different types under File, New, but once in a particular type, I'm 99% sure after trying a handful of times, you can't change the file type when choosing "Save As."
That's correct, you can change file type in "song properties" either on the "General" tab or from the "View" menu.

Note that OpenMPT makes some extensions to the .it format, so for best compatibility with your development library you may want to use the "Compatibility Export" function in the file menu.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: bvanoudtshoorn on June 10, 2008, 09:12:10
Quote from: "älskling"Note that OpenMPT makes some extensions to the .it format, so for best compatibility with your development library you may want to use the "Compatibility Export" function in the file menu.

Yeah. :) Some things to watch out for:

Miscellaneous
=> You can't use VST instruments and effects, and DirectX instruments and effects.

Accessible from "Song Properties
=> You should use "classic" tempo mode (although this isn't strictly required)
=> Make sure that you select "IT Old Effects" and "IT Compatible Gxx"
=> Set "Miscellaneous flags" to "100" (I think this is right...  :?)

Instruments tab
=> As far as I know, you have to choose "Channel default" for filter mode (you can change it with effects, but not in the instrument editor. Can someone confirm this for me?)
=> You should leave "Default" resampling selected for each instrument.
=> You cannot use "release nodes" in the envelopes.

Effects
=> Avoid #xx and \xx.
=> (Volume effect) avoid :xx (incidentally, can someone explain to me what this does? It doesn't appear to send any MIDI messages whatsoever according to the MidiMonitor plugin, regardless of what values I give it and what volume processing I select).


Most of this stuff you're not likely to want to use anyway, but at least you know what to avoid when you're working with IT files. And yes, use the "Compatability export" function.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: LPChip on June 10, 2008, 14:36:52
You also mentioned that you're using RC2. I really recommend downloading a newer build. Although .48 isn't labelled RC3, I would certainly call it RC3. We are currently on build .52 and one of the options you gain from going to a higher version, is the ability to save as an .IT compatible file. This will ensure that every not-supported feature by other players will be removed.

It might seem restrictive, but I guess OpenMPT is just a tool that allows you to do more.

So basically: make a pattern with the samples you want etc, then do a compatibility export, close the file and re-open. That way, everything that got removed is not supported. :) If nothing was removed (which I think will happen cus the tutorial will only show you stuff that is also possible in Impulse Tracker) then you know that too.

On a sidenote: I'm glad that you found the tutorial usefull. :)
Title: Converting from IT to MOD, bad sample quality loss...
Post by: Sylus101 on June 10, 2008, 16:44:18
Success all around. I've updated to .48, done a compatibility export and have successfully played an IT file in my program. It was only 2 channel to start with, but heck it was just a test.

Thanks again everyone, I'm already having a lot of fun with this and am looking forward to making some good tunes.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: LPChip on June 10, 2008, 18:57:11
There rest me only one request to make here.

Can you share something when you have it? :D You can post songs in the Free Music Downloads forum, so everyone can give you feedback on it. :)
Title: Converting from IT to MOD, bad sample quality loss...
Post by: Sylus101 on June 11, 2008, 01:10:20
Can do, I'd be happy to. I'll probably suck compared to what some people can do, but what the hell.

I am finding it a little tricky to do something with a bit more of a metal edge (I'm not much for rave/dance music) but with the right samples I think I can come up with something.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: Sam_Zen on June 11, 2008, 02:03:21
This thread a potential one for the TechDoc forum maybe ?
Title: Converting from IT to MOD, bad sample quality loss...
Post by: LPChip on June 11, 2008, 07:20:49
Agreed Sam_Zen
Title: Converting from IT to MOD, bad sample quality loss...
Post by: Relabsoluness on June 21, 2008, 12:27:04
Quote from: "bvanoudtshoorn"avoid :xx (incidentally, can someone explain to me what this does? It doesn't appear to send any MIDI messages whatsoever according to the MidiMonitor plugin, regardless of what values I give it and what volume processing I select).
Maybe LPChip can tell:
Quote from: "history.txt"? Half-finished "velocity" command (Ask LPChip about this).
(what a well documented feature :)) To me it seems that the command affects both volume and sample offset: the higher the parameter, the higher the volume and the smaller the offset. It's worth noting though that the current implementation is buggy due to which the the offset part is not handled reasonably for parameter values 7,8,9 (if you want to examine the code, search for string "SampleOffset(nChn, 48-(vol << 3), bPorta);" in file snd_fx.cpp).
Title: Converting from IT to MOD, bad sample quality loss...
Post by: LPChip on June 21, 2008, 12:43:16
Quote from: "Relabsoluness"Maybe LPChip can tell:
Quote from: "history.txt"? Half-finished "velocity" command (Ask LPChip about this).
(what a well documented feature :)) To me it seems that the command affects both volume and sample offset: the higher the parameter, the higher the volume and the smaller the offset. It's worth noting though that the current implementation is buggy due to which the the offset part is not handled reasonably for parameter values 7,8,9 (if you want to examine the code, search for string "SampleOffset(nChn, 48-(vol << 3), bPorta);" in file snd_fx.cpp).

Yes, its indeed a combination of doing Vxx and Oxx.

The idea is, that ?9 gives V64 O00, thus, full sound. but decreasing the ?parameter lowers volume and increases the offset. The idea is to be used in conjunction with SDx (note delay) to get realistic piano, guitar, etc... sounds.
Title: Converting from IT to MOD, bad sample quality loss...
Post by: charles0111 on July 17, 2008, 07:44:34
Quote from: "Sylus101"Sadly, I'm working on project for home written Nintendo DS game and it appears that mod is the only format that works for longer music files. It can take raw data too, but that seems to be reserved for shorter sound affect files.

me too.

if straightly pick the downloaded mod format file from internet,or creating a new mod format file with Modplug tracker,they all can be played in NDS

but the matter is when turn the mid format file into mod format file by Modplug tracker,and then pick the translated mod  in NDS,it can't be played,it donesn't work.

who might tell how to translate mid to mod that can be played well in NDS,thank you very much.