Bulk Trim wav files

Trim Audio files - 60 seconds

The SOX command to trim an audio file is:

sox <name-of-audio-file> <name-of-timmed-audio-file> trim 0 60

This example would trim from 0 seconds to 60 seconds.

@echo off
path=%path%;C:\Program Files (x86)\sox-14-4-2
cls

set confirm=N
echo ***************************
echo Audio ALAW Converting tool
echo ***************************
echo The sox.exe must be located in the current folder or on the OS PATH.
echo Download sox from http://sox.sourceforge.net/
echo ******************************************************************
echo. 
set /P confirm=Do you want to proceed and overwrite and TIM WAV wav files?

IF "%confirm%" == "Y" goto convert
IF "%confirm%" == "y" goto convert
goto noconvert


:convert
echo Trim files now.
echo please wait.....
echo.
FOR /R . %%i IN ("*.wav") DO (
sox "%%i" "%%~pni-temp.wav" trim 0 60
move "%%~pni-temp.wav" "%%~pni.wav"
)

pause
exit

:noconvert
echo No converation took place
pause
exit
  • tech-notes/scripts/bulk-audio-trim.txt
  • Last modified: 2023/10/12 19:17
  • by gerardorourke