I need to split wav files into multiple 10-second-long wav files, but each resulting wav file must be exactly 10 seconds in length, adding silence if needed – so if a wav file's duration in seconds isn't a multiple of 10, the last wav file should be padded with silence.
I've seen some answers (1, 2, 3) which show how to use sox and ffmpeg to split a file into chunks of equal length:
$ ffmpeg -i file.wav -f segment -segment_time 10 -c copy out%03d.wav
$ sox file.wav output-.wav trim 0 10 : newfile : restart
but the last file produced by these commands is usually less than 10 seconds long. Is there a way to split a wav file, padding the last file if needed, in the same command?