|All requests||>||Merge WAV files or convert MP3 to WAV...||>||Request new recommendation||>||Featured requests||>||No recommendations|
by Sameeroaf Bazivitch - 5 years ago (2014-11-02)
I was able to use file_get_contents and file_put_contents to merge a number of MP3 audio files into a single MP3 file successfully.
I tried to do the same with WAV audio files, which I really need, but PHP takes the first WAV file and skips all the rest so the result is a WAV file with the first input wav file from the list.
If that is difficult or not possible to merge WAV files, then I need to convert the MP3 file into WAV with the ability to change the sample rate if possible.
You can't merge multiple WAV files like you can with concatenating multiple MP3 because the WAV format header needs to be rebuilt to consider that your WAV audio data is made of multiple parts.
MP3 is based on MPEG, so it is frame based and you can start playing frames from the middle of the stream.
Anyway, the WAV creator class can compose the result WAV file made of multiple WAV files as you wish, so you do not need to convert to MP3.