ModPlug Central

OpenMPT => Development Corner => Topic started by: zippler on June 12, 2013, 10:02:04

Title: Book about DSP techniques applied to XM
Post by: zippler on June 12, 2013, 10:02:04
Hi developers  ;)

I'm preparing my PhD dissertation article about DSP programming for sound.
I'd like to learn mod and xm player techniques. I have read the Fairlight tutorial about a MOD player with GUS programming (a very old documentation txt)
I wonder if you could provide or recommend me a book about DSP and filter effects applied in XM tracking from a C++ implementation perspective.

Thank you in advance.
Carlos.
Title: Re: Book about DSP techniques applied to XM
Post by: Saga Musix on June 12, 2013, 10:10:36
I'm not sure what exactly you are looking for, since there's not much DSP magic done in this classic kind of tracked music. Samples are simply mixed together based on their volume, pitch and panning. The only DSP stuff worth mentioning in this process are probably the (optional) interpolation algorithms that are used to reduce the artefacts generated by resampling. Those interpolation algorithms generally vary between trackers.
Title: Re: Book about DSP techniques applied to XM
Post by: zippler on June 12, 2013, 14:19:09
Thank you for your quick reply.  :)

However, could you provide me a tutorial about how to accomplish pitch, volume, panning change and FX implementation?

Thank you in advance.
Carlos.

Title: Re: Book about DSP techniques applied to XM
Post by: Saga Musix on June 12, 2013, 15:12:05
All of these are pretty much one-liners, I don't know what you would write in a tutorial about these.
Volume and panning are basically the same thing, you just multiply the sample volume with a factor before adding it to the mix (for panning, the factor is different for the left and right mix buffer, e.g. if the sample is panned hard left it would be 100% for the left channel and 0% for the right channel).
Pitch is a bit more complex but still simple... You need the sample's playback frequency (e.g. 22 KHz) and the mixing frequency (e.g. 44 KHz)... Then you compute the relative increment of the sample position, which is sample frequency / mixing frequency (in this example, it would be 0.5). Then, when adding samples to the mix buffer, you advance the sample playback position by this relative increment. Usually this is implemented using fixed point math in trackers, e.g. the relative increment could be a 16.16 fixed point number. As soon as you add interpolation, it gets a bit more complicated, but these concepts remain the same.