C#wave文件不可用? [英] C# wave file is not vaild?

查看:285
本文介绍了C#wave文件不可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码

this is my code

private void PlayPause_Click(object sender, EventArgs e)
  {
      System.Media.SoundPlayer player = new System.Media.SoundPlayer();

      player.SoundLocation = "Z:\MUSIC\test.mp3";
      player.Play();
  }



这是我的错误
The file located at Z:\MUSIC\test.mp3 is not a valid wave file.



and this is my error
The file located at Z:\MUSIC\test.mp3 is not a valid wave file.

Can some one please help me?

推荐答案

否.
System.Media.SoundPlayer不支持MP3文件-它仅支持WAV文件.
您将需要使用WindowsMediaPlayer实例代替: http://msdn.microsoft.com/en-gb/library/windows/desktop/dd562388(v=vs.85).aspx [
No.
System.Media.SoundPlayer does not support MP3 files - it only supports WAV files.
You will need to use a WindowsMediaPlayer instance instead: http://msdn.microsoft.com/en-gb/library/windows/desktop/dd562388(v=vs.85).aspx[^]


消息是清除:您正在尝试使用只能播放WAV文件的System.Media.SoundPlayer播放MP3文件.
音频文件格式为
MP3 [ ^ ]和 WAV [
The message is clear: you are trying to play a MP3 file with the System.Media.SoundPlayer that can only play WAV files.
The audio files formats MP3[^] and WAV[^] are very different.
You might, for instance, convert your MP3 file into a WAV one and then use the SoundPlayer to play it,


这篇关于C#wave文件不可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆