Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frgnca/AudioDeviceCmdlets
AudioDeviceCmdlets is a suite of PowerShell Cmdlets to control audio devices on Windows
https://github.com/frgnca/AudioDeviceCmdlets
audio c-sharp powershell powershell-cmdlets
Last synced: 3 months ago
JSON representation
AudioDeviceCmdlets is a suite of PowerShell Cmdlets to control audio devices on Windows
- Host: GitHub
- URL: https://github.com/frgnca/AudioDeviceCmdlets
- Owner: frgnca
- License: mit
- Created: 2012-09-19T17:30:08.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-04-30T22:25:13.000Z (almost 2 years ago)
- Last Synced: 2024-09-16T09:18:15.289Z (5 months ago)
- Topics: audio, c-sharp, powershell, powershell-cmdlets
- Language: C#
- Homepage:
- Size: 210 KB
- Stars: 758
- Watchers: 35
- Forks: 92
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Description
AudioDeviceCmdlets is a suite of PowerShell Cmdlets to control audio devices on Windows## Features
Get list of all audio devices
Get default audio device (playback/recording)
Get default communication audio device (playback/recording)
Get volume and mute state of default audio device (playback/recording)
Get volume and mute state of default communication audio device (playback/recording)
Set default audio device (playback/recording)
Set default communication audio device (playback/recording)
Set volume and mute state of default audio device (playback/recording)
Set volume and mute state of default communication audio device (playback/recording)## Installation
Run as administrator
```PowerShell
Install-Module -Name AudioDeviceCmdlets
```## Usage
```PowerShell
Get-AudioDevice -ID # Get the device with the ID corresponding to the given
Get-AudioDevice -Index # Get the device with the Index corresponding to the given
Get-AudioDevice -List # Get a list of all enabled devices as
Get-AudioDevice -PlaybackCommunication # Get the default communication playback device as
Get-AudioDevice -PlaybackCommunicationMute # Get the default communication playback device's mute state as
Get-AudioDevice -PlaybackCommunicationVolume # Get the default communication playback device's volume level on 100 as
Get-AudioDevice -Playback # Get the default playback device as
Get-AudioDevice -PlaybackMute # Get the default playback device's mute state as
Get-AudioDevice -PlaybackVolume # Get the default playback device's volume level on 100 as
Get-AudioDevice -RecordingCommunication # Get the default communication recording device as
Get-AudioDevice -RecordingCommunicationMute # Get the default communication recording device's mute state as
Get-AudioDevice -RecordingCommunicationVolume # Get the default communication recording device's volume level on 100 as
Get-AudioDevice -Recording # Get the default recording device as
Get-AudioDevice -RecordingMute # Get the default recording device's mute state as
Get-AudioDevice -RecordingVolume # Get the default recording device's volume level on 100 as
```
```PowerShell
Set-AudioDevice # Set the given playback/recording device as both the default device and the default communication device, for its type
Set-AudioDevice -CommunicationOnly # Set the given playback/recording device as the default communication device and not the default device, for its type
Set-AudioDevice -DefaultOnly # Set the given playback/recording device as the default device and not the default communication device, for its type
Set-AudioDevice -ID # Set the device with the ID corresponding to the given as both the default device and the default communication device, for its type
Set-AudioDevice -ID -CommunicationOnly # Set the device with the ID corresponding to the given as the default communication device and not the default device, for its type
Set-AudioDevice -ID -DefaultOnly # Set the device with the ID corresponding to the given as the default device and not the default communication device, for its type
Set-AudioDevice -Index # Set the device with the Index corresponding to the given as both the default device and the default communication device, for its type
Set-AudioDevice -Index -CommunicationOnly # Set the device with the Index corresponding to the given as the default communication device and not the default device, for its type
Set-AudioDevice -Index -DefaultOnly # Set the device with the Index corresponding to the given as the default device and not the default communication device, for its type
Set-AudioDevice -PlaybackCommunicationMuteToggle # Set the default communication playback device's mute state to the opposite of its current mute state
Set-AudioDevice -PlaybackCommunicationMute # Set the default communication playback device's mute state to the given
Set-AudioDevice -PlaybackCommunicationVolume # Set the default communication playback device's volume level on 100 to the given
Set-AudioDevice -PlaybackMuteToggle # Set the default playback device's mute state to the opposite of its current mute state
Set-AudioDevice -PlaybackMute # Set the default playback device's mute state to the given
Set-AudioDevice -PlaybackVolume # Set the default playback device's volume level on 100 to the given
Set-AudioDevice -RecordingCommunicationMuteToggle # Set the default communication recording device's mute state to the opposite of its current mute state
Set-AudioDevice -RecordingCommunicationMute # Set the default communication recording device's mute state to the given
Set-AudioDevice -RecordingCommunicationVolume # Set the default communication recording device's volume level on 100 to the given
Set-AudioDevice -RecordingMuteToggle # Set the default recording device's mute state to the opposite of its current mute state
Set-AudioDevice -RecordingMute # Set the default recording device's mute state to the given
Set-AudioDevice -RecordingVolume # Set the default recording device's volume level on 100 to the given
```
```PowerShell
Write-AudioDevice -PlaybackCommunicationMeter # Write the default playback device's power output on 100 as a meter
Write-AudioDevice -PlaybackCommunicationStream # Write the default playback device's power output on 100 as a stream of
Write-AudioDevice -PlaybackMeter # Write the default playback device's power output on 100 as a meter
Write-AudioDevice -PlaybackStream # Write the default playback device's power output on 100 as a stream of
Write-AudioDevice -RecordingCommunicationMeter # Write the default recording device's power output on 100 as a meter
Write-AudioDevice -RecordingCommunicationStream # Write the default recording device's power output on 100 as a stream of
Write-AudioDevice -RecordingMeter # Write the default recording device's power output on 100 as a meter
Write-AudioDevice -RecordingStream # Write the default recording device's power output on 100 as a stream of
```## Build Cmdlet from source
Build instructions
1. Install Visual Studio 2022
Workloads: .NET desktop development
2. Create new project from SOURCE folder
File -> New -> Project From Existing Code...Type of project: Visual C#
Folder: SOURCE
Name: AudioDeviceCmdlets
Output type: Class Library3. Set project properties
Project -> AudioDeviceCmdlets PropertiesAssembly name: AudioDeviceCmdlets
Target framework: .NET Framework 4.6.1+4. Install System.Management.Automation NuGet legacy package
Project -> Manage NuGet Packages...Package source: nuget.org
Browse: Microsoft.PowerShell.5.1.ReferenceAssemblies
Install: v1.0.0+5. Set solution configuration
Build -> Configuration Manager...Active solution configuration: Release
6. Build Cmdlet
Build -> Build SolutionAudioDeviceCmdlets\SOURCE\bin\Release\AudioDeviceCmdlets.dll
7. Import Cmdlet to PowerShell on Windows
```PowerShell
$FilePath = "C:\Path\To\AudioDeviceCmdlets\SOURCE\bin\Release\AudioDeviceCmdlets.dll"
New-Item "$($profile | split-path)\Modules\AudioDeviceCmdlets" -Type directory -Force
Copy-Item $FilePath "$($profile | split-path)\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll"
Set-Location "$($profile | Split-Path)\Modules\AudioDeviceCmdlets"
Get-ChildItem | Unblock-File
Import-Module AudioDeviceCmdlets
```## Donation
Thank you for considering a donation
Bitcoin (BTC) 3AffczXX4Jb2iN8QWQhHQAsj9AqGFXgYUF
BitcoinCash (BCH) qraf6a3fklta7xkvwkh49zqn6mgnm2eyz589rkfvl3
Ethereum (ETH) 0xE4EA2A2356C04c8054Db452dCBd6f958F74722dE## Attribution
Based on code originally posted to Code Project by Ray Molenkamp with comments and suggestions by MadMidi
http://www.codeproject.com/Articles/18520/Vista-Core-Audio-API-Master-Volume-Control
Based on code originally posted to GitHub by Chris Hunt
https://github.com/cdhunt/WindowsAudioDevice-Powershell-Cmdlet