playing wav using byte

Apr 22 at 12:51 PM
Hi, can I know how to play a wav file by byte using Naudio?
Apr 22 at 1:18 PM
By deafault Naudio play wav file.
Apr 22 at 2:48 PM
Sorry I should be more specify. I have read a wav file in a byte array. How I play specific part of the wav by selecting few byte from that byte array? Hope you understand my question
Apr 24 at 9:31 AM

this Sample Code should help you to play a Wave File from Bytearray and specified position:
Imports NAudio.Wave
Imports System.IO

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim WaveOut As New WaveOut() 'Class WaveOut uses WaveOutOpen to open a audio device.

        Dim WaveStream As New WaveFileReader(New MemoryStream(My.Resources.Tune)) 'Create a Waveprovider,
        ' in this case a Stream called WaveStream and pass your song to it.

        WaveOut.Init(WaveStream) 'Use the Init function, to prepare playback. NAudio will call WaveOutPrepareHeader internally for you,
        'but keep in mind, that NAudio needs the COMPLETE WaveFile at this point including the header. So DON´T set a position here!

        WaveStream.Position = 2000000 'Now you can specify a position in your WaveStream.
        'Alternatively use ",SeekOrigin.Begin)" here.

        WaveOut.Play() 'Let NAudio play the stream. It will do the tricky work for you, including callback, writing the audio blocks with
        'WaveOutWrite and enqueing them using several buffers to recieve a fluent playback.
    End Sub

End Class
Best regards