Hello,
I use sox for converting and merging vox-files in a shell script. But
the vox files often have different duration in seconds and I want to
make sure that the shorter file always has the duration of the longer
file before merging.
With soxi -D <file.vox> I get the length in seconds. If the differences
between the two files are greater than 2 seconds, I calculate the
stretch factor. The “problem” now is that the stretched file is often
longer than the longer file itself, e.g.
soxi -D fileA.vox = 870.408000
soxi -D fileB.vox = 868.360000
stretch factor = 1.00235846883780920355
The used command for stretching is:
sox -r 8000 -t vox “$fileB” -r 8000 -t vox
“${work_dir}/fileB_stretched.vox” stretch “$factor”
But the unexpected result of stretching this file is
soxi -D ${work_dir}/fileB_stretched.vox = 875.197500
I don't know how this inaccuracy is caused. Is there a way to stretch it
more accurately?
chatgpt says that the cause of the deviation is probably due to the
block sizes of the VOX format or rounding errors when calculating the
sample length. A precise solution requires either post-processing of the
stretched file (e.g. with trim) or the use of a lossless format such as
WAV for intermediate processing. However, I achieved the same result
with these files in WAV format and I dont want to use trim.
Any idea?
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users