sox-users@lists.sourceforge.net unofficial mirror
 help / color / Atom feed
From: jungle boogie <jungleboogie0@gmail.com>
To: sox-users@lists.sourceforge.net
Subject: Re: Combine and trim files with silence
Date: Sat, 18 Apr 2020 20:29:39 -0700
Message-ID: <b5db1d19-196b-fab1-9a0d-63fc7ea07d85@gmail.com> (raw)
In-Reply-To: <20200418092812.GA2613@www.stare.cz>

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

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18  5:11 jungle boogie
2020-04-18  5:49 ` Mikko Olkkonen
2020-04-18  9:28 ` Jan Stary
2020-04-19  3:29   ` jungle boogie [this message]
2020-04-27 21:41     ` Jan Stary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-users

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5db1d19-196b-fab1-9a0d-63fc7ea07d85@gmail.com \
    --to=sox-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

sox-users@lists.sourceforge.net unofficial mirror

Archives are clonable: git clone --mirror https://public-inbox.org/sox-users

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.sox
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox
	nntp://news.gmane.io/gmane.comp.audio.sox

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git