Intro to WDM/KS audio filtering

Hi everyone,

I’ve been given the task of investigating a way to apply some signal
processing to the default audio input path. (I think the idea is to
process voice and sound for input to chat and game applications, etc.)
I don’t think there will be any hardware processing involved at all,
just algorithms.

I’m familiar with device drivers, but relatively new to the audio
processing world. At first glance, the WDM/KS documentation and samples
seem more complex than what I need. I assume that I need to be able to
be the default sound recording and voice recording device, so I think
this rules out a user-mode/DirectShow filter. Again, there’s no
(custom) hardware, so I think I’m looking at creating a virtual audio
device. And, I don’t need to worry about the output/rendering side of
the equation.

Can anybody recommend a place to start to at least mock up a prototype?
(Is the DDK MSVAD-simple example appropriate?) And, how much of the
likely solution will be KS/Audio specific (pins and filter graphs, etc)
and how much will be WDM filter-driver-style processing?

Thanks for any help,

David

> seem more complex than what I need. I assume that I need to be able to

be the default sound recording and voice recording device, so I think
this rules out a user-mode/DirectShow filter.

Why? With DirectShow, you go to user mode/KS only if there is some hardware.
Otherwise, stay in user mode.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi Maxim,

It’s my (vague) understanding that I will not necessarily capture all
audio input with a DirectShow filter, specifically if an app uses the
WaveIn API. I haven’t been able to verify this, however, and I don’t
know enough yet about audio programming to know the extent of this
“problem”.

I agree otherwise that staying in usermode is much preferable …

  • David

Maxim S. Shatskih wrote:

>seem more complex than what I need. I assume that I need to be able to
>be the default sound recording and voice recording device, so I think
>this rules out a user-mode/DirectShow filter.

Why? With DirectShow, you go to user mode/KS only if there is some hardware.
Otherwise, stay in user mode.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi, David,

I would start by reading a good text on signal processing. You
may need to understand a good deal of math, starting with
Sampling, Fourier Transforms, Filters, and maybe going into
Wavelets, depending on what you want to do. I don’t know if this
is still an up to date book - I haven’t done signal processing
for a while - but a good place to start may be “C Language
Algorithms for Digital Signal Processing” by Paul Embree and
Bruce Kimble, edited by Prentice-Hall, because it has source
code you can suck up. But hey, if I’m barking up the wrong tree,
just disregard this!

Another thing is, even though people may tell you it’s not ok to
do floating point on kernel side, it works, provided you take a
few precautions. OpenGL ICDs have been doing it for a while for
their software implementations of features not provided by their
hardware chips. But maybe you want to take a good look at how
the FPU hardware works, so that you can write your driver and
take full advantage of the machine’s instruction set and still
be able to live within the environment provided by the machine
and OS.

Last but not least, try going into http://developer.intel.com
and searching for “signal processing sample”, there’s a wealth
of information in there, including source code that uses the
SIMD floating point instructions to your maximum advantage!

Hope this helps,

Alberto.

----- Original Message -----
From: “David Lavo”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”

Sent: Tuesday, December 06, 2005 9:31 PM
Subject: [ntdev] Intro to WDM/KS audio filtering

> Hi everyone,
>
> I’ve been given the task of investigating a way to apply some
> signal processing to the default audio input path. (I think
> the idea is to process voice and sound for input to chat and
> game applications, etc.) I don’t think there will be any
> hardware processing involved at all, just algorithms.
>
> I’m familiar with device drivers, but relatively new to the
> audio processing world. At first glance, the WDM/KS
> documentation and samples seem more complex than what I need.
> I assume that I need to be able to be the default sound
> recording and voice recording device, so I think this rules
> out a user-mode/DirectShow filter. Again, there’s no (custom)
> hardware, so I think I’m looking at creating a virtual audio
> device. And, I don’t need to worry about the output/rendering
> side of the equation.
>
> Can anybody recommend a place to start to at least mock up a
> prototype? (Is the DDK MSVAD-simple example appropriate?)
> And, how much of the likely solution will be KS/Audio specific
> (pins and filter graphs, etc) and how much will be WDM
> filter-driver-style processing?
>
> Thanks for any help,
>
> David
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com

> It’s my (vague) understanding that I will not necessarily capture all

audio input with a DirectShow filter, specifically if an app uses the
WaveIn API.

Do you need to create a virtual microphone device which will generate the sound
stream of its own?

Or do you need to filter the existing or system-supplied microphone?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

I will need to filter the existing microphone. I would want to be able
to filter microphone input regardless of which (Wave or DirectSound) API
the chat/game/VOIP programs use.

It is acceptable to have the user specify a new (virtual) sound or voice
recording device, however, to turn on the filtering. Choosing another
device would then bypass my filter (normal operation).

– David

Maxim S. Shatskih wrote:

>It’s my (vague) understanding that I will not necessarily capture all
>audio input with a DirectShow filter, specifically if an app uses the
>WaveIn API.

Do you need to create a virtual microphone device which will generate the sound
stream of its own?

Or do you need to filter the existing or system-supplied microphone?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Thanks Alberto,

I actually hope to fob off the signal processing onto another engineer.
My job is simply to make a driver or filter that can intercept the
audio input data and present it for the application of arbitrary
(meaning, written by the other guy) transforms.

But thanks for the reminder about floating-point ops - I’ll make sure to
spec that out in my documentation.

– David

Alberto Moreira wrote:

Hi, David,

I would start by reading a good text on signal processing. You may need
to understand a good deal of math, starting with Sampling, Fourier
Transforms, Filters, and maybe going into Wavelets, depending on what
you want to do. I don’t know if this is still an up to date book - I
haven’t done signal processing for a while - but a good place to start
may be “C Language Algorithms for Digital Signal Processing” by Paul
Embree and Bruce Kimble, edited by Prentice-Hall, because it has source
code you can suck up. But hey, if I’m barking up the wrong tree, just
disregard this!

Another thing is, even though people may tell you it’s not ok to do
floating point on kernel side, it works, provided you take a few
precautions. OpenGL ICDs have been doing it for a while for their
software implementations of features not provided by their hardware
chips. But maybe you want to take a good look at how the FPU hardware
works, so that you can write your driver and take full advantage of the
machine’s instruction set and still be able to live within the
environment provided by the machine and OS.

Last but not least, try going into http://developer.intel.com and
searching for “signal processing sample”, there’s a wealth of
information in there, including source code that uses the SIMD floating
point instructions to your maximum advantage!

Hope this helps,

Alberto.

----- Original Message ----- From: “David Lavo”
> Newsgroups: ntdev
> To: “Windows System Software Devs Interest List”
> Sent: Tuesday, December 06, 2005 9:31 PM
> Subject: [ntdev] Intro to WDM/KS audio filtering
>
>
>> Hi everyone,
>>
>> I’ve been given the task of investigating a way to apply some signal
>> processing to the default audio input path. (I think the idea is to
>> process voice and sound for input to chat and game applications, etc.)
>> I don’t think there will be any hardware processing involved at all,
>> just algorithms.
>>
>> I’m familiar with device drivers, but relatively new to the audio
>> processing world. At first glance, the WDM/KS documentation and
>> samples seem more complex than what I need. I assume that I need to be
>> able to be the default sound recording and voice recording device, so
>> I think this rules out a user-mode/DirectShow filter. Again, there’s
>> no (custom) hardware, so I think I’m looking at creating a virtual
>> audio device. And, I don’t need to worry about the output/rendering
>> side of the equation.
>>
>> Can anybody recommend a place to start to at least mock up a
>> prototype? (Is the DDK MSVAD-simple example appropriate?) And, how
>> much of the likely solution will be KS/Audio specific (pins and filter
>> graphs, etc) and how much will be WDM filter-driver-style processing?
>>
>> Thanks for any help,
>>
>> David
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@ieee.org
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>

Hi Maxim,

I’m still investigating this issue, and have not yet found the best
answer. Specifically, I would much appreciate it if you (or anybody
else) has information on the following two questions:

  1. Can I insert a DirectShow filter (or DMO) into the default audio
    capture path so that audio received by third-party (or legacy) apps will
    go through my filter and get the signal processing?

  2. I have read in several other posts (including many by you, Maxim)
    about using a user-mode driver associated with winmm.dll. Is this still
    a viable approach, and if so is the only documentation on this available
    in the NT/Win95 DDKs?

Thanks a lot for any help on this,

David

Maxim S. Shatskih wrote:

>seem more complex than what I need. I assume that I need to be able to
>be the default sound recording and voice recording device, so I think
>this rules out a user-mode/DirectShow filter.

Why? With DirectShow, you go to user mode/KS only if there is some hardware.
Otherwise, stay in user mode.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

> a viable approach, and if so is the only documentation on this available

in the NT/Win95 DDKs?

It’s a good approach. It works, and it is simple. For simple tasks, it is OK.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

To your question #1. No, it is not possible.
While there are ways to inject a component in an abitrary graph, nothing prevents an app from
building graphs in totally manual fashion using direct pin connection.
In that case interscepting graph rendering is impossible unless you resort to hooking.

This leaves you with only one real alternative and that is filtering KS stack, which is completely
undocumented.
This is about as bad as hooking and subject to breaking at any moment.

Check out archieves. This has been discussed numerous times.
– Max.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-229460-
xxxxx@lists.osr.com] On Behalf Of David Lavo
Sent: Tuesday, December 13, 2005 6:01 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Intro to WDM/KS audio filtering

Hi Maxim,

I’m still investigating this issue, and have not yet found the best
answer. Specifically, I would much appreciate it if you (or anybody
else) has information on the following two questions:

  1. Can I insert a DirectShow filter (or DMO) into the default audio
    capture path so that audio received by third-party (or legacy) apps will
    go through my filter and get the signal processing?

  2. I have read in several other posts (including many by you, Maxim)
    about using a user-mode driver associated with winmm.dll. Is this still
    a viable approach, and if so is the only documentation on this available
    in the NT/Win95 DDKs?

Thanks a lot for any help on this,

David

Maxim S. Shatskih wrote:
>>seem more complex than what I need. I assume that I need to be able to
>>be the default sound recording and voice recording device, so I think
>>this rules out a user-mode/DirectShow filter.
>
>
> Why? With DirectShow, you go to user mode/KS only if there is some
hardware.
> Otherwise, stay in user mode.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@yahoo.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Yes, but this is not going to help OP do what he wanted to do.

– Max.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-229764-
xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Wednesday, December 14, 2005 7:31 PM
To: Windows System Software Devs Interest List
Subject: Re: Re:[ntdev] Intro to WDM/KS audio filtering

> a viable approach, and if so is the only documentation on this available
> in the NT/Win95 DDKs?

It’s a good approach. It works, and it is simple. For simple tasks, it is
OK.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@yahoo.com
To unsubscribe send a blank email to xxxxx@lists.osr.com