Combining .wav files from the command line

6,579

This is because the RIFF header contains information about the duration of the file. You need to remove the RIFF headers from all files and create a new one describing the new file. You're treating them like RAW files, which they aren't

You can use sox for this, that would be a better approach

http://sox.sourceforge.net/

The windows binary download is at

http://sourceforge.net/projects/sox/files/sox/

You can also use it to render a png file containing the FFT data and stuff like that. It's a very neat tool.

https://stackoverflow.com/questions/9457020/merge-2-audio-files-in-sox

Share:
6,579

Related videos on Youtube

user02103012
Author by

user02103012

Updated on September 18, 2022

Comments

  • user02103012
    user02103012 almost 2 years

    I am currently in a directory with command prompt open, and combining wav files using the command

    copy /b *.wav allAudio.wav
    

    There are 29 wav files in this directory, each of them exactly 00:00:59 in length.

    However, the combined "allAudio.wav" file generated by this command has a file size corresponding to all the merged .wav files in the directory, but the length of the file is only 00:00:59 just like all of the other .wav files in the directory.

    This does not make sense to me. If anyone can explain this and suggest a way to actually merge the files such that the final file is correct in length would be great.

    Here is the current directory

    In total I have more folders containing several hundred wav files that need to be merged, so any software that merges one-at-a-time is not feasible for this task.

    • user02103012
      user02103012 over 8 years
      So does Windows have a utility like "shntool" for Linux that can strip RIFF headers in bulk?
  • user02103012
    user02103012 over 8 years
    It's funny you mention sox. I was originally planning to use that utility where these files were originally located but there is no way for me to ssh into the server (blocked ports, firmware updates screwing up network protocols in Win10 rendering ethernet adapter useless). So there's no native options in Windows to strip RIFF headers aside from 3rd party software?
  • Daniel F
    Daniel F over 8 years
    I don't understand the problem. as long as you can copy /b you should also be able to run sox. Could you elabroate?
  • user02103012
    user02103012 over 8 years
    Let me clarify. Is sox a command I can use in Windows? I thought it was native to Linux.
  • Daniel F
    Daniel F over 8 years
    SoX is a cross-platform (Windows, Linux, MacOS X, etc.)
  • Daniel F
    Daniel F over 8 years
    Updated the answer with the download link
  • user02103012
    user02103012 over 8 years
    Yes, I see that now from the link you provided. This greatly helps. I will try using this utility and Google/man-page if anything comes up.