I use NAudio to capture the audio signal from my string in the device into an array of bytes. I can successfully send this byte array through my WLAN via UDP broadcast and receive it on another computer. Once the byte array has been received, I can play the audio stream.
My goal is to transmit an audio signal from a string on a device so that it can be used with an HTML5 tag or jPlayer . Do you have an example or reading material on how to convert an input byte array to a stream as a compatible HTML5 format?
I would like to create a .NET solution without using third-party applications.
Here is an example of how I capture and transmit audio over UDP.
var waveIn = new WaveInEvent();
waveIn.DeviceNumber = deviceID;
waveIn.WaveFormat = Program.WAVEFORMAT;
waveIn.BufferMilliseconds = 50;
waveIn.DataAvailable += OnDataAvailable;
var udpSender = new UdpClient();
udpSender.JoinMulticastGroup(Program.MulticastIP);
waveIn.StartRecording();
private void OnDataAvailable(object sender, WaveInEventArgs e)
{
udpSender.Send(e.Buffer, e.BytesRecorded, Program.EndPoint);
}