sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* Combine and trim files with silence
@ 2020-04-18  5:11 jungle boogie
  2020-04-18  5:49 ` Mikko Olkkonen
  2020-04-18  9:28 ` Jan Stary
  0 siblings, 2 replies; 5+ messages in thread
From: jungle boogie @ 2020-04-18  5:11 UTC (permalink / raw)
  To: sox-users

Hi All,

I'm using SoX v14.4.2 and would like help mixing three files, with 
silence in between two of them.

Problem I want to solve:
Mix three files with, with the longest being shorten to a specific file. 
I also want a 1.5 second pad between short_track.wav and main_file.wav

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`

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`

But you seasoned sox experts already know this means log_track.wav isn't 
used at all. This also cuts off about the last 1.5 seconds of the 
out.wav file as well.

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

Any pointers would be greatly appreciated!


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Combine and trim files with silence
  2020-04-18  5:11 Combine and trim files with silence jungle boogie
@ 2020-04-18  5:49 ` Mikko Olkkonen
  2020-04-18  9:28 ` Jan Stary
  1 sibling, 0 replies; 5+ messages in thread
From: Mikko Olkkonen @ 2020-04-18  5:49 UTC (permalink / raw)
  To: sox-users


[-- Attachment #1.1: Type: text/plain, Size: 1672 bytes --]

Hello,  Maybe pad main_file.wav with 1.5 seconds first separately. Then
`soxi -D main_file.wav` outputs what you need?
M0
PS I am not absolutely sure if you want to mix three files (as "mix" in sox
manual). If yes, then pad (as "pad" in sox manual) between two of them does
not make much sense? padding makes sense in concatenation context not in
mixing context?

On Sat, Apr 18, 2020 at 8:12 AM jungle boogie <jungleboogie0@gmail.com>
wrote:

> Hi All,
>
> I'm using SoX v14.4.2 and would like help mixing three files, with
> silence in between two of them.
>
> Problem I want to solve:
> Mix three files with, with the longest being shorten to a specific file.
> I also want a 1.5 second pad between short_track.wav and main_file.wav
>
> 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`
>
> 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`
>
> But you seasoned sox experts already know this means log_track.wav isn't
> used at all. This also cuts off about the last 1.5 seconds of the
> out.wav file as well.
>
> So is it possible to combine these files and trim to the main file?
>
> Any pointers would be greatly appreciated!
>
>
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

[-- Attachment #1.2: Type: text/html, Size: 2326 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Combine and trim files with silence
  2020-04-18  5:11 Combine and trim files with silence jungle boogie
  2020-04-18  5:49 ` Mikko Olkkonen
@ 2020-04-18  9:28 ` Jan Stary
  2020-04-19  3:29   ` jungle boogie
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Stary @ 2020-04-18  9:28 UTC (permalink / raw)
  To: sox-users

On Apr 17 22:11:00, jungleboogie0@gmail.com 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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Combine and trim files with silence
  2020-04-18  9:28 ` Jan Stary
@ 2020-04-19  3:29   ` jungle boogie
  2020-04-27 21:41     ` Jan Stary
  0 siblings, 1 reply; 5+ messages in thread
From: jungle boogie @ 2020-04-19  3:29 UTC (permalink / raw)
  To: sox-users

Hi Jan,
Thus said Jan Stary <hans@stare.cz> on Sat, 18 Apr 2020 11:28:12 +0200
> On Apr 17 22:11:00, jungleboogie0@gmail.com 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.

Yes, that's probably the correct term.


> 
> Ah, so the three files are
> 
> 1. short_track
> 2. main_file
> 3. long track
> 
> in that order?

Yes, in that order. short_track will have the 1/2 second silence after 
the audible part plays.

> 
> 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.
> 

short_track plays the audible part, then plays 1.5 seconds of silence.
main_file plays simultaneously while long_track plays; long_track is 
several decidable quieter (that's adjusted outside of this sox command I 
want to solve) and trimmed to the length of mainfile.

short track -> silence -> mainfile & long track (which is trimmed to 
length of long track).

Long track should be trimmed to the length of mainfile, which my trim 0 
`soxi -D mainfile` did.

> 
> 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
> 

But this means I need to trim longfile separately, right?

> 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
> 
> 

I hope I haven't made things more muddy.

In summary...

first plays

1/2 seconds of silence

mainfile & longfile play, long file trimmed to length of mainfile.


Mikko had an idea of adding 1/2 of silence to mainfile before the mix 
and trim thing.

sox mainfile mainfile_padded.wav pad 1.5 0

sox -m shortfile mainfile_padded.wav long_file out.wav trim 0 `soxi -D 
mainfile_padded.wav`

It would be great if I didn't have to the extra step of adding silence 
to the main_file first, though.






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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Combine and trim files with silence
  2020-04-19  3:29   ` jungle boogie
@ 2020-04-27 21:41     ` Jan Stary
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Stary @ 2020-04-27 21:41 UTC (permalink / raw)
  To: sox-users

> > Ah, so the three files are
> > 1. short_track
> > 2. main_file
> > 3. long track
> > in that order?
> 
> Yes, in that order. short_track will have the 1/2 second silence after the
> audible part plays.
> 
> short_track plays the audible part,

What "audible part"?

> then plays 1.5 seconds of silence. main_file plays
> simultaneously while long_track plays
  ^^^^^^^^^^^^^^

Ah, so it's _not_ 1,2,3 in that order.

I'm giving up.



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-27 21:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18  5:11 Combine and trim files with silence jungle boogie
2020-04-18  5:49 ` Mikko Olkkonen
2020-04-18  9:28 ` Jan Stary
2020-04-19  3:29   ` jungle boogie
2020-04-27 21:41     ` Jan Stary

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).