Play Mario Theme Song In Powershell

2 minute read

Description:

Why? Because Powershell can!

To Resolve:

  1. Script:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    
    Function Play-MarioIntro 
          {
                [console]::beep($E, $SIXTEENTH)
                [console]::beep($E, $EIGHTH)
                [console]::beep($E, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($C, $SIXTEENTH)
                [console]::beep($E, $EIGHTH)
                [console]::beep($G, $QUARTER)
          }
    
          Function Play-MarioIntro2
          {
                [console]::beep($C, $EIGHTHDOT)
                [console]::beep($GbelowC, $SIXTEENTH)
                Start-Sleep -m $EIGHTH
                [console]::beep($EbelowG, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($A, $EIGHTH)
                [console]::beep($B, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($Asharp, $SIXTEENTH)
                [console]::beep($A, $EIGHTH)
                [console]::beep($GbelowC, $SIXTEENTHDOT)
                [console]::beep($E, $SIXTEENTHDOT)
                [console]::beep($G, $EIGHTH)
                [console]::beep($AHigh, $EIGHTH)
                [console]::beep($F, $SIXTEENTH)
                [console]::beep($G, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($E, $EIGHTH)
                [console]::beep($C, $SIXTEENTH)
                [console]::beep($D, $SIXTEENTH)
                [console]::beep($B, $EIGHTHDOT)
                [console]::beep($C, $EIGHTHDOT)
                [console]::beep($GbelowC, $SIXTEENTH)
                Start-Sleep -m $EIGHTH
                [console]::beep($EbelowG, $EIGHTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($A, $EIGHTH)
                [console]::beep($B, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($Asharp, $SIXTEENTH)
                [console]::beep($A, $EIGHTH)
                [console]::beep($GbelowC, $SIXTEENTHDOT)
                [console]::beep($E, $SIXTEENTHDOT)
                [console]::beep($G, $EIGHTH)
                [console]::beep($AHigh, $EIGHTH)
                [console]::beep($F, $SIXTEENTH)
                [console]::beep($G, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($E, $EIGHTH)
                [console]::beep($C, $SIXTEENTH)
                [console]::beep($D, $SIXTEENTH)
                [console]::beep($B, $EIGHTHDOT)
                Start-Sleep -m $EIGHTH
                [console]::beep($G, $SIXTEENTH)
                [console]::beep($Fsharp, $SIXTEENTH)
                [console]::beep($F, $SIXTEENTH)
                [console]::beep($Dsharp, $EIGHTH)
                [console]::beep($E, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($GbelowCSharp, $SIXTEENTH)
                [console]::beep($A, $SIXTEENTH)
                [console]::beep($C, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($A, $SIXTEENTH)
                [console]::beep($C, $SIXTEENTH)
                [console]::beep($D, $SIXTEENTH)
                Start-Sleep -m $EIGHTH
                [console]::beep($G, $SIXTEENTH)
                [console]::beep($Fsharp, $SIXTEENTH)
                [console]::beep($F, $SIXTEENTH)
                [console]::beep($Dsharp, $EIGHTH)
                [console]::beep($E, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($CHigh, $EIGHTH)
                [console]::beep($CHigh, $SIXTEENTH)
                [console]::beep($CHigh, $QUARTER)
                [console]::beep($G, $SIXTEENTH)
                [console]::beep($Fsharp, $SIXTEENTH)
                [console]::beep($F, $SIXTEENTH)
                [console]::beep($Dsharp, $EIGHTH)
                [console]::beep($E, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($GbelowCSharp, $SIXTEENTH)
                [console]::beep($A, $SIXTEENTH)
                [console]::beep($C, $SIXTEENTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($A, $SIXTEENTH)
                [console]::beep($C, $SIXTEENTH)
                [console]::beep($D, $SIXTEENTH)
                Start-Sleep -m $EIGHTH
                [console]::beep($Dsharp, $EIGHTH)
                Start-Sleep -m $SIXTEENTH
                [console]::beep($D, $EIGHTH)
                [console]::beep($C, $QUARTER)
          }
    
          #Set Speed and Tones
          If ($CHigh -eq $null)
          {
                $WHOLE = 2200
                $HALF = $WHOLE / 2
                $QUARTER = $HALF / 2
                $EIGHTH = $QUARTER / 2
                $SIXTEENTH = $EIGHTH / 2
                $EIGHTHDOT = $EIGHTH + $SIXTEENTH
                $QUARTERDOT = $QUARTER + $EIGHTH
                $SIXTEENTHDOT = $SIXTEENTH + ($SIXTEENTH / 2)
    
                $REST = 37
                $EbelowG = 164
                $GbelowC = 196
                $GbelowCSharp = 207
                $A = 220
                $Asharp = 233
                $B = 247
                $C = 262
                $Csharp = 277
                $D = 294
                $Dsharp = 311
                $E = 330
                $F = 349
                $Fsharp = 370
                $G = 392
                $Gsharp = 415
                $AHigh = 440
                $CHigh = 523
          }
    
          Play-MarioIntro
          Play-MarioIntro2
    
       }
    
  2. Source is maintained under gwMisc

Comments