"vshost32.exe has stopped working" MOTU+Naudio

Feb 8, 2012 at 9:44 AM

Hi all!

Im pretty fresh at this, but I cant get DSebJs tutorial to work (http://opensebj.blogspot.com/2009/02/introduction-to-using-naudio.html) in other then ASIO4ALL and with 16-bit wave-files.

If I use ASIO4ALL and 16-bit files, the program code below works. But the target audiointerface (MOTU UltraLite) crashes and the reason stated is:

"vshost32.exe has stopped working"

Problem signature:

Problem Event Name: BEX
Application Name: AudioViaASIO.vshost.exe
Application Version: 11.0.40825.2
Application Timestamp: 4e55ba46
Fault Module Name: StackHash_3ce7
Fault Module Version:
Fault Module Timestamp: 00000000
Exception Offset: 05aaec0c
Exception Code: c0000005
Exception Data: 00000008
OS Version: 6.1.7601.
Locale ID: 1053
Additional Information 1: 3ce7
Additional Information 2: 3ce712e06389c7274746ad5f0c1dc1c9
Additional Information 3: 1835
Additional Information 4: 1835a9d5b62f304ea03f41ed661569d9

Am I missing something basic here? Please help me!!

 Regards / soundBerg


The tutorialbased code I have tried:

using System;
using System.Windows.Forms;
using NAudio.Wave;
using NAudio.CoreAudioApi;

namespace WindowsFormsApplication1


public partial class Form1 : Form

public Form1()
IWavePlayer waveOutDevice;
WaveStream mainOutputStream = null;
string fileName = "C:\\sinus16bit.wav";

          waveOutDevice = new AsioOut();*

catch (Exception driverCreateException)
MessageBox.Show(String.Format("{0}", driverCreateException.Message));

        if (fileName != null)
mainOutputStream = CreateInputStream(fileName);
catch (Exception initException)
MessageBox.Show(String.Format("{0}", initException.Message), "Error Initializing Output");

private WaveStream CreateInputStream(string fileName)
WaveChannel32 inputStream;
if (fileName.EndsWith(".wav"))
WaveStream readerStream = new WaveFileReader(fileName);
if (readerStream.WaveFormat.Encoding != WaveFormatEncoding.Pcm)
readerStream = WaveFormatConversionStream.CreatePcmStream(readerStream);
readerStream = new BlockAlignReductionStream(readerStream);
if (readerStream.WaveFormat.BitsPerSample != 16)
var format = new WaveFormat(readerStream.WaveFormat.SampleRate,16, readerStream.WaveFormat.Channels);
readerStream = new WaveFormatConversionStream(format, readerStream);
inputStream = new WaveChannel32(readerStream);
                        throw new InvalidOperationException("Unsupported extension");
                return inputStream;



Feb 8, 2012 at 10:00 AM

What version of NAudio are you using? The ASIO support in NAudio is working much better than it used to, but it wouldn't surprise me if there are still some interfaces it has problems with. ASIO has many different ways of presenting the samples to the interface, so it might be that your interface uses one that hasn't been well tested yet.

Do you need to be using AsioOut, or would WaveOut or DirectSoundOut work for you instead?


Feb 8, 2012 at 11:28 AM

Yes, I think I need to use ASIO since I must be able to set a fixed latency. The software im developing has to timestamp exactly when the sound occurs and stops, and I dont I can rely on WaveOut or DirectSoundOut for this, please correct me if im wrong?!

I use NAudio 1.5 (lastest) and latest MOTU ASIO-driver. Here my latest strange findings.

1) If I run NAudio demoapps I can play both 16/24-bits PCM waves though MOTU ASIO driver. This means that im missing out something in "my" code, compared to how NAudio-demo handles the 24-bit files.

2) I can now get "my" program to run, if I via ASIO4ALL play through the MOTU audio interface. But I much rather use the "native" ASIO drivers since ASIO2ALL stutters sometimes and I dont want that to happen on 4 month old infants ;-) (the software is a prototype of a hearing threshold test for infants).

Feb 8, 2012 at 11:39 AM

what WaveFormat are you giving to AsioOut? The demo/apps have a direct mode that will send 16/24 bit as-is to the ASIO out, but you can also go to IEEE float and give that directly to it. If you can build and debug the NAudio source code, you can see what sampleconverter is being selected

Feb 8, 2012 at 11:56 AM
Edited Feb 8, 2012 at 11:58 AM

Im using the NAudio.dll, I have not built the NAudio source code myself, get too many errors I dont understand.

If the question is what wave-file-format im using it's Wave(Microsoft), Uncompressed PCM, 16 or 24-bits 44.1 kHz Mono.

Sorry for my lack of knowledge in this area :(

Feb 8, 2012 at 11:57 AM
Edited Feb 8, 2012 at 12:00 PM
Feb 12, 2012 at 2:04 PM

I would suggest that you try opening the ASIO driver in stereo.