Manipulating audio with AudioSwitcher.AudioApi.CoreAudio

The AudioSwitcher.AudioApi.CoreAudio nuget package allows you to easily manipulate audio devices.

Install-Package AudioSwitcher.AudioApi.CoreAudio

To mute/unmute my microphone I can use this library to access my capture devices and change their state. A full example can be found on my Github.

2015-40-19 01-40-57-970

To access my devices I need to create a CoreAudioController and from it I have access to methods that handles everything else. I can use GetCaptureDevices to get all my capture devices, but in this case I only want the default and active one.

public CoreAudioController Controller { get; }
    = new CoreAudioController();

public CoreAudioDevice MicDevice
        return Controller
            .FirstOrDefault(o => o.IsDefaultDevice);

Having the device I can call the Mute method. It requires a parameter to tell if the device should be muted or unmuted:

MicDevice.Mute(true);  // mute
MicDevice.Mute(false); // unmute

For more information on this API you can check their Github.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s