Convert byte array to wav file in C#
Posted
by Eyla
on Stack Overflow
See other posts from Stack Overflow
or by Eyla
Published on 2010-04-19T05:41:27Z
Indexed on
2010/04/19
5:53 UTC
Read the original article
Hit count: 1018
Greetings, I'm trying to play a wav sound that stored in byte array called bytes. I know that I should convert the byte array to wav file and save it in my local drive then called the saved file but I was not able to convert the byte array to wav file.
please help me to give sample code to convert byte arrary of wav sound to wav file.
here is my code:
protected void Button1_Click(object sender, EventArgs e)
{
byte[] bytes = GetbyteArray();
//missing code to convert the byte array to wav file
.....................
System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer(myfile);
myPlayer.Stream = new MemoryStream();
myPlayer.Play();
}
© Stack Overflow or respective owner