Search code examples
c#wpfaudiomedia-playernaudio

Play and record 16-bit PCM (raw) audio bytes in WPF


Are there any standard Microsoft components that will allow the following from a WPF application:

  • Record (default) PC microphone input to 16-bit PCM audio byte array chunks, and
  • Play 16-bit PCM audio byte array chunks on the (default) PC speaker

I have tried to investigate whether I could somehow use the SoundPlayer, MediaElement or the MediaPlayer components, but I don't really think any of them fit the bill. If I'm wrong, please provide a bit of input on how to go about this.

I can use the great NAudio library by Mark Heath to accomplish it, but if at all possible I would like to avoid taking on a dependency outside of the .NET Framework.

Thanks in advance.


Solution

  • I'm afraid there's nothing built into the .NET framework to do this, which is why libraries like NAudio exist.