Exploring iTunes Using PowerShell Part 2: The Equalizer

Using PowerShell, we have already seen what we can access with the iTunes COM object. The following article was already published:

Now I am going to step further along with this and show off the equalizer in this application and how you can manipulate it.

First off, we connect to the COM object, which will also open up the iTunes application.

 
$itunes = New-Object  -ComObject iTunes.Application

Let’s take a look at the equalizer and see if it is enabled.

 
$itunes.EQEnabled

image

Looks like it isn’t enabled, so with that we will enable it.

 
$itunes.EQEnabled = $True

If you want to view all of the equalizer presets we can use the EAPresets property to view them all. In this case, I am going to pipe them into a gridview using Out-GridView.

 
$itunes.EQPresets | Out-GridView

image

An audio person would know more about this stuff than me, but I can see each preset and the various properties that is has in regards to the different Bands.

Each of these Bands is modifiable (+12 or –12 are the limits) and you can even rename or delete these as well using the appropriate methods!

image

What about creating an EQ Preset? Well, don’t worry about that because it is possible to do as well! We can use the CreateEQPreset method from the main iTunes COM object to accomplish this. All we need is a name for it to supply as a parameter.

 
$NewEQPreset = $itunes.CreateEQPreset('TestPreset')

image

Here we have a new preset that is ready to be configured for use. Simple enough, right? I’ll make some changes to it so it seems more official.

 
1..10 | ForEach {
    $NewEQPreset."Band$($_)" = Get-Random (-12..12)
}
$NewEQPreset

image

Now we can set this equalizer as the current EQ Preset by replacing the CurrentEQPreset.

 
$itunes.CurrentEQPreset = $NewEQPreset

image

The last thing to cover is the Equalizer window that is in iTunes. This is a UI and really serves no purpose as far as command line stuff goes. But I wanted to include this so you can play around with it as well!

To look at the equalizer window, we have to view the EQWindow property of the iTunes object.

 
$itunes.EQWindow

image

All of the highlighted properties are editable and will instantly affect the UI when modified.

image

I can minimize or restore the UI window.

 
#Minimize
$itunes.EQWindow.Minimized=$True

#Restore
$itunes.EQWindow.Minimized=$False

Trying to modife the Zoomed property ends in failure though.

Exception setting “Zoomed”: “The specified operation is not currently
supported by the window.”
At line:1 char:1
+ $itunes.EQWindow.Zoomed = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], SetValueInvocationExceptio
n
+ FullyQualifiedErrorId : CatchFromBaseAdapterSetValueTI

We can easily reposition the window using the top,and left properties (bottom and right are not supported).

 
$itunes.EQWindow.Top = 250
$itunes.EQWindow.Left = 800

Setting the Width and Height also appears to be unsupported by the window as well as it will throw errors when attempting to set a value on the property.

With that, we have covered the equalizer in iTunes. I’ll continue my exploration of iTunes with PowerShell with another article at some point in the future!

About Boe Prox

Microsoft Cloud and Datacenter MVP working as a SQL DBA.
This entry was posted in powershell and tagged , , , . Bookmark the permalink.

3 Responses to Exploring iTunes Using PowerShell Part 2: The Equalizer

  1. how do you make the equalizer drop dead central 🙂

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s