This project has moved. For the latest updates, please go here.

[UWA] WaveFormat unsupported

Sep 7, 2016 at 11:02 AM
Edited Sep 7, 2016 at 11:02 AM
Hello! I'm trying to record raw data from mic and its okay, but i need to get a smaller file, so i have to reduce the frequency and switch to mono-channel.
The only way accepted is this
recorder = new WasapiCaptureRT();
recorder.WaveFormat = WaveFormat.CreateIeeeFloatWaveFormat(48000, 2);
Any other config threw an exception:
Unsupported Wave Format
at the end i would convert my raw array to mp3 (most important step probably)
Actually my raw file is like ~2mb for 10s (the records should have this duration)

I'm using Naudio.Universal for uwa, target is raspberry.
  1. How i can use a different wave form?
  2. There are an example how to convert raw to mp3?
thanks
Coordinator
Sep 8, 2016 at 9:20 PM
Unfortunately, WASAPI will not let you specify any sample rate and channel count and convert for you like WaveIn can. So you have to do this yourself after capturing the audio, which is a real pain.

However, you might want to consider using the AudioGraph API that is new to Windows 10 UWP platform, which makes it much easier to do things like this. And if you have a Pluralsight subscription (or want to sign up for a free trial), then you can watch my latest course which shows how to do this. So you might find that an easier option.