Playing wave files in Windows 10 with sharpdx, C# and XAML

Datetime:2016-08-23 03:56:39         Topic: C#          Share        Original >>
Here to See The Original Article!!!

After trying the MediaElement in a Windows 10 Universal App, it seems it is still not the best choice for playing (fire-and-forget) wav files . It pops, clicks and cuts off samples. At least on my Windows 10 Technical Preview (Build 10061).

Native Direct X, shown in anearlier post, still works in a Windows 10 App, but I'd rather useSharpDX. The latest SharpDX (version 2.6.3) works in Windows 10.

You can download an updated project from Git. It is a Windows 10 (UAP) project and the Audio part is isolated in a separate UAP class library. This allows you to add the Audio project to your solution and use it like this:

private IWavePlayer _wavePlayer;

private async void MainPage_Loaded(object sender, RoutedEventArgs e) {
  _wavePlayer = new WavePlayer();
  await _wavePlayer.LoadWaves(Package.Current.InstalledLocation.Path + @"\Assets\Audio");

private void Button_Click1(object sender, RoutedEventArgs e) {

The LoadWaves method loads all the files in Assets/Audio and assumes they are WAV-files.

I hope this helps you to quickly implement wave playing in your App!


Put your ads here, just $200 per month.