Writing a square wave to direct sound