Re: Combine and trim files with silence

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

 



On Apr 17 22:11:00, jungleboogie0@xxxxxxxxx wrote:
> I'm using SoX v14.4.2 and would like help mixing three files, with silence
> in between two of them.

With silence in between, you probably mean to concatenate them,
not to "mix" them.

> Problem I want to solve:
> Mix three files with, with the longest being shorten to a specific file.

Is this unnamed specific file a fourth file,
or one of the unspecified three?

> I also want a 1.5 second pad between short_track.wav and main_file.wav

What _three_ files are those then
and in what order do you want to concatenate them?

> What I've tried:
> sox -m main_file.wav long_track.wav -p pad 1.5 0 | sox - -m short_track.wav
> -t wavpcm out.wav trim 0 0 `soxi -D main_file.wav`

Ah, so the three files are

1. short_track
2. main_file
3. long track

in that order?

Which one is "the longest"
and to which file's length do you want to shorten it?

> Problem is that the file cuts off about 1.5 seconds too quick, which is how
> long my pad is.
> 
> I've also tried creating a blank file:
> sox -n -r 16000 -b 16 -c 1 silence.wav trim 0.0 1.5
> 
> Then combining it:
> sox short_track.wav silence.wav main_file.wav long_track.wav out.wav trim 0
> `soxi -D main_file.wav`

This trims the length of out.wav,
not "the longest" of the three files
(whichever it is).

Is main_file the "specific file"
whose lenght you want to use to shorted "the longest"?

> But you seasoned sox experts already know this means
> log_track.wav isn't used at all.

Of course: out.wav gets trimmed before the input even gets to it,
being that main_file itself is one of the inputs.

> This also cuts off about the last 1.5 seconds of the out.wav
> file as well.

It trims out.wav to the length of main_file.

> So is it possible to combine these files and trim to the main file?

Trim _what_ to to length of the main file?


In short, you mail is a mess. Tell us what you you need to do _and_why_.
Be as specific as possible. Don't talk about "the longest file" without
showing the lengths, or "a specific file" without naming it, etc.


Trimming a file to another file's length is easy:
sox third.wav trimmed.wav trim 0 `soxi -D prototype.wav`
soxi -D prototype.wav third.wav trimmed.wav


To concatenating three files, with silence between (say) first and second,
just pad the first with silence first:

sox first.wav padded.wav pad 0 1.5
soxi -D first.wav padded.wav

Then just contatenate them:

sox padded.wav second.wav trimmed.wav out.wav
soxi -D padded.wav second.wav trimmed.wav out.wav
rm -rf padded.wav trimmed.wav



_______________________________________________
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