I'm working on a program that I want to have some audio output. I would use System.Media.SoundPlayer, except that the data is generated dynamically and in real time. I really just want to set the speaker to a single byte value, and change that value when needed. Any buffers or streams would make this overly complicated.
Asked
Active
Viewed 594 times
1 Answers
1
You can't. System.Media.SoundPlayer
works on streams, either dynamically generated like you want or generated from a file.
Learn to work with streams. They're not complicated. Certainly less complicated then dynamically generating audio.

Samuel Neff
- 73,278
- 17
- 138
- 182
-
It's very little complication to have `Read()` overridden and return ONE sample at a time, and have `SoundPlayer` output it. – Daniel Mošmondor Apr 05 '13 at 02:29
-
@DanielMošmondor, one sample yes, but not one byte as the OP asked. `SoundPlayer` requires valid wav data and validates the header thoroughly. – Samuel Neff Apr 05 '13 at 02:44
-
Op will have to learn that audio granularity is one sample and not one byte. And wav header could easily be faked :) – Daniel Mošmondor Apr 05 '13 at 08:35