user1395152
user1395152

Reputation: 355

How Do I Stream Audio To Speakers In C#

I want to be able to stream a byte array directly to my speakers so that I can create sound.

I don't know where to begin.

Is it a DLL import or a memory stream?

What I want to send an array like this:

byte[] bt = {12,32,43,74,23,53,24,54,234,253,153};// example array

Upvotes: 3

Views: 2267

Answers (1)

user27414
user27414

Reputation:

You can use the SoundPlayer and play from a MemoryStream:

byte[] bt = {12,32,43,74,23,53,24,54,234,253,153};// example array
var ms = new MemoryStream(bt);
var sound = new System.Media.SoundPlayer();
sound.Stream = ms;
sound.Play();

Upvotes: 4

Related Questions