#12995 - poslundc - Wed Dec 03, 2003 6:39 am
Well, I've started on the arduous task of coding myself a MOD player. Want to check and make sure I have some of the basic concepts right before I dig my hole too deep.
First of all... my mixed output will be passing through hardware at a frequency of, I guess, 16 KHz seems to be the popular frequency.
If I understand from my research on the MOD format, the sample data for each instrument is stored at in-and-around 8,363 Hz. (Woo, that's an ugly number; close to half of 16 KHz but not quite there.) And different notes are simulated by adjusting this frequency up or down.
So if I understand the concept correctly, my mixer's job will be to keep the sound buffer full by digitally resampling each channel's instrument from its current frequency up to 16 KHz (and then mixing the samples).
The tricky part seems to be that I'm also taking samples from the MOD at an unfixed interval (seems 125 samples/minute is the popular default rate, but this can even change within a MOD). So in effect I'm doing a kind of resampling on that as well.
Is there a general strategy for keeping track of the resamplings for each instrument in each channel, while at the same time keeping track of where you are in the MOD itself? I have a feeling whatever I come up with here is going to be dreadfully inefficient.
Thanks,
Dan.
First of all... my mixed output will be passing through hardware at a frequency of, I guess, 16 KHz seems to be the popular frequency.
If I understand from my research on the MOD format, the sample data for each instrument is stored at in-and-around 8,363 Hz. (Woo, that's an ugly number; close to half of 16 KHz but not quite there.) And different notes are simulated by adjusting this frequency up or down.
So if I understand the concept correctly, my mixer's job will be to keep the sound buffer full by digitally resampling each channel's instrument from its current frequency up to 16 KHz (and then mixing the samples).
The tricky part seems to be that I'm also taking samples from the MOD at an unfixed interval (seems 125 samples/minute is the popular default rate, but this can even change within a MOD). So in effect I'm doing a kind of resampling on that as well.
Is there a general strategy for keeping track of the resamplings for each instrument in each channel, while at the same time keeping track of where you are in the MOD itself? I have a feeling whatever I come up with here is going to be dreadfully inefficient.
Thanks,
Dan.