怎么把byte[] 转成WAV格式的音频文件

w5223336 2010-10-18 05:33:10
如题
类型与 MemoryStream ms = new MemoryStream(Bytes); // MemoryStream创建其支持存储区为内存的流。
//MemoryStream属于System.IO类
ms.Position = 0;
Image img = Image.FromStream(ms);
ms.Close();
然后再保存在制定的路径 Bitmap bmp = new Bitmap(img);

bmp.Save(npath, img.RawFormat);
bmp.Dispose();
...全文
1145 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2010-10-18
  • 打赏
  • 举报
回复
System.IO.File.WriteAllBytes("a.wav", bytes);

protected void Button1_Click(object sender, EventArgs e)
{
byte[] bytes = GetbyteArray();
MemoryStream ms = new MemoryStream(bytes);
SoundPlayer myPlayer = new SoundPlayer(ms);
myPlayer.Play();
using (FileStream fs = File.Create("myFile.wav"))
{
fs.Write(bytes, 0, bytes.Length);
}
myPlayer = new SoundPlayer("myFile.wav");
myPlayer.Play();
}
lhzyn 2010-10-18
  • 打赏
  • 举报
回复
没有搞懂你的意思
是要这样么?
using (FileStream writeStream = new FileStream("c:\\1.wav", FileMode.Create, FileAccess.Write))
{
writeStream.Write(buffer, 0, buffer.Length);
}
w5223336 2010-10-18
  • 打赏
  • 举报
回复
本人邮箱whxsyez27126@163.com
w5223336 2010-10-18
  • 打赏
  • 举报
回复
求救啊
兄弟我快挺不住了
哪位大大弄过了谢谢分享下了

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧