SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Making music with Powershell

Happy holidays everyone! Ok, this isn’t even remotely related to SQL Server but it sounded fun. I found someone playing music using Powershell (I lost the link, sorry) and thought Christmas Music! (Yes, I’m Jewish and I probably should have done The Dreidel Song or something but I didn’t think of it until it was too late.) So without further ado here is Jingle Bells done in Powershell.

$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
    }


[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.C, $Duration.HALF   )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.D, $Duration.HALF   )
Start-Sleep -m $Duration.EIGHTH
[console]::beep($Notes.D, $Duration.EIGHTH )
[console]::beep($Notes.E, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)

[console]::beep($Notes.E, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[console]::beep($Notes.E, $Duration.EIGHTH)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.C, $Duration.HALF   )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.EIGHTH )
[console]::beep($Notes.C, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.D, $Duration.HALF   )
Start-Sleep -m $Duration.QUARTER
[console]::beep($Notes.D, $Duration.EIGHTH )


[console]::beep($Notes.E, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.EIGHTH)
[console]::beep($Notes.DD, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.HALF)
[console]::beep($Notes.CC, $Duration.HALF)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)

[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.EIGHTH)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.HALF)
[console]::beep($Notes.CC, $Duration.HALF)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)

[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.HALF)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.HALF)
Start-Sleep -m $Duration.EIGHTH
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.EIGHTH)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.QUARTER)
[console]::beep($Notes.AA, $Duration.EIGHTH)
[console]::beep($Notes.AA, $Duration.EIGHTH)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.CC, $Duration.QUARTER)
[console]::beep($Notes.BB, $Duration.QUARTER)
[console]::beep($Notes.G, $Duration.QUARTER)
[console]::beep($Notes.F, $Duration.HALF)

And here is where I got the frequencies for the notes, the sheet music etc.

List of frequencies

Sheet music

Console.Beep

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

Comments

Leave a comment on the original post [sqlstudies.com, opens in a new window]

Loading comments...