Skip to main content

Topic: SoX batch that trims beginning and end of file? (Read 1506 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • th0m
  • [*]
SoX batch that trims beginning and end of file?
Could someone help me with this? I would like a simple drag-and-drop batch file that trims a few samples at the beginning and end of a wav-file.

Any suggestion what the command line should be? Can't seem to sort it out myself.

  • chi
  • [*]
SoX batch that trims beginning and end of file?
Reply #1
Any suggestion what the command line should be? Can't seem to sort it out myself.


With SoX 14.4.0,
Code: [Select]
sox in.wav out.wav trim 10s -20s
does it (where 10 and 20 are the number of samples to be removed from the beginning and end, respectively).

  • bandpass
  • [*][*][*][*]
SoX batch that trims beginning and end of file?
Reply #2
There's an example drag and drop batch file in the standard SoX windows distribution, so you copy and modify it per chi's suggestion.

  • th0m
  • [*]
SoX batch that trims beginning and end of file?
Reply #3
Perfect, thanks.

Ended up with this:
cd %~dp0
mkdir trimmed
FOR %%A IN (%*) DO sox %%A "trimmed/%%~nxA" trim Xs -Xs
pause


Works like a charm.
  • Last Edit: 17 June, 2012, 03:14:22 PM by th0m