How to edit audios so that they have the same length I have a dataset of audio files, which differ on their lengths by a couple of milliseconds. Some are little shorter than 1s and some are little longer than 1s. They all have the same sampling rate, namely 20kHz, what differs is the number of samples.

Does anyone know a way to automatically transform them into 1s audio files with 20kHz sampling rate?

EDIT:
I need to transform the audios to having the same length so that I can input them into a standard fully-connected neural network. 

Cutting the audio in the beginning and at the end would be the best solution, I think, if the audio is longer than 1 second. For example, if the audio is longer 1.1s, then I would like to cut the audio by 5ms in the beginning and the end to transform it to a 1s audio? And if the data is shorter, somehow putting some "silence" at the end of the data?

Thank you in advance!
ImageMagick is a great tool to edit multiple images in the command line. Thanks to your question, I just discovered SoX, or Sound eXchange:


  SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line
  utility that can convert various formats of computer audio files in to
  other formats. It can also apply various effects to these sound files,
  and, as an added bonus, SoX can play and record audio files on most
  platforms.


It can trim, crop, cut multiple files (and resample too), see for instance:


Editing Multiple Mono Sound Files in SoX,
Audio format conversion cheat sheet (aka how to)


For shorter files, an option is to create a silence file, happen  it, and crop again, see for instance: Linux command to extend the duration of audio files.