2022-12-04 10:40:18 +01:00
|
|
|
## The *play-jingle-bells.ps1* Script
|
2021-11-08 21:36:42 +01:00
|
|
|
|
2022-11-17 19:46:02 +01:00
|
|
|
This PowerShell script plays the famous Jingle Bells song.
|
2021-11-08 21:36:42 +01:00
|
|
|
|
|
|
|
## Parameters
|
|
|
|
```powershell
|
2021-12-09 16:19:09 +01:00
|
|
|
play-jingle-bells.ps1 [<CommonParameters>]
|
2021-11-08 21:36:42 +01:00
|
|
|
|
|
|
|
[<CommonParameters>]
|
|
|
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
|
|
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
|
|
|
```
|
|
|
|
|
|
|
|
## Example
|
|
|
|
```powershell
|
|
|
|
PS> ./play-jingle-bells
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
## Notes
|
2022-11-17 19:46:02 +01:00
|
|
|
Author: Markus Fleschutz | License: CC0
|
2021-11-08 21:36:42 +01:00
|
|
|
|
|
|
|
## Related Links
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
|
2022-11-17 20:02:26 +01:00
|
|
|
## Source Code
|
2022-11-17 20:05:34 +01:00
|
|
|
```powershell
|
2022-11-17 20:02:26 +01:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Plays Jingle Bells
|
|
|
|
.DESCRIPTION
|
|
|
|
This PowerShell script plays the famous Jingle Bells song.
|
|
|
|
.EXAMPLE
|
|
|
|
PS> ./play-jingle-bells
|
|
|
|
.LINK
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
.NOTES
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
|
|
|
#>
|
|
|
|
|
|
|
|
$Notes = New-Object -TypeName psobject -Property @{
|
|
|
|
REST = 0
|
|
|
|
GbelowC = 196
|
|
|
|
A = 220
|
|
|
|
Asharp = 233
|
|
|
|
B = 247
|
|
|
|
C = 262
|
|
|
|
Csharp = 277
|
|
|
|
D = 294
|
|
|
|
Dsharp = 311
|
|
|
|
E = 330
|
|
|
|
F = 349
|
|
|
|
Fsharp = 370
|
|
|
|
G = 392
|
|
|
|
Gsharp = 415
|
|
|
|
AA = 440
|
|
|
|
AAsharp = 466
|
|
|
|
BB = 493
|
|
|
|
CC = 523
|
|
|
|
CCsharp = 554
|
|
|
|
DD = 587
|
|
|
|
DDsharp = 622
|
|
|
|
EE = 659
|
|
|
|
FF = 698
|
|
|
|
FFsharp = 740
|
|
|
|
GG = 784
|
|
|
|
GGsharp = 830
|
|
|
|
}
|
|
|
|
$Duration = New-Object -TypeName psobject -Property @{
|
|
|
|
WHOLE = 1600
|
|
|
|
HALF = 800
|
|
|
|
QUARTER = 400
|
|
|
|
EIGHTH = 200
|
|
|
|
SIXTEENTH = 100
|
|
|
|
}
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.HALF )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.D, $Duration.HALF )
|
|
|
|
Start-Sleep -m $Duration.EIGHTH
|
|
|
|
[System.Console]::Beep($Notes.D, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.E, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.E, $Duration.HALF)
|
|
|
|
Start-Sleep -m $Duration.EIGHTH
|
|
|
|
[System.Console]::Beep($Notes.E, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.HALF )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.C, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.D, $Duration.HALF )
|
|
|
|
Start-Sleep -m $Duration.QUARTER
|
|
|
|
[System.Console]::Beep($Notes.D, $Duration.EIGHTH )
|
|
|
|
[System.Console]::Beep($Notes.E, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.DD, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.F, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.HALF)
|
|
|
|
Start-Sleep -m $Duration.EIGHTH
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.HALF)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.F, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.HALF)
|
|
|
|
Start-Sleep -m $Duration.EIGHTH
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.AA, $Duration.EIGHTH)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.CC, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.BB, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.G, $Duration.QUARTER)
|
|
|
|
[System.Console]::Beep($Notes.F, $Duration.HALF)
|
|
|
|
exit 0 # success
|
2022-11-17 20:05:34 +01:00
|
|
|
```
|
2022-11-17 20:02:26 +01:00
|
|
|
|
2021-11-08 21:36:42 +01:00
|
|
|
*Generated by convert-ps2md.ps1 using the comment-based help of play-jingle-bells.ps1*
|