XAudio2 only play files with 44khz sample rate

This forum is currently in read-only mode.
From the Asset Store
Convert multiple Excel files into JSON files and import them into construct3.
  • 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?

  • '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?

  • Sure, here's a link to the file: http://www.box.net/shared/7moiqud7eb

    It works in WMP no problem, but I do have various codec packs installed, using WMP10, XP.

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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    http://www.partnersinrhyme.com/pir/PIRsfx.shtml

    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?

  • 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).

  • Can you get any audio to play that is less than 44khz?

    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)