I want to develop mp3 player which plays any sampling rate mp3.
But PSP's audio output is fixed at 44.1khz
So, sampling rate convertsion is needed in runtime.
If possible, I want to know how use firmware system call for performace issues.
Anyone knows this?
Anyone knows how to audio sampling rate conversion?
You could use SDL to do the audio conversion and playing. Of course SDL might slow things down a bit, although not too much, but as you're doing a player and not something of which the sound is secondary--like a game for example, I don't think a small overhead in sound output is a problem.
Your own solution might even turn out to be slower then SDL's, who knows :) I'd say try SDL and see if the speed fits your needs.
Your own solution might even turn out to be slower then SDL's, who knows :) I'd say try SDL and see if the speed fits your needs.
Let's see what the PSP reserves... well, I'd say anything is better than Palm OS.
The most common sample rates are evenly divisible by 44100 are they not?
So for say 22050, you could just let pspaudio play at 44100, and send the
same data twice, for 11025, send it four times. Then there's no overhead
for those sample rates. Below that, I think is not evenly divisible, but does
anyone want to play music at such low quality?
So for say 22050, you could just let pspaudio play at 44100, and send the
same data twice, for 11025, send it four times. Then there's no overhead
for those sample rates. Below that, I think is not evenly divisible, but does
anyone want to play music at such low quality?
Thanks. I will try it.Tinnus wrote:You could use SDL to do the audio conversion and playing. Of course SDL might slow things down a bit, although not too much, but as you're doing a player and not something of which the sound is secondary--like a game for example, I don't think a small overhead in sound output is a problem.
Your own solution might even turn out to be slower then SDL's, who knows :) I'd say try SDL and see if the speed fits your needs.
I want to play 48Khz contents.Art wrote:The most common sample rates are evenly divisible by 44100 are they not?
So for say 22050, you could just let pspaudio play at 44100, and send the
same data twice, for 11025, send it four times. Then there's no overhead
for those sample rates. Below that, I think is not evenly divisible, but does
anyone want to play music at such low quality?
You can approximate the conversion from 48kHz to 44.1kHz by skipping every 12th sample. This will introduce a small degree of inaccuracy though: a 5-minute track will be about 1.3 seconds shorter than normal, and the pitch will be increased by a vanishingly small (and probably imperceptible) amount.
If you want something more accurate, you can use fixed-point math to keep track of how many more samples you need to play before skipping one. This is how Ruckus adjusts the pitch of an MP3 (which is what you're trying to do--pitch adjustment and sample rate conversion are the same thing). Source here: http://svn.captaindan.org/ruckus/trunk/audio.c
If you want an absolutely insane level of accuracy, you can interpolate samples. But you're on your own with that. :-)
If you want something more accurate, you can use fixed-point math to keep track of how many more samples you need to play before skipping one. This is how Ruckus adjusts the pitch of an MP3 (which is what you're trying to do--pitch adjustment and sample rate conversion are the same thing). Source here: http://svn.captaindan.org/ruckus/trunk/audio.c
If you want an absolutely insane level of accuracy, you can interpolate samples. But you're on your own with that. :-)