Introduction : Plotting Audio Level in PowerShell Console

Recently I was working on one of my open-sourced project called “ Graphical ” module, which can draw data points on a graph in PowerShell Console, then a strange idea hit me, can this module plot system audio peak levels which are nothing but data points between 1 and 100.

After little bit of research I found a module: ” AudioDeviceCmdlets ” which is available on PowerShell Gallery, from this module I’ll use Get-AudioDevice cmdlet to capture the Audio Levels. To play the audio I’m using my ” MusicPlayer ” module and plotting the audio levels using Graphical Modules

Required Modules

AudioDeviceCmdlets – https://www.powershellgallery.com/packages/AudioDeviceCmdlets/3.0.0.2

Music Player – https://github.com/PrateekKumarSingh/MusicPlayer

Graphical – https://github.com/PrateekKumarSingh/Graphical

Lets, first install the required modules. The good thing is that all these modules are available on PowerShell Gallery, that means if you’ve PowerShell v5 you can directly install them using the Install-Module cmdlet from Gallery. Once the modules are installed, Import them in your current session.

Now we get the audio device and play some music, to get variations in the audio peak levels because you don’t want that a flat line on the graph 😉

Then, we will run an infinite loop and capture the audio levels from the device and plot the peak levels on the console graph(s).

Full Script

That’s all for today, I hope you like this little hack. Cheers!

My new book : PowerShell Scripting Guide to Python

﻿