Audio Debugging your Program


It may seem obvious but the number of times I have to teach this in my professional career, it's about time I wrote a handy blog post I can direct people to this page for a refresher is unbelievable, so here it is...

Debugging your Application with Audio!

Sometimes you just want to know that you took the right branch in an if statement, or that the value of a variable is what you expect it to be. Sometimes you don't have the need, time or incentive to fire up the debugger, you just want to dump a few variables to a standard out channel (stdout for example).
echo "here";

This works really well if you're writing a CLI script and it's okay if you're working on some old-fashioned HTML, but when it comes to debugging OAuth issues or (yay!) AJAX requests, it's pretty useless and will get harder as we move towards an API driven future. The pain you go through sometimes to wrangle a response from what you are debugging and hope the data comes back to the browser then find it with something like web inspector, or go grinding through the network activity on a web developer console to find that particular requested document, click to look at the contents and dig out that debug message from the raw source.... So Slow... Not fun!

For me, this method of debugging is really useful since it allows me to debug an issue quickly, of course this is not the perfect method for working on a live service (unless you have to proper precautions in place). However, virtualisation (A blog post on which can be found here) technologies are allowing us to build smaller scale replicas of these systems in less clandestine environments that allow us to reproduce issues quicker and easier - meaning the fix comes quicker and easier!


Where was the audio?

Ok, if you are going to be that picky, now you have primed your execution flow with different logging, or print statements if you are cheating... You can pipe these directly into something like festival or for a Mac, the say command:

$ python execution_flow_test.py | say
You can even change the voice with:
$ python execution_flow_test.py | say -v whisper
See what files you have installed!
$ say -v?
...was that loud enough for you?