Last active
July 13, 2017 20:04
-
-
Save jeremybeavon/4d9674fea1011822d08ce3670a389b7e to your computer and use it in GitHub Desktop.
Powershell music :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$A = 220 | |
$Asharp = 233 | |
$B = 247 | |
$C = 262 | |
$Csharp = 277 | |
$D = 294 | |
$Dsharp = 311 | |
$E = 164 | |
$F = 175 | |
$Fsharp = 184 | |
$G = 195 | |
$Gsharp = 415 | |
$DsharpHigh = 311 | |
$DHigh = 294 | |
function Play-Music | |
{ | |
param( | |
[float[][]]$Notes, | |
[int]$CrotchetLength = 500 | |
) | |
[int[][]]$correctNotes = @() | |
for ($index = 0; $index -lt $Notes.length; $index++) | |
{ | |
$correctNotes += @(,@([int]$Notes[$index][0], [int]($CrotchetLength * $Notes[$index][1]))) | |
} | |
for ($index = 0; $index -lt $correctNotes.length; $index++) | |
{ | |
[console]::beep($correctNotes[$index][0], $correctNotes[$index][1]) | |
} | |
} | |
$bond = @($E, 0.5), | |
@($Fsharp, 0.25), | |
@($Fsharp, 0.25), | |
@($Fsharp, 0.5), | |
@($Fsharp, 1), | |
@($E, 0.5), | |
@($E, 0.5), | |
@($E, 0.5), #End of bar 1 | |
@($E, 0.5), | |
@($G, 0.25), | |
@($G, 0.25), | |
@($G, 0.5), | |
@($G, 1), | |
@($Fsharp, 0.5), | |
@($Fsharp, 0.5), | |
@($Fsharp, 0.5), # End of bar 2 | |
@($E, 0.5), | |
@($Fsharp, 0.25), | |
@($Fsharp, 0.25), | |
@($Fsharp, 0.5), | |
@($Fsharp, 1), | |
@($E, 0.5), | |
@($E, 0.5), | |
@($E, 0.5), # End of bar 3 | |
@($E, 0.5), | |
@($G, 0.25), | |
@($G, 0.25), | |
@($G, 0.5), | |
@($G, 1), | |
@($Fsharp, 0.5), | |
@($Fsharp, 0.5), | |
@($Fsharp, 0.5), # End of bar 4 | |
@($E, 0.5), | |
@($Fsharp, 0.25), | |
@($Fsharp, 0.25), | |
@($Fsharp, 0.5), | |
@($Fsharp, 1), | |
@($E, 0.5), | |
@($E, 0.5), | |
@($E, 0.5), # End of bar 5 | |
@($E, 0.5), | |
@($G, 0.25), | |
@($G, 0.25), | |
@($G, 0.5), | |
@($G, 1), | |
@($Fsharp, 0.5), | |
@($F, 0.5), | |
@($E, 0.5), # End of bar 6 | |
@($DsharpHigh, 0.5), | |
@($DHigh, 3), | |
@($B, 0.5), | |
@($A, 0.5), | |
@($B, 4) | |
Play-Music -Notes $bond |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Octave = @{ | |
A = 220 | |
Asharp = 233 | |
B = 247 | |
C = 262 | |
Csharp = 277 | |
D = 294 | |
Dsharp = 311 | |
E = 329 | |
F = 349 | |
Fsharp = 369 | |
G = 391 | |
Gsharp = 415 | |
} | |
$OctavePlus1 = @{ | |
A = 440 | |
Asharp = 466 | |
B = 493 | |
C = 523 | |
Csharp = 554 | |
D = 587 | |
Dsharp = 622 | |
E = 659 | |
F = 698 | |
Fsharp = 740 | |
G = 784 | |
Gsharp = 831 | |
} | |
function Add-Flats | |
{ | |
param ([hashtable]$octaveToChange) | |
$octaveToChange.Bflat = $octaveToChange.Asharp | |
$octaveToChange.Dflat = $octaveToChange.Csharp | |
$octaveToChange.Eflat = $octaveToChange.Dsharp | |
$octaveToChange.Gflat = $octaveToChange.Fsharp | |
$octaveToChange.Aflat = $octaveToChange.Gsharp | |
} | |
Add-Flats $Octave | |
Add-Flats $OctavePlus1 | |
function Play-Music | |
{ | |
param( | |
[float[][]]$Notes, | |
[int]$CrotchetLength = 500 | |
) | |
[int[][]]$correctNotes = @() | |
for ($index = 0; $index -lt $Notes.length; $index++) | |
{ | |
$correctNotes += @(,@([int]$Notes[$index][0], [int]($CrotchetLength * $Notes[$index][1]))) | |
} | |
for ($index = 0; $index -lt $correctNotes.length; $index++) | |
{ | |
[console]::beep($correctNotes[$index][0], $correctNotes[$index][1]) | |
} | |
} | |
$godfather = @($Octave.G, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($OctavePlus1.Eflat, 0.5), | |
@($OctavePlus1.D, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($OctavePlus1.Eflat, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($OctavePlus1.D, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($Octave.Aflat, 0.5), | |
@($OctavePlus1.Bflat, 0.5), | |
@($Octave.G, 2), | |
@(37, 0.5), | |
@($Octave.G, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($OctavePlus1.Eflat, 0.5), | |
@($OctavePlus1.D, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($OctavePlus1.Eflat, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($OctavePlus1.D, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.Gflat, 0.5), | |
@($Octave.F, 2), | |
@(37, 0.5), | |
@($Octave.F, 0.5), | |
@($Octave.Aflat, 0.5), | |
@($OctavePlus1.B, 0.5), | |
@($OctavePlus1.D, 2), | |
@(37, 0.5), | |
@($Octave.F, 0.5), | |
@($Octave.Aflat, 0.5), | |
@($OctavePlus1.B, 0.5), | |
@($OctavePlus1.C, 2), | |
@(37, 0.5), | |
@($Octave.C, 0.5), | |
@($Octave.Eflat, 0.5), | |
@($OctavePlus1.Bflat, 0.5), | |
@($Octave.Aflat, 0.5), | |
@($Octave.G, 0.5), | |
@($OctavePlus1.Bflat, 0.5), | |
@($Octave.Aflat, 0.5), | |
@($Octave.Aflat, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.B, 0.5), | |
@($Octave.C, 2) | |
Play-Music -Notes $godfather |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$A = 220 | |
$Asharp = 233 | |
$B = 247 | |
$C = 262 | |
$Csharp = 277 | |
$D = 294 | |
$Dsharp = 311 | |
$E = 164 | |
$F = 175 | |
$Fsharp = 184 | |
$G = 195 | |
$Gsharp = 415 | |
$DsharpHigh = 311 | |
$DHigh = 294 | |
function Play-Music | |
{ | |
param( | |
[float[][]]$Notes, | |
[int]$CrotchetLength = 500 | |
) | |
[int[][]]$correctNotes = @() | |
for ($index = 0; $index -lt $Notes.length; $index++) | |
{ | |
$correctNotes += @(,@([int]$Notes[$index][0], [int]($CrotchetLength * $Notes[$index][1]))) | |
} | |
for ($index = 0; $index -lt $correctNotes.length; $index++) | |
{ | |
[console]::beep($correctNotes[$index][0], $correctNotes[$index][1]) | |
} | |
} | |
$jaws = @($B, 2), | |
@($C, 2), | |
@(37, 2), | |
@($B, 2), | |
@($C, 2), | |
@(37, 2), | |
@($B, 1), | |
@($C, 1), | |
@(37, 1), | |
@($B, 1), | |
@($C, 1), | |
@(37, 1), | |
@($B, 1), | |
@($C, 1), | |
@($B, 1), | |
@($C, 1), | |
@($B, 1), | |
@($C, 1), | |
@($B, 1), | |
@($C, 1), | |
@($A, 1), | |
@($B, 1), | |
@($B, 1), | |
@($C, 1), | |
@($A, 1), | |
@($B, 1), | |
@($B, 1), | |
@($C, 1), | |
@($Dsharp, 0.5), | |
@(392, 0.5), | |
@(554, 3), | |
@($B, 1),#D#,G,C#, F,A,D# | |
@($C, 1), | |
@($B, 1), | |
@($C, 1), | |
@($Dsharp, 0.5), | |
@(392, 0.5), | |
@(554, 2), | |
@($B, 1), | |
@($C, 1), | |
@(349, 0.5), | |
@(440, 0.5), | |
@(662, 2), | |
@($B, 1), | |
@($C, 1), | |
@($A, 1), | |
@($B, 1), | |
@($B, 1), | |
@($C, 1), #Gb,B,G,Gb,Db,Gb,G | |
@(415, 0.5), | |
@(493, 0.5), | |
@(784, 0.5), | |
@(830, 0.5), | |
@(784, 0.5), | |
@(622, 0.5), | |
@(415, 0.5), | |
@(392, 4) | |
Play-Music $jaws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$OctaveMinus1 = @{ | |
G = 196 | |
} | |
$Octave = @{ | |
A = 220 | |
Asharp = 233 | |
B = 247 | |
C = 262 | |
Csharp = 277 | |
D = 294 | |
Dsharp = 311 | |
E = 329 | |
F = 349 | |
Fsharp = 369 | |
G = 391 | |
Gsharp = 415 | |
} | |
$OctavePlus1 = @{ | |
A = 440 | |
Asharp = 466 | |
B = 493 | |
C = 523 | |
Csharp = 554 | |
D = 587 | |
Dsharp = 622 | |
E = 659 | |
F = 698 | |
Fsharp = 740 | |
G = 784 | |
Gsharp = 831 | |
} | |
function Add-Flats | |
{ | |
param ([hashtable]$octaveToChange) | |
$octaveToChange.Bflat = $octaveToChange.Asharp | |
$octaveToChange.Dflat = $octaveToChange.Csharp | |
$octaveToChange.Eflat = $octaveToChange.Dsharp | |
$octaveToChange.Gflat = $octaveToChange.Fsharp | |
$octaveToChange.Aflat = $octaveToChange.Gsharp | |
} | |
Add-Flats $Octave | |
Add-Flats $OctavePlus1 | |
function Play-Music | |
{ | |
param( | |
[float[][]]$Notes, | |
[int]$CrotchetLength = 1000 | |
) | |
[int[][]]$correctNotes = @() | |
for ($index = 0; $index -lt $Notes.length; $index++) | |
{ | |
$correctNotes += @(,@([int]$Notes[$index][0], [int]($CrotchetLength * $Notes[$index][1]))) | |
} | |
for ($index = 0; $index -lt $correctNotes.length; $index++) | |
{ | |
[console]::beep($correctNotes[$index][0], $correctNotes[$index][1]) | |
} | |
} | |
$schindlersList = @($Octave.A, 1), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.D, 0.5), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.D, 0.5), | |
@($OctavePlus1.Bflat, 0.5), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.F, 0.5), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.F, 0.5), | |
@($OctaveMinus1.G, 0.5), | |
@($Octave.F, 0.5), | |
@($Octave.G, 0.5), | |
@($OctavePlus1.A, 2), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.D, 0.5), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.D, 0.5), | |
@($OctavePlus1.C, 0.5), | |
@($OctavePlus1.Bflat, 0.5), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.C, 0.5), | |
@($Octave.Bflat, 0.5), | |
@($Octave.E, 0.5), | |
@($Octave.G, 0.5), | |
@($OctavePlus1.Bflat, 0.5), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.F, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.Bflat, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.Bflat, 0.5), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.F, 0.5), | |
@($Octave.G, 0.5), | |
@($OctavePlus1.A, 3), | |
@($Octave.A, 1), | |
@($Octave.G, 0.5), | |
@($Octave.Bflat, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.Bflat, 0.5), | |
@($OctavePlus1.A, 0.5), | |
@($Octave.G, 0.5), | |
@($Octave.F, 0.5), | |
@($Octave.E, 0.5), | |
@($Octave.D, 2) | |
Play-Music -Notes $schindlersList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment