It’s that time of year again where we get to eat unlimited mince pies, watch repeats of old Christmas Classics and listen to cheesy Christmas music. It’s also a time of year to give to others so thought I would share this little bit of fun…
There is a backstory to this and a purposeful reason for creating it. Basically, I was working on a script which was quite large and was doing quite a lot of calculation, it was late at night and running it took about a good 10-20 mins (ok, not that long, but long enough to make you want to go full Hulk mode when it hangs indefinitely).
The problem, as all you Dynamoers would empaphise with, is that you just don’t always know how long the script will take nor how far through it you are. There’s nothing quite as boring as watching the Blue Circle of Infinte Boredom! So, while waiting, and thinking of Mince Pies and partially observing Home Alone in the periphery of my vision with it’s cheesy Christmas music, I had an idea… what if I just added sound to my script as an Audio Debugging utility?
So, I cracked open another Dynamo while my other script was preoccupied with the Blue Circle and imported the winsound module into a new Python node. There is a method called Beep, perfect, I didn’t want anything fancy, just a short and sweet notification that I’m getting somewhere. I created a new node for my library which takes a few parameters (frequency, duration, repeat & data – the data input is what triggers the sound to play, when the input data has changed it flags the node for re-execution) and chucked the new Bleep node into “The Beast” script and run! Speakers on full I can now stretch my legs, head to the kitchen and grab those Mince Pies and give Home Alone my full attention while always knowing how far my script is. As it was running I could hear it beep on every iteration and on completion I had lovely 8-bit Mario style Game-Over jingle letting me know when it was done and also giving me a cue to stop munching and watching TV and get back to work!
Home Alone long since finished I decided to quickly create a Dynamo Keyboard and having Christmas Jingles etched into memory I thought I would do Deck the Halls…why not! It is nowhere near as good as Ben Goh’s amazing White Christmas Dynamo Script, mine actually sounds horrendous when listened after listening to his, but I wanted something pythonic so I could chuck it in any of my nodes and debug this way. Here is my rendition of Deck the Halls…
If you enjoyed I would be slightly concerned, however, I found using sound really useful when testing scripts, I also dicovered that perhaps one reason Dynamo takes longer sometimes is that it actually executes twice! I did not know this, but when changing some nodes (like python based nodes) or multiple places in the script it will run, then run again.
Anyway, with that said, I will end this on wishing all that are reading an awesome Christmas and a great New Year.
Thanks!
Dan
Leave a Reply