Play a Byte Array

Dec 7, 2014 at 5:30 PM
Hi, I have a Programm that records my Soundcard.

Over the Network I used a second Programm, that recive the data (as Byte Array).
This wirks great!
(Programm 1 records and sends the data over the Network to the second programm. In the second Programm I write the data Array to a WAV File; works).

But I want to Play the recorded data from programm 1!

So here my question:
How I can play a "changing" Byte Array? (Without to write every new part to a File and play the File.)
(Currently I have a List from byte Arrays to add the new data from programm 1)
I think it's possible to create a big data Arry from this list. And then I want to play the big Array.

(Sorry for my English, I only speak German)
Coordinator
Dec 7, 2014 at 5:39 PM
You can use the CSCore.Streams.WriteableBufferingSource class. You need to specify the format of the data you want to play. It will discard the played data automatically so your memory usage won't exceed a certain level (optionally you can specify it > see ctor of WriteableBufferingSource class).
In summary:
Create a new instance of the WriteableBufferingSource class. Write the data you recieve over the network into that buffer. Initialize the soundout with that buffer. If you compress/encode the data you are sending, you have to decompress the data yourself. The WriteableBufferingSource won't decompress any data for you.
Marked as answer by filoe on 2/19/2015 at 3:27 PM
Feb 18, 2015 at 3:44 PM
Edited Feb 18, 2015 at 4:47 PM