Following on from our exchange of comments, I'm ready to call this an answer. There are PHP classes ready made for dealing with wav files. I googled "php wav file" and
this[
^] looks a good place to start. A couple of others on the first google page look useful too.
Cheers,
Peter
If you like, vote and accept the answer.