Making Music With SQL Server

This is an old post, but I’m turning Thomas Rushton’s idea into a lightning talk for the .NET User Group.  Basically, the idea is that you can call Console.Beep with different pitches and for different lengths of time, with the end result being music.

I’m also going to demo the Super Mario Brothers theme.  Here’s a C# version.  The quick translation to Powershell is:

[console]::beep(659, 125);
[console]::beep(659, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 167;
[console]::beep(523, 125);
[console]::beep(659, 125);
Start-Sleep -m 125;
[console]::beep(784, 125);
Start-Sleep -m 375;
[console]::beep(392, 125);
Start-Sleep -m 375;
[console]::beep(523, 125);
Start-Sleep -m 250;
[console]::beep(392, 125);
Start-Sleep -m 250;
[console]::beep(330, 125);
Start-Sleep -m 250;
[console]::beep(440, 125);
Start-Sleep -m 125;
[console]::beep(494, 125);
Start-Sleep -m 125;
[console]::beep(466, 125);
Start-Sleep -m 42;
[console]::beep(440, 125);
Start-Sleep -m 125;
[console]::beep(392, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 125;
[console]::beep(784, 125);
Start-Sleep -m 125;
[console]::beep(880, 125);
Start-Sleep -m 125;
[console]::beep(698, 125);
[console]::beep(784, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 125;
[console]::beep(523, 125);
Start-Sleep -m 125;
[console]::beep(587, 125);
[console]::beep(494, 125);
Start-Sleep -m 125;
[console]::beep(523, 125);
Start-Sleep -m 250;
[console]::beep(392, 125);
Start-Sleep -m 250;
[console]::beep(330, 125);
Start-Sleep -m 250;
[console]::beep(440, 125);
Start-Sleep -m 125;
[console]::beep(494, 125);
Start-Sleep -m 125;
[console]::beep(466, 125);
Start-Sleep -m 42;
[console]::beep(440, 125);
Start-Sleep -m 125;
[console]::beep(392, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 125;
[console]::beep(784, 125);
Start-Sleep -m 125;
[console]::beep(880, 125);
Start-Sleep -m 125;
[console]::beep(698, 125);
[console]::beep(784, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 125;
[console]::beep(523, 125);
Start-Sleep -m 125;
[console]::beep(587, 125);
[console]::beep(494, 125);
Start-Sleep -m 375;
[console]::beep(784, 125);
[console]::beep(740, 125);
[console]::beep(698, 125);
Start-Sleep -m 42;
[console]::beep(622, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 167;
[console]::beep(415, 125);
[console]::beep(440, 125);
[console]::beep(523, 125);
Start-Sleep -m 125;
[console]::beep(440, 125);
[console]::beep(523, 125);
[console]::beep(587, 125);
Start-Sleep -m 250;
[console]::beep(784, 125);
[console]::beep(740, 125);
[console]::beep(698, 125);
Start-Sleep -m 42;
[console]::beep(622, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 167;
[console]::beep(698, 125);
Start-Sleep -m 125;
[console]::beep(698, 125);
[console]::beep(698, 125);
Start-Sleep -m 625;
[console]::beep(784, 125);
[console]::beep(740, 125);
[console]::beep(698, 125);
Start-Sleep -m 42;
[console]::beep(622, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 167;
[console]::beep(415, 125);
[console]::beep(440, 125);
[console]::beep(523, 125);
Start-Sleep -m 125;
[console]::beep(440, 125);
[console]::beep(523, 125);
[console]::beep(587, 125);
Start-Sleep -m 250;
[console]::beep(622, 125);
Start-Sleep -m 250;
[console]::beep(587, 125);
Start-Sleep -m 250;
[console]::beep(523, 125);
Start-Sleep -m 1125;
[console]::beep(784, 125);
[console]::beep(740, 125);
[console]::beep(698, 125);
Start-Sleep -m 42;
[console]::beep(622, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 167;
[console]::beep(415, 125);
[console]::beep(440, 125);
[console]::beep(523, 125);
Start-Sleep -m 125;
[console]::beep(440, 125);
[console]::beep(523, 125);
[console]::beep(587, 125);
Start-Sleep -m 250;
[console]::beep(784, 125);
[console]::beep(740, 125);
[console]::beep(698, 125);
Start-Sleep -m 42;
[console]::beep(622, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 167;
[console]::beep(698, 125);
Start-Sleep -m 125;
[console]::beep(698, 125);
[console]::beep(698, 125);
Start-Sleep -m 625;
[console]::beep(784, 125);
[console]::beep(740, 125);
[console]::beep(698, 125);
Start-Sleep -m 42;
[console]::beep(622, 125);
Start-Sleep -m 125;
[console]::beep(659, 125);
Start-Sleep -m 167;
[console]::beep(415, 125);
[console]::beep(440, 125);
[console]::beep(523, 125);
Start-Sleep -m 125;
[console]::beep(440, 125);
[console]::beep(523, 125);
[console]::beep(587, 125);
Start-Sleep -m 250;
[console]::beep(622, 125);
Start-Sleep -m 250;
[console]::beep(587, 125);
Start-Sleep -m 250;
[console]::beep(523, 125);
Start-Sleep -m 625;

And let’s not stop there:  play the Imperial March if you wish.

Advertisements

One thought on “Making Music With SQL Server

  1. thomasrushton says:

    I hope it goes well!

    Unfortunately, I can’t do this sort of thing at my current job – everything’s been virtualised.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s