XAudio2 only play files with 44khz sample rate

For questions about using Classic.

Post » Mon May 04, 2009 7:41 pm

I don't know if this is a bug or what, but I couldn't find anything on the wiki about it.

When I try and play a file that has a sample rate less than 44khz, the music simply doesn't play.
I have no problem however playing files that ARE at 44khz sample rate.

I'm using
Start of layout -> Play music from file

The files are in .mp3 format and none of my media players have a problem playing the files (WMP, Foobar2000)

Just about to try converting the files into a 44khz sample rate.

Edit*
Converting it did the trick, it is also now a .WAV file
Should I post this again in bug reports?
B
2
G
3
Posts: 40
Reputation: 930

Post » Mon May 04, 2009 7:58 pm

'Play music' uses the same engine as Windows Media Player to play the file. Are you sure it doesn't work in WMP either? Could you send me the file so I can test it myself?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Mon May 04, 2009 8:21 pm

Sure, here's a link to the file: [url:1dz0pfm8]http://www.box.net/shared/7moiqud7eb[/url:1dz0pfm8]

It works in WMP no problem, but I do have various codec packs installed, using WMP10, XP.
B
2
G
3
Posts: 40
Reputation: 930

Post » Tue May 05, 2009 12:43 am

I tried it too and you're right, it doesn't appear to play in XAudio2. I'm not sure why. Do you know how the file was exported or created?

I'm not sure but I think the file's header information might be wrong: it says it's 160kbps, but the MP3 codec seems to think it's 107kbps. My best guess is WMP has better error correction and can figure out what the file really is from its misleading header, but XAudio2 can't. It happens in the audio engine so there's nothing I can do about it, but I think this is because the file's data is wrong. Maybe converting it or finding a program that can repair it somehow could fix the file.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Tue May 05, 2009 1:03 am

Well it's not just that file, or even that batch of files.

Any audio I've tried, be it mp3 or wav that isn't 44khz (havn't tried higher sample rates) doesn't play.
Pretty much all of the sound effects you get from a free sound effects website are less than 44khz and every one I've tried hasn't worked unless I converted it first.
[url:2o1cf7dm]http://www.partnersinrhyme.com/pir/PIRsfx.shtml[/url:2o1cf7dm]
As for the 107kbps/160kbps I suspect that's because it's encoded at a variable bitrate.

Can you get any audio to play that is less than 44khz?
B
2
G
3
Posts: 40
Reputation: 930

Post » Tue May 05, 2009 1:53 am

Probably not. XAudio2 just very simply calls on Windows Media Player's engine (Directshow) to play the file, so I guess either the MP3s are exported wrong or there's something special about WMP. If you're playing sound effects though, don't use the Play Music action - use the channel actions, it's faster and supports mixing. You can't play MP3s on channels though, so converting them to WAV is a good idea (and isn't that big a deal if they're short sound effects).
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Tue May 05, 2009 7:39 pm

[quote="Lemming":1du7sugn]Can you get any audio to play that is less than 44khz?[/quote:1du7sugn]

Just as a quick test, I made 22kHz and 44kHz .wav files, both using SFXR, and the 22kHz sound would not play. Go ahead and post a bug report, if you haven't already.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests