0
0

I’ve seen this posted before but never a satisfactory answer. How is it possible to seemlessly loop MP3 files as background music. It seems there is always a gap between loops.

I’ve heard people say here that the gap exists in the MP3 file itself, which does appear to be the case, so the question is:

has anybody found an encoder that eliminates this gap (the –nogap feature of LAME doesn’t do this, it seems to be for a different purpose)

has anybody found a workaround in code?

I must say, Windows Media Player loops the sounds pretty darn well, much better than FMOD, so there must be something that could be done in the engine or in our player to improve this.

This is essentially what I am doing:

m_pSample = FSOUND_Sample_Load(FSOUND_FREE, (LPCTSTR)strFile, 0 /FSOUND_2D/, 0);
m_nChannel = FSOUND_Stream_Play( m_nChannel, (FSOUND_STREAM*)m_pSample );
FSOUND_SetPriority( m_nChannel, 255 );
FSOUND_SetPan( m_nChannel, FSOUND_STEREOPAN );
FSOUND_SetLoopMode( m_nChannel, FSOUND_LOOP_NORMAL );

  • You must to post comments
0
0

If you knew that the gap in the beginning of the file was, say, 100 ms, could you simply manually loop the file using the callbacks? When the file finishes, immediately reset the position to 100 ms from the start?

Just a thought… (Oh, and I think I remember reading that MP3’s have a seeking resolution of 26ms or close to that. So 104 ms might be a better choice.)

  • You must to post comments
0
0

unfortunately, I believe the gap is at the end of the file.

  • You must to post comments
0
0

Well, I’ve worked out a solution. I’m going to use OGG files. They loop just great.

  • You must to post comments
0
0

I’m sorry if I’m bringing up the same old question, but I’ve got an ogg file that loops fine streaming. However, the loop is in two parts: the first part and then the second part (the first part plays once then the second loops indefinately). This gives me problems as I have to use GetTime and GetLengthMs (I’m in VB and therefore don’t have the callbacks) and theres a miniscule gap inbetween. Is this something I’m going to have to live with?

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.