This code comes from R.L's excellent work.
It generates a sine wave wav file of your chosen frequency and duration.
Can you modify this to let the user enter an arbitrary sound wave? What would the input look like? That would be fun.
NOTE: Rerun this a few times if you hit errors. It is fairly taxing on Utility Mill :-(