forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Anyone knows how to audio sampling rate conversion?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
fishdrop



Joined: 31 Oct 2006
Posts: 16

PostPosted: Sun Dec 31, 2006 9:44 pm    Post subject: Anyone knows how to audio sampling rate conversion? Reply with quote

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
View user's profile Send private message
Tinnus



Joined: 29 Jul 2006
Posts: 67

PostPosted: Mon Jan 01, 2007 8:56 am    Post subject: Reply with quote

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
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Tue Jan 02, 2007 10:48 am    Post subject: Reply with quote

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
View user's profile Send private message
fishdrop



Joined: 31 Oct 2006
Posts: 16

PostPosted: Tue Jan 02, 2007 11:19 am    Post subject: Reply with quote

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
View user's profile Send private message
fishdrop



Joined: 31 Oct 2006
Posts: 16

PostPosted: Tue Jan 02, 2007 11:21 am    Post subject: Reply with quote

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
View user's profile Send private message
dsn



Joined: 09 Nov 2005
Posts: 47
Location: Indianapolis, Indiana, USA

PostPosted: Wed Jan 03, 2007 12:58 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
digihoe



Joined: 14 May 2005
Posts: 108

PostPosted: Fri Jan 05, 2007 12:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group