title: Speech to text Ibm Watson C# with long audio more than 100 MB
body: <p>I am implementing C# code in which I am trying to transcribe audio more than of 100 mb but it is not allowing me to develop that required a program that can send more than 100 mb audio in C#<br>
  In this code I am using web socket but how I can send like streaming a audio </p>
  
  <pre><code>public static void CallWatson()
  {
      using (var nf = new Notifier())
      using (var ws = new WebSocket("wss://stream.watsonplatform.net/speech-to-text/api/v1/recognize?watson-token=""))
      {
          string startActionjson = "{\"action\": \"start\", \"content-type\": \"audio/wav\", \"continuous\" : true, \"interim_results\": true}";
          ws.OnOpen += (sender, e) =&gt; ws.Send(startActionjson);
  
          // Set the WebSocket events.
          string result = string.Empty;
  
          ws.OnMessage += Ws_OnMessage;
  
  
          ws.OnError += (sender, e) =&gt;
            nf.Notify(
              new NotificationMessage
              {
                  Summary = "WebSocket Error",
                  Body = e.Message,
                  Icon = "notification-message-im"
              });
  
          ws.OnClose += (sender, e) =&gt;
            nf.Notify(
              new NotificationMessage
              {
                  Summary = String.Format("WebSocket Close ({0})", e.Code),
                  Body = e.Reason,
                  Icon = "notification-message-im"
              });
  
          ws.Connect();
  
          //ws.SendAsync(startActionjson, b =&gt;
          //{
          //    if (b == true)
          //    {
          //        //send the audio as binary
          //        string filePath = "E:\\test33.wav";
          //        byte[] bytes = System.IO.File.ReadAllBytes(filePath);
  
          //        ws.SendAsync(bytes, b1 =&gt;
          //        {
          //            if (b1)
          //                ws.Close();
          //        });
  
          //        // result+=result+ws.
          //    }
          //});
          // Connect to the server asynchronously.
          //ws.ConnectAsync ();
  
          //Console.WriteLine("\nType 'exit' to exit.\n");
          string filePath = "E:\\Test3.wav";
          byte[] bytes = System.IO.File.ReadAllBytes(filePath);
          while (true)
          {
              Thread.Sleep(3000);
  
              ws.SendAsync(bytes, b1 =&gt;
              {
                  if (b1)
                      ws.Close();
              });
  
          }
  
          //for (int i = 0; i &lt; bytes.Length; i += 1000000)
          //{
          //    Thread.Sleep(1000);
          //    byte[] buffer = new byte[1000000];
          //    Buffer.BlockCopy(bytes, i, buffer, 0, 128);
          //  //  ws.Send(buffer);
          //    ws.SendAsync(buffer, b1 =&gt;
          //    {
          //        if (b1)
          //            ws.Close();
          //    });
          //}
      }
  }
  
  private static void Ws_OnMessage(object sender, MessageEventArgs e)
  {
      string s = e.Data;
  }
  </code></pre>