This project has moved. For the latest updates, please go here.

NAudio read a .wav and send to socket

Feb 25, 2015 at 1:21 PM
I use this code but it send too fast sample to the listener, I want send to listener sample how is comming when I recording

      using (WaveFileReader reader = new WaveFileReader(fileName))
      {
        try
        {
          int sampleRate = reader.WaveFormat.SampleRate;
          while (reader.Position < reader.Length)
          {
            byte[] bytes = new byte[sampleRate];
            int bytesRead = reader.Read(bytes, 0, sampleRate);
            audiosocket.Send(bytes, 0, bytesRead, SocketFlags.None);
            
          }
        }
        catch (Exception ex)
        {
          
   
        }  
      }
Coordinator
Feb 27, 2015 at 6:40 AM
create a timer that ticks say 10 times a second and then send just 100ms seconds of the audio when the timer ticks