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 

Sound: perfect loop

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



Joined: 17 Nov 2006
Posts: 28

PostPosted: Tue May 27, 2008 7:38 pm    Post subject: Sound: perfect loop Reply with quote

Hi,

I have a really hard time figuring out how to make a sound loop perfectly. I tried OSLib's inbuilt functions with BGM (oslib special sound format) and MP3, and I can always hear the gap between 2 loops. I searched other ways to play my MP3 in a loop and got a bit lost... I *think* all MP3 players do it the same way: they fill a buffer of a predefined size with decoded frames and when at the end of the file, fill the rest of the buffer with 0's, thus the non perfect looping I get.

Does something exist that would play my sound in a perfect loop? I need something with the source available or appropriate hooks because I want to synchronize other objects with the sound, and of course I want it to be compatible with all PSP FW versions.
As I'm pretty sure nothing like that is available, can someone teach me / help me with writing such a thing, as I'm very uncomfortable with so low-level & C (not ++) code.

If you want to test, here is the MP3 I use: http://www.newgrounds.com/audio/listen/59771
It loops perfectly in Itunes & winamp (but not in this flash app).

Thanks.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Wed May 28, 2008 2:52 am    Post subject: Reply with quote

MP3 is NOT gapless. LAME encoded MP3s include metadata in the MP3's tags which indicate the exact length of the song. Only players that support reading this metadata will stop playback at the exact moment, while others will play till the padding is over.

Use AT3 files for gapless.
Back to top
View user's profile Send private message
daaa57150



Joined: 17 Nov 2006
Posts: 28

PostPosted: Wed May 28, 2008 4:34 pm    Post subject: Reply with quote

Ok thanks, I'll see if I can make an AT3 file loop correctly.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Wed May 28, 2008 7:15 pm    Post subject: Reply with quote

Quote:
MP3 is NOT gapless

WHAT??? What are you guys speaking about?? Every compression technique under the sun does divide data into chuncks; it's up to the decoder to present data continuously. If i correctly understand the original question, the clue is on buffering techniques: i pointed out the lack of proper buffer handling in pspsdk sound library time ago. However, double and triple buffering are not necessarly related to PSP: i bet you'll have better luck finding out how to implement such techniques in a general purpose programming site.
Back to top
View user's profile Send private message
daaa57150



Joined: 17 Nov 2006
Posts: 28

PostPosted: Wed May 28, 2008 7:46 pm    Post subject: Reply with quote

So it really is a buffer problem..
If I manage to write an mp3player with proper buffer handling, (ie: when at the end of the MP3 file, continue with the start of the file), it will be fine then?
If so, I was right and I need some help!
Back to top
View user's profile Send private message
daaa57150



Joined: 17 Nov 2006
Posts: 28

PostPosted: Fri May 30, 2008 7:41 pm    Post subject: Reply with quote

sorry to bother again, but could someone share a recent compiled lib mad (.a and .h)? I still have no connection at home and can't access any svn from my work.
I can give you my mail by PM.

Thanks.
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