Mp3 looped

Blitz3D Forums/Blitz3D Beginners Area/Mp3 looped

jigga619(Posted 2003) [#1]
I know how to load a wav file and have it looped, but when I try to load and loop a mp3 sound, it plays once, then stops. Can you give me the correct code to load a mp3 sound and have it loop through the entire game.


Sunteam Software(Posted 2003) [#2]
s=LoadSound("mytune.mp3")
LoopSound s
chan=PlaySound(s)



NTense(Posted 2003) [#3]
jigga,
You may want to check and see if you have the latest update to B3D... Prior to 1.8 (I think), there was a HUGE lag between loops on the mp3 files (like 60 seconds).. This was fixed with version 1.8..


RFBcsa(Posted 2004) [#4]
This is an old post but I have also the same problem. There seems to be a bit of lag (fraction of a second) in the repetition of the sound. The strange thing is that I have 3 sounds that need to be looped (in 3 seperate parts). Now the first 2 have lag but not the last one (the biggest of the 3). Is there a solution to this?


Perturbatio(Posted 2004) [#5]
make sure there isn't a small amount of silence at the beginning and end of the samples.


RFBcsa(Posted 2004) [#6]
Well, that 3rd sound might have a delay aswell, it's hard to say unless I record the output. The sound itself has this 'sort of wait feeling' at the end of it so that's why.

I did some testing with the smaller sounds but to no avail. Making the sounds longer in length (from 8 seconds to well over a minute) did not fix the issue. The sounds loops perfectly when I use the WAVe format.


RFBcsa(Posted 2004) [#7]
Mmmm... I never knew Blitzbasic natively supports the ogg file format. But it does, and that's cool coz now the sounds loops just oh so nice.


_PJ_(Posted 2004) [#8]
Providing you have the correct codecs, you should be able to edit the mp3's using Goldwave or another sound editing tool, and trim the silence from the start/end.


RFBcsa(Posted 2004) [#9]
Malice, it is not an sample issue. The sample is perfect and it loops just mighty fine with CoolEdit. The problem is MP3 I think. It just doesn't loop very well. I tested MP3 with bass.dll only to find out it sufferd from the same problem. Now switching to the ogg format really helped. The file size is slightly bigger but the quality of the sound is so much better and... the main reason for using it... it loops perfectly.


Graythe(Posted 2004) [#10]
Both MP3 encoders that I've used so far encode a small amount of silence at the beginning and end of a recording. Trimming the MP3 doesn't work because the encoder will re-encode the silence again when writing back to disk.


_PJ_(Posted 2004) [#11]

Malice, it is not an sample issue. The sample is perfect and it loops just mighty fine with CoolEdit. The problem is MP3 I think. It just doesn't loop very well. I tested MP3 with bass.dll only to find out it sufferd from the same problem. Now switching to the ogg format really helped. The file size is slightly bigger but the quality of the sound is so much better and... the main reason for using it... it loops perfectly.



Sorry - you did mention that didn't you!



Both MP3 encoders that I've used so far encode a small amount of silence at the beginning and end of a recording. Trimming the MP3 doesn't work because the encoder will re-encode the silence again when writing back to disk.



Hmm I've never had this problem with mp3's, though it sounds reasonable.


TartanTangerine (was Indiepath)(Posted 2004) [#12]
Yep, Mp3 won't loop correctly. Use .ogg format - it's smaller and sounds better and it loops!!