audio input stream

Hi everybody,

I need to find a way to alter the audio streaming from a microphone in the
system, transparently to the application that uses the device. I want to
apply some effects on the audio from the microphone (like reverb noise
cancellation, etc.) and have the globally available in the system.

I’ve tried to filter the audio device in the system with an upper filter
driver, but all I get are the properties for the audio format and
capabilities, it seems that the audio stream somehow skips the driver stack.
I am getting the frames only if I open the device from “WDM Streaming
Capture Devices” when I build the audio graph. From what I’ve read, this is
the way the audio stack was designed to work.

Is there a way to intercept the audio stream before it gets to the
application that uses the device? Does Windows provide a way to implement a
filter (user mode or kernel mode) for this purpose?

Could anyone give me some suggestions?
Thanks,
Bogdan Dinu

Hi,
I can’t give you much help I’m afraid but I am interested in any
prospective answers you may receive. I attempted something similiar to this
under a 2.6 custom config low latency Linux kernel some years ago and found
my biggest problems at the time were latency issues. Sorry for the purely
conversational email but I am interested.

C

On 8/13/07, Bogdan Dinu wrote:
>
> Hi everybody,
>
> I need to find a way to alter the audio streaming from a microphone in the
> system, transparently to the application that uses the device. I want to
> apply some effects on the audio from the microphone (like reverb noise
> cancellation, etc.) and have the globally available in the system.
>
> I’ve tried to filter the audio device in the system with an upper filter
> driver, but all I get are the properties for the audio format and
> capabilities, it seems that the audio stream somehow skips the driver
> stack.
> I am getting the frames only if I open the device from “WDM Streaming
> Capture Devices” when I build the audio graph. From what I’ve read, this
> is
> the way the audio stack was designed to work.
>
> Is there a way to intercept the audio stream before it gets to the
> application that uses the device? Does Windows provide a way to implement
> a
> filter (user mode or kernel mode) for this purpose?
>
> Could anyone give me some suggestions?
> Thanks,
> Bogdan Dinu
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Dorothy Mantooth is a saint!!!

On Mon, Aug 13, 2007 at 12:13:58PM +0300, Bogdan Dinu wrote:

I need to find a way to alter the audio streaming from a microphone in the
system, transparently to the application that uses the device. I want to
apply some effects on the audio from the microphone (like reverb noise
cancellation, etc.) and have the globally available in the system.

I've tried to filter the audio device in the system with an upper filter
driver, but all I get are the properties for the audio format and
capabilities, it seems that the audio stream somehow skips the driver stack.

Not exactly. If you follow the ioctls, you'll see an IOCTL_KS_HANDSHAKE
in there. Ks.sys and the audio driver use this ioctl to exchange a set
of function pointers, and it is those function pointers that implement
the audio input function. To my knowledge, the format and purpose of
the functions is not documented.

I am getting the frames only if I open the device from "WDM Streaming
Capture Devices" when I build the audio graph. From what I've read, this is
the way the audio stack was designed to work.

Is there a way to intercept the audio stream before it gets to the
application that uses the device? Does Windows provide a way to implement a
filter (user mode or kernel mode) for this purpose?

There is no single solution to this. For usbaudio devices, it's easy
enough to create a lower filter to capture the raw streaming audio.
For non-USB devices, a more clever solution may be required.

Tim Roberts, xxxxx@probo.com
Providenza & Boeklheide, Inc.

I’ve seen the IOCTL_KS_HANDSHAKE but did not give it too much attention.
Maybe I can get something useful from it after all. I’ll dig into it.
Thanks.

wrote in message news:xxxxx@ntdev…
> On Mon, Aug 13, 2007 at 12:13:58PM +0300, Bogdan Dinu wrote:
>>
>> I need to find a way to alter the audio streaming from a microphone in
>> the
>> system, transparently to the application that uses the device. I want to
>> apply some effects on the audio from the microphone (like reverb noise
>> cancellation, etc.) and have the globally available in the system.
>>
>> I’ve tried to filter the audio device in the system with an upper filter
>> driver, but all I get are the properties for the audio format and
>> capabilities, it seems that the audio stream somehow skips the driver
>> stack.
>
> Not exactly. If you follow the ioctls, you’ll see an IOCTL_KS_HANDSHAKE
> in there. Ks.sys and the audio driver use this ioctl to exchange a set
> of function pointers, and it is those function pointers that implement
> the audio input function. To my knowledge, the format and purpose of
> the functions is not documented.
>
>> I am getting the frames only if I open the device from “WDM Streaming
>> Capture Devices” when I build the audio graph. From what I’ve read, this
>> is
>> the way the audio stack was designed to work.
>>
>> Is there a way to intercept the audio stream before it gets to the
>> application that uses the device? Does Windows provide a way to implement
>> a
>> filter (user mode or kernel mode) for this purpose?
>
> There is no single solution to this. For usbaudio devices, it’s easy
> enough to create a lower filter to capture the raw streaming audio.
> For non-USB devices, a more clever solution may be required.
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boeklheide, Inc.
>

A caveat- a WaveRT audio miniport (available as a design option on Vista and later) will have no stream accessible from the kernel. A common buffer is allocated and mapped into a secure user-mode service. The kernel driver basically handles start / stop / pause and reports stream position (and IIRC, if the position register is also memory-mapped, it doesn’t even have to do that). All the streaming occurs in user mode for these devices.

You probably won’t see any handshakes on other audio technologies in Vista either, because there are no more graphs built in the kernel for virtual devices- the mixer, midi emulation, and other functions have all gone to user mode. You should see KS streaming IRPs going to the non-RT devices, though.

You might also try the wdm audio mailing list if you haven’t already done so.

(The above is in addition to Tim’s info- I’m not contradicting any of it).

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bogdan Dinu
Sent: Tuesday, August 14, 2007 1:09 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] audio input stream

I’ve seen the IOCTL_KS_HANDSHAKE but did not give it too much attention.
Maybe I can get something useful from it after all. I’ll dig into it.
Thanks.

wrote in message news:xxxxx@ntdev…
> On Mon, Aug 13, 2007 at 12:13:58PM +0300, Bogdan Dinu wrote:
>>
>> I need to find a way to alter the audio streaming from a microphone in
>> the
>> system, transparently to the application that uses the device. I want to
>> apply some effects on the audio from the microphone (like reverb noise
>> cancellation, etc.) and have the globally available in the system.
>>
>> I’ve tried to filter the audio device in the system with an upper filter
>> driver, but all I get are the properties for the audio format and
>> capabilities, it seems that the audio stream somehow skips the driver
>> stack.
>
> Not exactly. If you follow the ioctls, you’ll see an IOCTL_KS_HANDSHAKE
> in there. Ks.sys and the audio driver use this ioctl to exchange a set
> of function pointers, and it is those function pointers that implement
> the audio input function. To my knowledge, the format and purpose of
> the functions is not documented.
>
>> I am getting the frames only if I open the device from “WDM Streaming
>> Capture Devices” when I build the audio graph. From what I’ve read, this
>> is
>> the way the audio stack was designed to work.
>>
>> Is there a way to intercept the audio stream before it gets to the
>> application that uses the device? Does Windows provide a way to implement
>> a
>> filter (user mode or kernel mode) for this purpose?
>
> There is no single solution to this. For usbaudio devices, it’s easy
> enough to create a lower filter to capture the raw streaming audio.
> For non-USB devices, a more clever solution may be required.
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boeklheide, Inc.
>