### Install AudioDeviceCmdlets Module Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Install the AudioDeviceCmdlets module from the PowerShell Gallery. This command requires administrator privileges. ```PowerShell Install-Module -Name AudioDeviceCmdlets ``` -------------------------------- ### Install and Import AudioDeviceCmdlets Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Install the module from the PowerShell Gallery and import it into the current session. Requires administrative privileges. ```powershell # Run PowerShell as Administrator Install-Module -Name AudioDeviceCmdlets # Import the module Import-Module AudioDeviceCmdlets ``` -------------------------------- ### Toggle Audio Device Script Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt A complete script example that switches between two specific audio devices and plays a confirmation sound. ```powershell # Toggle-AudioDevice.ps1 # Toggles between two playback audio devices and plays confirmation sound # Define audio devices by their IDs (get IDs from: Get-AudioDevice -List) $AudioDevice_A = "{0.0.0.00000000}.{48300fc4-2125-492d-ab28-c6b01b9eee6b}" $AudioDevice_B = "{0.0.0.00000000}.{c4aadd95-74c7-4b3b-9508-b0ef36ff71ba}" # Get current default playback device $DefaultPlayback = Get-AudioDevice -Playback # Toggle to the other device if ($DefaultPlayback.ID -eq $AudioDevice_A) { Set-AudioDevice -ID $AudioDevice_B | Out-Null Write-Host "Switched to Device B" } else { Set-AudioDevice -ID $AudioDevice_A | Out-Null Write-Host "Switched to Device A" } # Play confirmation sound $Sound = New-Object System.Media.SoundPlayer $Sound.SoundLocation = "C:\WINDOWS\Media\Windows Background.wav" $Sound.Play() Start-Sleep -Seconds 3 # Optional: Run from VBScript to hide PowerShell window # Save as Toggle-AudioDevice.vbs: # command = "powershell.exe -nologo -command C:\Path\To\Toggle-AudioDevice.ps1" # set shell = CreateObject("WScript.Shell") ``` -------------------------------- ### Get Module Version Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Display version information and licensing credits for the module. ```powershell # Display version information Get-AudioDevice -Version # Output: # AudioDeviceCmdlets v3.1.0.2 # Copyright (c) 2016-2022 Francois Gendron # MIT License ``` -------------------------------- ### Import Compiled Cmdlet Module Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Script to install and import the compiled AudioDeviceCmdlets.dll into the current user's PowerShell profile modules directory. ```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 ``` -------------------------------- ### Get Default Multimedia Devices Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Retrieve the current default playback or recording device for multimedia use. ```powershell # Get default playback device $playbackDevice = Get-AudioDevice -Playback Write-Host "Default Playback: $($playbackDevice.Name)" # Get default recording device $recordingDevice = Get-AudioDevice -Recording Write-Host "Default Recording: $($recordingDevice.Name)" # Example output: # Default Playback: Headphones (USB Audio Device) # Default Recording: Microphone (USB Audio Device) ``` -------------------------------- ### Get Default Communication Devices Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Retrieve the default communication device used for voice calls and conferencing. ```powershell # Get default communication playback device $commPlayback = Get-AudioDevice -PlaybackCommunication Write-Host "Communication Playback: $($commPlayback.Name)" # Get default communication recording device $commRecording = Get-AudioDevice -RecordingCommunication Write-Host "Communication Recording: $($commRecording.Name)" ``` -------------------------------- ### Get Audio Volume and Mute State Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Retrieve volume levels and mute status for playback, recording, or communication devices. ```powershell # Get playback volume and mute state $volume = Get-AudioDevice -PlaybackVolume $muted = Get-AudioDevice -PlaybackMute Write-Host "Playback Volume: $volume, Muted: $muted" # Get recording volume and mute state $recVolume = Get-AudioDevice -RecordingVolume $recMuted = Get-AudioDevice -RecordingMute Write-Host "Recording Volume: $recVolume, Muted: $recMuted" # Get communication device volume and mute $commVolume = Get-AudioDevice -PlaybackCommunicationVolume $commMuted = Get-AudioDevice -PlaybackCommunicationMute Write-Host "Communication Volume: $commVolume, Muted: $commMuted" # Example output: # Playback Volume: 75%, Muted: False # Recording Volume: 100%, Muted: False # Communication Volume: 50%, Muted: False ``` -------------------------------- ### Get Audio Device Information Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Retrieve information about audio devices, including specific devices by ID or index, lists of enabled devices, default communication and playback devices, and their mute/volume states. ```APIDOC ## GET /api/audio/devices ### Description Retrieves information about audio devices. ### Method GET ### Endpoint /api/audio/devices ### Parameters #### Query Parameters - **ID** (string) - Optional - Get the device with the ID corresponding to the given string. - **Index** (int) - Optional - Get the device with the Index corresponding to the given int. - **List** (boolean) - Optional - Get a list of all enabled devices. - **PlaybackCommunication** (boolean) - Optional - Get the default communication playback device. - **PlaybackCommunicationMute** (boolean) - Optional - Get the default communication playback device's mute state. - **PlaybackCommunicationVolume** (boolean) - Optional - Get the default communication playback device's volume level (0-100). - **Playback** (boolean) - Optional - Get the default playback device. - **PlaybackMute** (boolean) - Optional - Get the default playback device's mute state. - **PlaybackVolume** (boolean) - Optional - Get the default playback device's volume level (0-100). - **RecordingCommunication** (boolean) - Optional - Get the default communication recording device. - **RecordingCommunicationMute** (boolean) - Optional - Get the default communication recording device's mute state. - **RecordingCommunicationVolume** (boolean) - Optional - Get the default communication recording device's volume level (0-100). - **Recording** (boolean) - Optional - Get the default recording device. - **RecordingMute** (boolean) - Optional - Get the default recording device's mute state. - **RecordingVolume** (boolean) - Optional - Get the default recording device's volume level (0-100). ### Response #### Success Response (200) - **AudioDevice** (object) - Represents an audio device with properties like ID, Name, Type, etc. - **bool** (boolean) - Represents the mute state (true for muted, false for unmuted). - **float** (float) - Represents the volume level (0.0 to 100.0). ### Response Example ```json { "ID": "some-device-id", "Name": "Example Speaker", "Type": "Playback", "IsDefault": true, "IsDefaultCommunication": true } ``` ``` -------------------------------- ### Set-AudioDevice Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Configures default audio devices for playback or recording. ```APIDOC ## Set-AudioDevice ### Description Sets an audio device as the default device for its type (playback or recording). By default, it sets both the multimedia and communication roles. ### Parameters #### Request Body - **Object/ID/Index** (Mixed) - Required - The device reference, ID string, or index number to set as default. ``` -------------------------------- ### Configure Audio Device Settings Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Use these commands to set default devices or modify volume and mute states. ```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 ``` -------------------------------- ### Write Audio Device Output Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Use these commands to output audio device power levels as meters or streams. ```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 ``` -------------------------------- ### List Audio Devices Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Retrieve a list of all enabled audio devices with their index, name, ID, and default status. ```powershell # Get all audio devices Get-AudioDevice -List # Example output: # Index : 1 # Default : False # DefaultCommunication : False # Type : Playback # Name : Speakers (Realtek High Definition Audio) # ID : {0.0.0.00000000}.{c4aadd95-74c7-4b3b-9508-b0ef36ff71ba} # Device : CoreAudioApi.MMDevice # Index : 2 # Default : True # DefaultCommunication : True # Type : Playback # Name : Headphones (USB Audio Device) # ID : {0.0.0.00000000}.{48300fc4-2125-492d-ab28-c6b01b9eee6b} # Device : CoreAudioApi.MMDevice ``` -------------------------------- ### Set Audio Device Configuration Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Configure audio devices by setting them as default, default communication, or adjusting their mute and volume states. ```APIDOC ## POST /api/audio/devices ### Description Configures audio devices by setting them as default, default communication, or adjusting their mute and volume states. ### Method POST ### Endpoint /api/audio/devices ### Parameters #### Request Body - **AudioDevice** (object) - Optional - The audio device object to set. - **ID** (string) - Optional - The ID of the device to set. - **Index** (int) - Optional - The index of the device to set. - **CommunicationOnly** (boolean) - Optional - If true, sets the device as the default communication device only. - **DefaultOnly** (boolean) - Optional - If true, sets the device as the default device only. - **PlaybackCommunicationMuteToggle** (boolean) - Optional - Toggles the mute state of the default communication playback device. - **PlaybackCommunicationMute** (boolean) - Optional - Sets the mute state of the default communication playback device. - **PlaybackCommunicationVolume** (float) - Optional - Sets the volume level (0-100) of the default communication playback device. - **PlaybackMuteToggle** (boolean) - Optional - Toggles the mute state of the default playback device. - **PlaybackMute** (boolean) - Optional - Sets the mute state of the default playback device. - **PlaybackVolume** (float) - Optional - Sets the volume level (0-100) of the default playback device. - **RecordingCommunicationMuteToggle** (boolean) - Optional - Toggles the mute state of the default communication recording device. - **RecordingCommunicationMute** (boolean) - Optional - Sets the mute state of the default communication recording device. - **RecordingCommunicationVolume** (float) - Optional - Sets the volume level (0-100) of the default communication recording device. - **RecordingMuteToggle** (boolean) - Optional - Toggles the mute state of the default recording device. - **RecordingMute** (boolean) - Optional - Sets the mute state of the default recording device. - **RecordingVolume** (float) - Optional - Sets the volume level (0-100) of the default recording device. ### Request Example ```json { "ID": "some-device-id", "PlaybackVolume": 75.5 } ``` ### Response #### Success Response (200) - **Success** (boolean) - Indicates if the operation was successful. ### Response Example ```json { "Success": true } ``` ``` -------------------------------- ### Write Audio Device Metrics Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Write audio device metrics such as power output as a meter or a stream of integers. ```APIDOC ## POST /api/audio/devices/write ### Description Writes audio device metrics. ### Method POST ### Endpoint /api/audio/devices/write ### Parameters #### Query Parameters - **PlaybackCommunicationMeter** (boolean) - Optional - Write the default playback device's power output (0-100) as a meter. - **PlaybackCommunicationStream** (boolean) - Optional - Write the default playback device's power output (0-100) as a stream of integers. ### Response #### Success Response (200) - **Success** (boolean) - Indicates if the operation was successful. ### Response Example ```json { "Success": true } ``` ``` -------------------------------- ### Get-AudioDevice Cmdlets Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Cmdlets for retrieving audio device information, including lists, specific devices by ID/Index, default playback/recording devices, and volume/mute states. ```APIDOC ## Get-AudioDevice ### Description Retrieves information about audio devices on the system. ### Parameters #### Query Parameters - **List** (Switch) - Optional - Lists all enabled audio devices. - **ID** (String) - Optional - Retrieves a specific device by its unique ID. - **Index** (Int) - Optional - Retrieves a specific device by its index number. - **Playback** (Switch) - Optional - Retrieves the default multimedia playback device. - **Recording** (Switch) - Optional - Retrieves the default multimedia recording device. - **PlaybackCommunication** (Switch) - Optional - Retrieves the default communication playback device. - **RecordingCommunication** (Switch) - Optional - Retrieves the default communication recording device. - **PlaybackVolume** (Switch) - Optional - Retrieves the volume level of the default playback device. - **PlaybackMute** (Switch) - Optional - Retrieves the mute state of the default playback device. - **RecordingVolume** (Switch) - Optional - Retrieves the volume level of the default recording device. - **RecordingMute** (Switch) - Optional - Retrieves the mute state of the default recording device. - **Version** (Switch) - Optional - Displays module version information. ``` -------------------------------- ### Retrieve Audio Device Information Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Use these commands to list devices or query specific properties like volume and mute status. ```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 ``` -------------------------------- ### Monitor Audio Device Levels Source: https://github.com/frgnca/audiodevicecmdlets/blob/master/README.md Commands to output audio device power levels as either a visual meter or a stream of integers. ```PowerShell 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 ``` -------------------------------- ### Display Audio Meter Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Outputs a real-time visual progress bar for audio levels. This command runs continuously until interrupted. ```powershell # Display playback audio meter Write-AudioDevice -PlaybackMeter # Display recording audio meter (microphone input level) Write-AudioDevice -RecordingMeter # Display communication playback meter Write-AudioDevice -PlaybackCommunicationMeter # Display communication recording meter Write-AudioDevice -RecordingCommunicationMeter ``` -------------------------------- ### Set Default Audio Device Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Configures the default audio device using pipeline objects, IDs, or indices. Supports specific flags for communication-only or default-only settings. ```powershell Get-AudioDevice -Index 1 | Set-AudioDevice Set-AudioDevice -ID "{0.0.0.00000000}.{c4aadd95-74c7-4b3b-9508-b0ef36ff71ba}" Set-AudioDevice -Index 2 Set-AudioDevice -Index 1 -DefaultOnly Set-AudioDevice -Index 1 -CommunicationOnly $AudioDevice_A = "{0.0.0.00000000}.{48300fc4-2125-492d-ab28-c6b01b9eee6b}" $AudioDevice_B = "{0.0.0.00000000}.{c4aadd95-74c7-4b3b-9508-b0ef36ff71ba}" $DefaultPlayback = Get-AudioDevice -Playback if ($DefaultPlayback.ID -eq $AudioDevice_A) { Set-AudioDevice -ID $AudioDevice_B | Out-Null } else { Set-AudioDevice -ID $AudioDevice_A | Out-Null } ``` -------------------------------- ### Retrieve Specific Audio Device Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Access a specific device using its unique ID or index number. ```powershell # Get device by ID Get-AudioDevice -ID "{0.0.0.00000000}.{c4aadd95-74c7-4b3b-9508-b0ef36ff71ba}" # Get device by index Get-AudioDevice -Index 1 # Store device reference for later use $device = Get-AudioDevice -Index 2 Write-Host "Device Name: $($device.Name)" Write-Host "Device Type: $($device.Type)" ``` -------------------------------- ### Stream Audio Levels Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Outputs continuous integer values representing audio levels. Useful for logging, background jobs, or conditional monitoring. ```powershell # Stream playback audio levels Write-AudioDevice -PlaybackStream # Stream recording audio levels Write-AudioDevice -RecordingStream # Capture audio levels to file for 10 seconds $job = Start-Job { Write-AudioDevice -PlaybackStream } Start-Sleep -Seconds 10 Stop-Job $job $levels = Receive-Job $job $levels | Out-File -FilePath "audio_levels.txt" # Monitor and alert on high audio levels Write-AudioDevice -RecordingStream | ForEach-Object { if ($_ -gt 80) { Write-Warning "High audio level detected: $_" } } ``` -------------------------------- ### Set Audio Device Volume Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Adjusts volume levels for playback, recording, or communication devices. Values range from 0 to 100. ```powershell # Set playback volume to 50% Set-AudioDevice -PlaybackVolume 50.0 # Set recording volume to 80% Set-AudioDevice -RecordingVolume 80.0 # Set communication playback volume to 75% Set-AudioDevice -PlaybackCommunicationVolume 75.0 # Set communication recording volume to 100% Set-AudioDevice -RecordingCommunicationVolume 100.0 # Gradually increase volume for ($vol = 0; $vol -le 100; $vol += 10) { Set-AudioDevice -PlaybackVolume $vol Start-Sleep -Milliseconds 100 } ``` -------------------------------- ### Set Audio Device Mute State Source: https://context7.com/frgnca/audiodevicecmdlets/llms.txt Controls the mute status of audio devices or toggles the current state. Includes a helper function for muting all devices simultaneously. ```powershell # Mute playback device Set-AudioDevice -PlaybackMute $true # Unmute playback device Set-AudioDevice -PlaybackMute $false # Toggle playback mute state Set-AudioDevice -PlaybackMuteToggle # Mute/unmute recording device Set-AudioDevice -RecordingMute $true Set-AudioDevice -RecordingMuteToggle # Mute/unmute communication devices Set-AudioDevice -PlaybackCommunicationMute $true Set-AudioDevice -PlaybackCommunicationMuteToggle Set-AudioDevice -RecordingCommunicationMute $false Set-AudioDevice -RecordingCommunicationMuteToggle # Quick mute all function function Mute-AllAudio { Set-AudioDevice -PlaybackMute $true Set-AudioDevice -RecordingMute $true Set-AudioDevice -PlaybackCommunicationMute $true Set-AudioDevice -RecordingCommunicationMute $true } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.