#27361 - ProblemBaby - Mon Oct 11, 2004 3:30 pm
Hi again.
Now my Mixer works fine in just C code.
When I try to play my XM file it doesnt sound like it does in ModPlugTracker at all. The most noticeable thing is the volumes.
All the instruments have same volume and I can hear everything when I play it in Modplug tracker but in my mixer some instruments are very quite. I also want to know how they mix the sound in trackers.
Is it like I do Add all channels and then divide my that number of channels??
#27366 - SmileyDude - Mon Oct 11, 2004 5:46 pm
ProblemBaby wrote: |
Is it like I do Add all channels and then divide my that number of channels?? |
Well, there are a couple of ways you can do the mixing -- you can do what you are doing, but the more channels you have, the quieter the overall mix is going to be. On the GBA, there is only 256 possible volume levels. If you have 8 channels, you've just reduced that to 32. And the only way you'll get 100% volume is if all 8 channels happen to be at full volume at the moment. But, that rarely happens.
Which leads to the other way of doing it. Since all of your channels are rarely at 100%, you could simply add all of the channels together, and clip the sample back down to 255 if necessary. As you can imagine, if you have a particularly loud piece of music and/or a lot of channels, the clipping would quickly become noticeable.
You could also use audio compression (not MP3 style compression, more like the analog compression used in music production) to reduce the volume when needed, but I find the effect to be annoying.
Personally, I'm using the clipping method -- but, then again, I'm only mixing 2 channels per GBA channel, so the clipping doesn't cause much of a problem.
_________________
dennis
#27370 - ProblemBaby - Mon Oct 11, 2004 7:05 pm
Yeah it sounds better but some channels is still really quite.
Is it possible to make it sound on the GBA as it do in the tracker?
Ive also some problems with finetunes:
I found a nice formula in the XM-doc:
Period = 10*12*16*4 - Note*16*4 - FineTune/2;
Frequency = 8363*2^((6*12*16*4 - Period) / (12*16*4));
Speed = (Frequency << 12) / 18157 // Added by me.
Well it is good to make a table of this if I only have the notes but it is if add all finetunes it will result in a table of size: 96*64 * sizeof(u16) and that feels like a bit of waste!
But my feeling says that it would be slow in realtime too.
Do someone have an idea of how to do this?
#27387 - SmileyDude - Tue Oct 12, 2004 2:01 am
you could boost the volume artifically, if you still think it's too quiet. But, it increases your chances of clipping, and your dynamic range goes down as well.
If you are writing your own music, then you can simply make sure that your samples are loud enough to begin with. If you're making a generic MOD/IT/S3M/whatever player, you have to live with what you are given.
_________________
dennis