Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have speakers and a USB headset (G35). I want to easily switch between thous two playback devices without having to go to Playback devices and change the default playback device manually. Preferredly using the G-keys.

share|improve this question

2 Answers 2

Getting started

First you need to download NirCmd. It doesn't require any installation.

NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface.

NirCmd has a nifty command called setdefaultsounddevice which we need.

Manpage

setdefaultsounddevice [Device Name] {Role}

Set the default sound device on Windows 7/Vista/2008. The [Device Name] is the name of the device, as appeared in the sound devices list of windows, for example: Speakers, Line In, Microphone, and so on... The {Role} parameter is optional and may countain one of the following values: 0 for Console (the default value), 1 for Multimedia, and 2 for Communications.

Once you've downloaded the program you can put it in either your windows folder or a folder of your choosing. If you put it in your windows folder you don't have to know the location of the nircmd.exe file. More on that later.

Finding [Device Name]

Now we need to find your [Device Name]. Go to: Control Panel\Hardware and Sound\Sound and locate your devices. They'll most likely be called Speakers.

Playback devices

You'll need to change one of the names. I prefer to change the onboard sound device because once you unplug USB headset and plug it back in the device name will have reset to Speakers. You rename a device by choosing properties on the device and typing in the name you want in the top field.

Device properties

When that's done you should have two playback devices, one called Speakers (headset) the other LoudSpeakers.

Using NirCmd

We can now use NirCmd to switch to the desired device. Like so:

> nircmd.exe setdefaultsounddevice Speakers

However I found that Skype (In my case) doesn't change when this is run. So we need to use the optional {Role} parameter as well.

> nircmd.exe setdefaultsounddevice Speakers
> nircmd.exe setdefaultsounddevice Speakers 2

Luckily NirCmd support scripts. So lets create two scripts one that switches to our speakers and one that switches to our headset.

SwitchToHeadset.ncl:

setdefaultsounddevice "Speakers"
setdefaultsounddevice "Speakers" 2

SwitchToSpeakers.ncl:

setdefaultsounddevice "LoudSpeakers"
setdefaultsounddevice "LoudSpeakers" 2

You can create these using Notepad. They're just text files with a .ncl extension instead of .txt. Put them in a convenient location. We'll need the shortly.

Switch playback device using the Logitech G keys

Depending on your decision where to place the nircmd.exe file the following may differ. I'll be using the solution where I don't place nircmd.exe in the windows folder.

Now you need to go to the Logitech Gaming Software (driver) to bind your G keys to these scripts. Select the button you want to bind and choose Shortcut, choose an appropriate name and type in the path to nircmd.exe and the .ncl script in want to run.

"X:/Audio switch/nircmd.exe" script "X:/Audio switch/SwitchToSpeakers.ncl"

Remember to bind both SwitchToHeadset and SwitchToSpeakers.

G key layout

You're done! Enjoy.

share|improve this answer
    
One way not to put nircmd in the windows folder would be to have a seperate folder for things in path amd add that to path in environmental variables. I do this with my windows boxen so i have access to various gnu tools –  Journeyman Geek Jun 17 '12 at 14:33
    
Correct, I didn't cover that as it may confuse and super users already know this :) –  Snæbjørn Jun 17 '12 at 14:39
    
Hey I think that OP meant the G-Keys from the headset itself.... ( img.hexus.net/v2/lifestyle/logitech/G35/G35buttons-big.jpg ) –  klyonrad Nov 4 '12 at 14:43

I found an easier solution.

I used this helpful little app here (audioswitcher) and I mapped the sound setting to some keystrokes, and then mapped them to the buttons on the side of the headset.

Same end result, but an easier path to get there, and the app is useful anyway if you have numerous sound output devices to manage.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.