Reputation: 697
So, i had this brilliant idea to write something to parse .MOD files. (Tracker music) In order to attempt playing them back as a practice exercise to myself for C#.
Now i came all the way to actually playing it back, but ran into an issue. The audio buffer that my engine uses, is at a semi-fixed rate. 44100hz i believe. This particular module file, like i think all .MOD files, has a sample rate of 8287Hz (Something from the atari/amiga age i believe?)
So long story short, it isn't sounding so great.
Then i read up a bit on Sample rate conversion. And some page made a simple comparison. If you have nothing to spare, use nearest neighbour. So i did. It sounds like a dying horse. Like it screeches horribly, would not recommend. So i attempted the next best thing. Linear interpolation. I know when i have to play the next best sample in my original 8.3Khz file, and all the samples i have to fill till then, i interpolate with my last sample in the original file. Or with 0 otherwise i think (which is probably bad, but a bit besides the point)
So now i have that, and it vaguely resembles the real sound (grain of salt), but it still sounds horrible. Have i done something wrong, or does SRC just take a lot more to get something decent out of it? Also i can not hear any real difference between nearest neighbor and linear interpolation, is there a reason for that?
Original: http://puu.sh/tkgWZ.wav
Nearest:http://puu.sh/tkh0L.ogg
Linear Interpolation:http://puu.sh/tkgZ6.ogg
Is it realistic to try this at runtime, instead of pre-processing every sample and then using it?
I have seen advanced libraries covering just this. And i don't need my project to sound anything like those, but is there a decent alternative, or am i simply doing it wrong here? I would really appreciate some audio side insight, as i am not that well known with how audio works exactly.
Any advice is welcome!
Upvotes: 0
Views: 1033