Using from Powershell

Topics: Samples
Jun 1, 2015 at 4:18 AM
Edited Jun 1, 2015 at 4:24 AM
Just in case a non-programmer (like me) want to control a Midi device from ProwerShell. It is very easy thanks to Midi.Net
formatting all wrong so get it from

Example using to control MIDI device

Copy the following DLL's from above CodePlex project into path you want to use in the script

add-type -path 'C:\Users\IAN\Documents\WindowsPowerShell\Modules\Midi\CannedBytes.dll'
add-type -path 'C:\Users\IAN\Documents\WindowsPowerShell\Modules\Midi\CannedBytes.IO.dll'
add-type -path 'C:\Users\IAN\Documents\WindowsPowerShell\Modules\Midi\CannedBytes.Midi.dll'
$midiInCaps = new-object CannedBytes.Midi.MidiInPortCapsCollection
$midiOutCaps = new-object CannedBytes.Midi.MidiOutPortCapsCollection
"Input Devices-----------------------------"
For($i=0; $i -lt $midiInCaps.Count; $i++){
"Device ID: $i Name: " + $midiInCaps[$i].Name
"Output Devices-----------------------------"
For($j=0; $j -lt $midiOutCaps.Count; $j++){
"Device ID: $j Name: " + $midiOutCaps[$j].Name
if ($midiOutCaps[$j].Name -eq 'CMD MICRO'){$CMD=$j}
$midiOut = new-Object CannedBytes.Midi.MidiOutPort

Flash the left play button

$midiData = new-object CannedBytes.Midi.midiData
$midiData.Status=144 #Note on decimal
$midiData.Parameter1=23 #Play button on CMD Micro
$midiData.Parameter2=1 # 1=Green 2=Flash