Re: trim slow with multiple files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Klaus Kauker <mail@xxxxxxxxxxxxxxx> wrote:
> Hey there
> 
> if I play one single file with e.g. 30 seconds in it plays pretty much instantly. e.g.: play file1.mp3 trim 30

Right, src/sox.c has optimize_trim() when trim is the
first effect but AFAIK it only affects single inputs

> If I pass more than one file sox somehow takes much longer to seek to the desired position: play file1.mp3 file2.mp3 trim 30

Yeah, the optimize_trim() function only triggers with single inputs.

Maybe Jan has a faster computer and didn't notice "trim 30"
taking longer to start than no trim at all.  Using a larger
value (e.g. "trim 300" on longer audio files) will make a more
noticeable delay for faster computers.

> I think modifying the command to: play file1.mp3 trim 30 ; play file2.mp3 works fine in most cases but it introduces an audible gap between the files.

Right, that will restart your audio device, and AFAIK sox doesn't
make use of the metadata required for gapless mp3 playback.
(FLAC and most other formats don't need special code for gapless)

> Is there a solution for gapless playback and fast trimming?

You can have two sox invocations write to the same pipe via
subshell:

 FMT='-t s32 -r 44100 -c2' # any format will work, but it has to be consistent
 (sox file1.mp3 $FMT - trim 30 && sox file2.mp3 $FMT -) | play $FMT -

I expect the gaps will still be there with mp3 files, though.


_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux