IEnumerator ConvertAndSend(float[] samples, int hz, int channels) { Log.Debug("SpeechListener.ConvertAndSend()", "samples: {0}", samples.Length); byte[] file; // convert samples to wav format (basically, add headers) using (MemoryStream wav = SavWav.CreateWav(samples, hz, channels)){ yield return(wav); file = wav.ToArray(); } // send the file through the chatsocket interface _cs.SendAudio(file); }