This project has moved and is read-only. For the latest updates, please go here.

Getting unspecified error while executing simple command line app

Jan 22, 2015 at 11:49 PM
We have a simple command line app making use of NAUDIO.wave.
Me and my colleague, have laptops with 64 bit windows 8.1.
The app executes without issues and plays audio file on his laptop.
However, on my laptop it throws exception: Unhandled Exception: NAudio.MmException: UnspecifiedError calling waveOutOpen
It doesn't matter where it gets compiled. Same exe runs on one laptop and not on other.
Any ideas?
Feb 23, 2015 at 8:04 PM
That error is usually related to the soundcard driver. What sound device is it using? What WaveFormat are you trying to open with?
May 4, 2015 at 10:55 PM
I have a similar error occurring, with details as noted:

I have an application using Naudio 1.7.3 (or 1.7.2 with the same result) that runs fine on a laptop running Windows 7, but does not run on Windows 8.1 desktop machine using the Realtek High Definition Audio driver, quitting with the error "NAudio.MmException UnspecifiedError calling waveOutOpen"

Both the laptop and the desktop use Realtek High Definition Audio. The laptop also has ATI HDMI Audio, and the Desktop also has NVIDIA High Definition Audio, and the Desktop also has Virtual Audio Cable. But both machines are using the Realtek Drivers with the application, and the other audio devices are not being used. I still get the same error if I disable the NVIDIA devices and the Virtual Audio Cable Devices.

If I plug into the Windows 8.1 Desktop a 3 - Media USB Audio Device and make that my default device instead of the Realtek device, and if I use that device with the app instead of the Realtek device, then the code runs fine on the Windows 8.1 machine with no error and perfect audio.

My question is, why does the Realtek device not work with my code, and what can be done about it?

I have the latest drivers for all devices.

The problematic code is:
            public static BufferedWaveProvider receiveProvider2;  //this buffers receive audio to prevent clicks/dropouts
        public static MixingWaveProvider32 mixer;  //this mixes receive audio and sidetone audio into common waveOut stream
            public static Wave16ToFloatProvider receiveIEEE; //this converts PCM16 receive audio to IEEE floating point needed by mixer
            public static SineWaveProvider32 sineWaveProvider; //this is CW sidetone generator

        sineWaveProvider = new SineWaveProvider32();
                    sineWaveProvider.SetWaveFormat(48000, 1); //48kHz mono
                    sineWaveProvider.Frequency = 1000;
                    sineWaveProvider.Amplitude = 0.0f;
                    sidetonevol = (float)VolumeTrackBar.Value / (float)VolumeTrackBar.Maximum;

                    mixer = new MixingWaveProvider32();
                    receiveProvider2 = new BufferedWaveProvider(new WaveFormat(48000, 16, 1));
                    receiveProvider2.DiscardOnBufferOverflow = true;
                    receiveProvider2.BufferDuration = TimeSpan.FromSeconds(0.25);
                    receiveIEEE = new Wave16ToFloatProvider(receiveProvider2);

                    waveOut1 = new WaveOut() { DesiredLatency = 100 };
The error, as noted occurs at the waveOut1.Play() statement.

An alternate, simpler form of the code does run on BOTH machines without error:
            public static BufferedWaveProvider receiveProvider2;
        receiveProvider2 = new BufferedWaveProvider(new WaveFormat(48000,16,1));
                    receiveProvider2.DiscardOnBufferOverflow = true;
                    receiveProvider2.BufferDuration = TimeSpan.FromSeconds(20);
                    waveOut1 = new WaveOut(){DesiredLatency = 100};
Thanks in advance for your thoughts,


The detailed error message is:

NAudio.MmException was unhandled
_message=UnspecifiedError calling waveOutOpen
Message=UnspecifiedError calling waveOutOpen
   at NAudio.MmException.Try(MmResult result, String function)
   at NAudio.Wave.WaveOut.Init(IWaveProvider waveProvider)
   at KISS_Konsole.Form1.OnOffButton_Click(Object sender, EventArgs e) in f:\HPSDR_KISS_CONSOLE_Server_NEWEST\Latest - Copy\Unified\Form1.cs:line 4696
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at KISS_Konsole.Program.Main(String[] args) in f:\HPSDR_KISS_CONSOLE_Server_NEWEST\Latest - Copy\Unified\Program.cs:line 33
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()