i m successfully write raw data to serial port with NAudio Library here is my code,
Dim rawStream = File.OpenRead("c:\myfile.raw")
Dim waveFormat = New NAudio.Wave.WaveFormat(8000, 16, 1)
Dim rawSource = New RawSourceWaveStream(rawStream, waveFormat)
Dim buffer As Byte() = New Byte(rawSource.Length) {}
Dim n As Integer = 2
For x As Integer = 0 To buffer.Length - n - 1 Step n
Application.DoEvents()
Dim bytesRead As Integer = rawSource.Read(buffer, 0, x)
If bytesRead > 0 Then
SP1.Write(buffer, 0, bytesRead)
End If
Thread.Sleep(40)
Next
this code works fine only problem i m able to hear raw file to my mobile but play raw file very fast i use thread.sleep and application.DoEvents() but it still play very fast please guide me how to write data with normal speed
Dim rawStream = File.OpenRead("c:\myfile.raw")
Dim waveFormat = New NAudio.Wave.WaveFormat(8000, 16, 1)
Dim rawSource = New RawSourceWaveStream(rawStream, waveFormat)
Dim buffer As Byte() = New Byte(rawSource.Length) {}
Dim n As Integer = 2
For x As Integer = 0 To buffer.Length - n - 1 Step n
Application.DoEvents()
Dim bytesRead As Integer = rawSource.Read(buffer, 0, x)
If bytesRead > 0 Then
SP1.Write(buffer, 0, bytesRead)
End If
Thread.Sleep(40)
Next
this code works fine only problem i m able to hear raw file to my mobile but play raw file very fast i use thread.sleep and application.DoEvents() but it still play very fast please guide me how to write data with normal speed