Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: SoX batch that trims beginning and end of file? (Read 3582 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

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.

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).

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.

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.