UPDATE! I have added a PowerShell-v2-compatible version at the bottom of the post.
Combining Jeffreys prompts with my code should take you a long way towards getting in the right Christmas mood. Note, that although I’m not a total beginner when it comes to music, working with Console.Beep is kind of restricting, so take it for what it is.
While writing my little Christmas melody, I tried to keep with the PowerShell best practices as well. I started out hard-coding the note frequencies in an array, but scrapped it and created a function to automatically convert a note name to it’s corresponding frequency instead. While I were at it, I added the MIDI note number as well, in case anyone might need that. And to top it of, I added a method that let you play the note.
I’d like to challenge my fellow PowerShell scripters to create more cool PowerShell music! If you do make something, please leave me a comment below so I can have a listen 🙂