How can I play a sound based on waveform data that my .NET program is generating from user input and mathematical functions?
By “waveform data” I mean SPL (sound pressure level) values in a fixed interval time-series (probably 44.1 kHz). I presume that this requires some kind of streaming buffer arrangement.
Note, that this has to be live/real-time, so just creating a .wav file and then playing that will not be sufficient. VB.NET is preferred, but C# is acceptable also.
Just to clarify: What I am looking for is a simple working code example.
You can do this using NAudio. You create a stream that derives from WaveStream and in its overriden Read method, you return your samples which you can generate on the fly. You have control over the size of the buffers used by the soundcard which gives you control over the latency.