none
Virtual Microphone Driver Sample RRS feed

  • Question

  • Hi,

    I'm searching in WDK for a simple microphone driver, but I'm not sure which one to use. Which driver sample would be a good start to develop basic virtual microphone driver?

    Thanks!

    Wednesday, July 10, 2019 2:11 PM

Answers

  • The canonical sample for this is the SYSVAD sample.

    https://github.com/Microsoft/Windows-driver-samples/tree/master/audio/sysvad/TabletAudioSample/

    However, what Brian says is correct; audio drivers are complicated.  Further, Microsoft has chosen to use the sysvad sample to demonstrate every feature they've added to the audio interface, so it is not just complicated, it is baroquely and unnecessarily complicated.

    If you have access to older DDKs the MSVAD that preceeded SYSVAD is somewhat more accessible.

    https://github.com/uri247/wdk81/tree/master/Microsoft%20Virtual%20Audio%20Device%20Driver%20Sample/C%2B%2B


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Thursday, July 11, 2019 5:48 AM
  • Brian,
    are you sure that you are remembering your above mentioned "Nightmare-Experience" correctly? Wasn't your nightmare about talking to ks.sys directly without using any miniport model? I remember reading a post of you at that time (short after 2000) telling details about the (almost?) impossible approach of directly using ks.sys interfaces.

    Writing kernel mode audio drivers is actually quite easy when sticking with the miniport models (Wave-PCI, Wave-Cyclic and Wave-RT) and the above mentioned existing WDK samples MSVAD and SYSVAD.

    You probably don't want to use the audio functionality of AV/Stream miniport model sample "avssamp". It is hardly supporting any audio specific standard features. Just try to implement audio controls (e.g. volume, etc.) on it. Then you will know what I am talking about...

    WASAPI can be used to get streams from existing microphones and send streams to existing loudspeakers. However, I can't see how it could be possible to feed own sound input to applications (e.g. Skype) without a virtual audio microphone driver which can be opened by this application. But I am eager to learn if there is an option that I don't yet know of...

    PS: Just ask Google for "Virtual Audio Cable" then you will find a nice example of exactly the same kind of audio driver which the OP is asking about. It can instantaneously be used for rapid prototyping (which many of our customers actually did).
    Friday, July 12, 2019 10:59 AM

All replies

  • Why do you want to do this from kernel mode?

    I wrote one of these in the early 2000s, and out of the hundreds of drivers that I have written, it was the most difficult. Even with access to the Windows sources I couldn't figure it out. Eventually, I had to go up to Microsoft and sit down with one of the developers for a day before I understood the paradigm and how to do it. My advice is that unless you have a very compelling reason to do this in kernel mode, stick to user mode apps for dealing with audio. Also, the audio driver docs have always been the absolute worst in the WDK, and assume that you already have a great amount of knowledge of audio in general, and detailed knowledge of digital audio formats.

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog


    Wednesday, July 10, 2019 5:25 PM
    Moderator
  • The canonical sample for this is the SYSVAD sample.

    https://github.com/Microsoft/Windows-driver-samples/tree/master/audio/sysvad/TabletAudioSample/

    However, what Brian says is correct; audio drivers are complicated.  Further, Microsoft has chosen to use the sysvad sample to demonstrate every feature they've added to the audio interface, so it is not just complicated, it is baroquely and unnecessarily complicated.

    If you have access to older DDKs the MSVAD that preceeded SYSVAD is somewhat more accessible.

    https://github.com/uri247/wdk81/tree/master/Microsoft%20Virtual%20Audio%20Device%20Driver%20Sample/C%2B%2B


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Thursday, July 11, 2019 5:48 AM
  • Basicaly, I need a microphone device that could be loaded in Skype or similar app. The driver would load raw audio from stream.

    In addition, I have built avssamp sample from WDK which has audio source. Would it be possible for its audio pin to be visible as microphone in Skype?
    • Edited by iz111 Thursday, July 11, 2019 7:21 AM
    Thursday, July 11, 2019 6:02 AM
  • Unless you're specifically adding microphone hardware (ADC, amplifier, etc.), then you don't need a kernel-mode driver

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Thursday, July 11, 2019 5:17 PM
    Moderator
  • Brian,
    are you sure that you are remembering your above mentioned "Nightmare-Experience" correctly? Wasn't your nightmare about talking to ks.sys directly without using any miniport model? I remember reading a post of you at that time (short after 2000) telling details about the (almost?) impossible approach of directly using ks.sys interfaces.

    Writing kernel mode audio drivers is actually quite easy when sticking with the miniport models (Wave-PCI, Wave-Cyclic and Wave-RT) and the above mentioned existing WDK samples MSVAD and SYSVAD.

    You probably don't want to use the audio functionality of AV/Stream miniport model sample "avssamp". It is hardly supporting any audio specific standard features. Just try to implement audio controls (e.g. volume, etc.) on it. Then you will know what I am talking about...

    WASAPI can be used to get streams from existing microphones and send streams to existing loudspeakers. However, I can't see how it could be possible to feed own sound input to applications (e.g. Skype) without a virtual audio microphone driver which can be opened by this application. But I am eager to learn if there is an option that I don't yet know of...

    PS: Just ask Google for "Virtual Audio Cable" then you will find a nice example of exactly the same kind of audio driver which the OP is asking about. It can instantaneously be used for rapid prototyping (which many of our customers actually did).
    Friday, July 12, 2019 10:59 AM
  • Since I've built and try to test few different samples, which are avssamp (AV/Stream),  synth (DirectShow sample) and SYSVAD.
    The SYSVAD looks like reasonable solution since the first two are not even visible in Skype or simliar app.
    Friday, July 12, 2019 11:48 AM
  • Your memory is better than mine!  It appears that the trauma of writing that driver has caused me to forget some of the details. I dug up the old driver (written in 1999), and it was indeed written using KS. You are also correct in that using the miniport models would make life much easier. I suspect that there is a way to do what the OP wants from user-mode, using WSAPI but I may be wrong. However, as you wrote, Virtual Audio Cable works and is available, and would solve his problem. Thanks for your help Marcel!

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Friday, July 12, 2019 2:25 PM
    Moderator
  • Microsoft/Windows hardware software/drivers can be had thru.

    https://www.microsoft.com/accessories/en-us/downloads

    locate the device and install..

    Either way,go to the hardware mfg web site,or pc mfg web/downloads/install the defaults..
    Sunday, July 14, 2019 2:55 AM