Gap in loop

For questions about using Classic.

Post » Mon Jan 05, 2009 2:46 am

Hi! Is there an bug in the xAudio? Or is there something I dont get.
Rendered out this loop from FLstudio, and I cant find any gap in the mp3file.
Is there any way to improve this?

[url:1dmk3q0d]http://shadow-embryo.com/cap/musicgap.zip[/url:1dmk3q0d]
B
33
S
15
G
6
Posts: 242
Reputation: 4,343

Post » Mon Jan 05, 2009 10:06 am

With "play music", the xAudio2 plugin pauses to reload the file -- the so-called "loop music" is more of a "start over as soon as the computer feels that now would be a nice time for it".

You can "load resource to channel (+loop)" and "play channel" for gapless looping, but that won't work with an mp3 file.

In any case, mp3 is a bad format for gapless looping: because it was originally designed for video soundtracks, it only supports lengths of multiples of ... 1/24 second or some such video frame rate. If you encode a sound of any other length to mp3, the end is padded with silence to the next frame boundary; so even with perfectly gapless looping, most mp3 files you can produce will have a gap encoded right into the sound data.

In summary: sorry, I can't solve your problem unless you can make a _really short_ loop, save it as .wav and use it as a "sound" rather than "music".
B
2
S
1
G
4
Posts: 60
Reputation: 1,320

Post » Mon Jan 05, 2009 1:05 pm

Awww :(

But thanks for the clear explaination :)
B
33
S
15
G
6
Posts: 242
Reputation: 4,343

Post » Mon Jan 05, 2009 1:29 pm

or you could download audacity (free) and edit the mp3 file to remove the silence at the end AND the beginning of the track ...
B
2
S
2
G
5
Posts: 293
Reputation: 2,236

Post » Mon Jan 05, 2009 6:02 pm

Directshow (the API behind Play Music) doesn't seem to support looping directly, so I've implemented looping music as checking on a timer if the music has stopped, and if it has, restarting it. Obviously this will never be seamless. If you want seamless, go for OGG, or an xWMA encoded WAV, and play it looping on a reserved channel.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Mon Jan 05, 2009 8:34 pm

Thanks for the info :)
Ogg works much better.
Too bad you have to instal codecs on other machines to make it work.
But this is not the case with xWMA?
B
33
S
15
G
6
Posts: 242
Reputation: 4,343

Post » Mon Jan 05, 2009 8:45 pm

WMA is the Windows sound format, so it should play on any Windows machine without problems.

I should really check out OGG, I have no knowledge of how it works. Does it require caching? How is the file size and performance compared to MP3? Can you just drop a .dll for the OGG codec or something into the application directory or would you have to use an installer?

The only thing I really know about OGG is you don't have to pay to license it like you do MP3 if you're selling your game.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Jan 05, 2009 8:57 pm

I think you're both getting confused, read the docs on XAudio2 where it's all spelled out.

You don't need any special codecs to load and play OGG files on a channel, it's built in. (You would need the Windows Media Player codec if you used the 'Play Music' action, because 'Play Music' plays via Windows Media Player). OGG is probably slightly superior in audio quality and compression compared to MP3, but only because MP3 is actually really crap but the whole world insists on keeping on using it.

xWMA is a special, and rather confusingly named, format for .WAV files. It's based off a stripped down version of the WMA codec. So xWMA and WMA are different things. You don't need a codec to load any of the formats to a channel, xWMA and ADPCM are natively supported by XAudio2. Sadly, I don't know of any popular software which can create xWMA format WAV files.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Mon Jan 05, 2009 9:04 pm

Ah okay. I guess I was confused :P
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Jan 05, 2009 9:19 pm

Ogg is perfect for Construct, its open source, and smaller than mp3.
Dbpoweramp is a pretty good converter that does a ton of codecs.
[url:3n5chpwg]http://www.dbpoweramp.com/[/url:3n5chpwg]
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests