0

I have this two commands in SoX:

  rec -V3 output.wav trim 0 50 
  sox output.wav out.wav trim 0 10 : newfile : restart

I need to do this work but in only one command line.

I need the recorded file "output.wav" to be trimmed into several files of 10 sec.

Sled
  • 18,541
  • 27
  • 119
  • 168
EzeEst
  • 117
  • 1
  • 11

1 Answers1

1

You can combine them via a pipe, like this:

rec -p trim 0 50 | sox -p out.wav trim 0 10 : newfile : restart

The -p option is shorthand for -t sox -, i.e. write to stdout/read from stdin using SoX’s internal format.

In this particular case, you could also unroll the restart loop and do it in one invocation, like this:

rec out.wav trim 0 10 : newfile : trim 0 10 : newfile : trim 0 10 : newfile : trim 0 10 : newfile : trim 0 10

That’s not always possible, of course.

chirlu
  • 3,141
  • 2
  • 21
  • 22