Appending many files with a 2s break inbetween

Hello everyone,

Not sure if I chose the right tags. I saw this question answered elsewhere but the solution did not work at all. Here’s the issue. I want to prepare a long file for voice cloning. I have around 200 very short clips. I want to append them into a single file, and automatically insert a 1 or 2s pause between each clip. File/Open tries to pen each file in a different instance of Audacity (by the way, there should be a warning before Audacity starts to do this…right now, it’s CTRL+Alt+Del or crash). File Import works, but I am left with clips on different tracks, all starting at 0. Short of manually moving clips to one single track and creating the pause between each, is there a way to automate this? Perhaps a script if there is no built-in functionality?

Thank you for your suggestions

What type of clips are they: mp3? wav?

You can join audio clips using ffmpeg or a Python script with appropriate libraries. If I was doing this I’d use Python simply because of the need to insert the pause/silence between clips.
Do the clips have to go in a very specific order? I would assume they do.
The best solution depends on whether you need to do this many times or just once.

1 Like

Make an audio file of a few seconds of silence. Audacity can generate one for you and save it.

Call it Silence.wav or whatever you want.

Make a text file containing the filenames of the files you wish to concatenate. Between each of the files, add the silence audio file. Like this…

content of Filelist.txt

file 'input1.mp4'
file 'Silence.wav'
file 'input2.mp4'
file 'Silence.wav'
file 'input3.mp4'

Run FFMPEG using the Filelist.txt file as the input and whatever filename you want as the output. FFMPEG will make one big audio file for you.

I’ve left a lot of details out, just to demonstrate the concept.

1 Like

All Wavs. Any order,as the clips are unrelated in terms of content (Same voice but that’s all). I think I’ll try both routes and see how easy/difficult it is as I may have to do this several times. Thank you for your suggestions.

Thank you very much. I will try though I suspect a Python script is going to be easier if I do this multiple times.

This batch file will generate the file list for whatever folder it is currently in…

Copy nul Filelist.txt > nul
FOR %%f IN (*.wav) DO (
 echo file '%%f' >> Filelist.txt
 echo file 'Silence.wav' >> Filelist.txt)
1 Like

That is impressively brief. :trophy:

I’ve been programming computers since 1976, and back then, they only had about 2000 bytes of memory. Tight code was very necessary then, and I guess I’ve kept that discipline my whole life.

1 Like

If the exact FFMPEG command is needed, I can provide that, but not until I get home. I do not have FFMPEG on my work computer, and they won’t let me install anything.

1 Like

I wonder if that would also work with the command line (terminal in macOS and Linux), without ffmpeg:

cat file1.wav silence.wav file2.wav file3.wav silence.wav file4.wav > newfile.wav

For wave files, it might, because they are basically just in-memory images.
Other audio file types, probably not.

1 Like

With such a background my guess is you wish OTHER coders were still devoted to writing tight code. I know I do. Think what modern software would be like. I read a fascinating article about the software running the space shuttle; which HAD to work properly. At its worst it had no more than 11 bugs. Contrast that with the 144,000 or so in Ubuntu Linux.

1 Like

That’s brill. Thank you so much.

Yeah but if there’s a bug in Windows, I throw a tantrum. If there’s a bug on the space shuttle, well, you know, more than a tantrum. Still, this is a really useful skill I should try and acquire, even in my old age.