| View previous topic :: View next topic |
| Author |
Message |
fishdrop
Joined: 31 Oct 2006 Posts: 16
|
Posted: Sun Dec 31, 2006 9:44 pm Post subject: Anyone knows how to audio sampling rate conversion? |
|
|
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? |
|
| Back to top |
|
 |
Tinnus
Joined: 29 Jul 2006 Posts: 67
|
Posted: Mon Jan 01, 2007 8:56 am Post subject: |
|
|
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. _________________ Let's see what the PSP reserves... well, I'd say anything is better than Palm OS. |
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Tue Jan 02, 2007 10:48 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
fishdrop
Joined: 31 Oct 2006 Posts: 16
|
Posted: Tue Jan 02, 2007 11:19 am Post subject: |
|
|
| 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. |
Thanks. I will try it. |
|
| Back to top |
|
 |
fishdrop
Joined: 31 Oct 2006 Posts: 16
|
Posted: Tue Jan 02, 2007 11:21 am Post subject: |
|
|
| 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? |
I want to play 48Khz contents. |
|
| Back to top |
|
 |
dsn

Joined: 09 Nov 2005 Posts: 47 Location: Indianapolis, Indiana, USA
|
Posted: Wed Jan 03, 2007 12:58 am Post subject: |
|
|
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. :-) |
|
| Back to top |
|
 |
digihoe
Joined: 14 May 2005 Posts: 108
|
Posted: Fri Jan 05, 2007 12:22 pm Post subject: |
|
|
Well, there should be some way of doing it... Some videos come with 48kHz AAC, but that's AAC, but it means that atleast the hardware can produce 48kHz sound...
@dsn, fanboy alert...
I just wanted to tell that I love Ruckus, great software you have made there!
Best regards! |
|
| Back to top |
|
 |
|