Re: stretching files, unexpected duration after stretching file
SoX NG <[email protected]> Tue, 21 Jan 2025 09:31:47 +0100
| Newsgroups | gmane.comp.audio.sox |
|---|---|
| Message-ID | <[email protected]> |
On 13/01/25 20:07, Thomas Barth via Sox-users wrote:
>
> 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.
Long story short: yes, "stretch" does create a slightly longer file than
is mathematically expected because it has a "drain" phase in which it
empties out what's left in the delay line it uses to create the effect.
"tempo", despite having a drain phase, does seem to get the length as
expected.
M
_______________________________________________
Sox-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sox-users