XAudio2 play wave like windows media player

Last post 05-15-2008, 7:07 PM by Dugan. 2 replies.
Sort Posts: Previous Next
  •  05-07-2008, 2:19 AM

    XAudio2 play wave like windows media player

       Hi,

    i want to play a wave file using XAudio2.

    I want the quality to be the same as double clicking the wave file and playing it using windows media player.

    Should i add any reverb effect defaults?

    When i am using the standard sample "XAudio2BasicSound" i am noticing a little differences.

    I dont use EQ or any other special feature in the windows media player.

     

    Thanks

  •  05-09-2008, 7:33 PM

    Re: XAudio2 play wave like windows media player

    XAudio2 is an API aimed at games, so it needs to be able to handle multiple voices better, as in hundreds of voices at a time. Windows Media Player plays one voice, so it can use a much higher quality, but much more CPU intensive, samplerate converter without worrying about CPU issues. That's a possible reason the quality seems different. It's a trade off, and not a small one when you consider the number of voices we expect XAudio2 to be able to handle.

    Another reason could simple be that the playback levels are exactly the same, or WMP is doing a bit of sweetening even if every effect seems to be off. We often hear that something played in WMP doesn't sound the same as it does in other apps, regardless of what the other app is. This isn't limited to using XAudio2.

    There are a lot of reasons that can cause WMP, or other apps, to sound a bit different that have little to do with the underlying code. Until those are eliminated out we can only speculate.

  •  05-15-2008, 7:07 PM

    Re: XAudio2 play wave like windows media player

    Phoo is exactly right.  I would add that the quality difference is more noticeable if you are playing very low sample rate files (e.g. 11025Hz) - though there will be some improvements to that in a future XAudio2 release.  (Remember that we support over a thousand simultanous voices on some machines, so performance is critical, and sample rate conversion is usually the most CPU-intensive job in any audio engine.)

    However, if your app only needs to play one sound, or a bunch of sounds at the same sample rate, there is a trick which will make it sound much better, on XP at any rate: make sure that your entire graph runs at this sample rate.  In other words, create your mastering voice and any submix voices you may be using at the same sample rate as your source material.  This will leave the SRC up to the underlying OS audio stack (in this case kmixer.sys), which will do a very good job of it (particularly if you max out the SRC quality slider in mmsys.cpl/audio/advanced/performance).

    Dugan Porter [MS]
    Game Audio Team


    Dugan Porter [MS]
    Game Audio Team
View as RSS news feed in XML
©2007 Microsoft Corporation. All rights reserved. Privacy Statement Terms of Use Code of Conduct Feedback