sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* Reason for sox mix restriction to two or more input files?
@ 2019-08-09 19:42 Dr. Thomas Tensi
  2019-08-10  9:52 ` Jeremy Nicoll - ml sox users
  0 siblings, 1 reply; 6+ messages in thread
From: Dr. Thomas Tensi @ 2019-08-09 19:42 UTC (permalink / raw)
  To: sox-users

Dear all,


I am using sox for automatic, scripted file generation.

One step is a mix of several input files.  It may happen
that - by configuration - only a single input file remains
for that mixing step.

This cannot be handled by sox, because sox _requires_
at least two input files and quits with the message
   "Not enough input filenames specified"

I understand that at least one input file is necessary
(for finding the target length, sample rate etc.), but
why does sox fail when mixing a single input file?


          Best regards,

                   Thomas


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

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

* Re: Reason for sox mix restriction to two or more input files?
  2019-08-09 19:42 Reason for sox mix restriction to two or more input files? Dr. Thomas Tensi
@ 2019-08-10  9:52 ` Jeremy Nicoll - ml sox users
  2019-08-10 12:06   ` Dr. Thomas Tensi
  2019-08-10 17:28   ` Måns Rullgård
  0 siblings, 2 replies; 6+ messages in thread
From: Jeremy Nicoll - ml sox users @ 2019-08-10  9:52 UTC (permalink / raw)
  To: thomas, sox-users

On 2019-08-09 20:42, Dr. Thomas Tensi wrote:
> Dear all,
> 
> 
> I am using sox for automatic, scripted file generation.
> 
> One step is a mix of several input files.  It may happen
> that - by configuration - only a single input file remains
> for that mixing step.
> 
> This cannot be handled by sox, because sox _requires_
> at least two input files and quits with the message
>   "Not enough input filenames specified"
> 
> I understand that at least one input file is necessary
> (for finding the target length, sample rate etc.), but
> why does sox fail when mixing a single input file?

Probably because it's simpler to write programmes that assume
the user means what they say.  So if you ask sox to mix several
files, it is written assuming that you will provide more than
one.

You say you're using a script to drive this.  That means you are
in control.  Your script can - surely - determine that there's
only one input file and adjust the sox command(s) you're using
accordingly.


-- 
Jeremy Nicoll - my opinions are my own


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

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

* Re: Reason for sox mix restriction to two or more input files?
  2019-08-10  9:52 ` Jeremy Nicoll - ml sox users
@ 2019-08-10 12:06   ` Dr. Thomas Tensi
  2019-08-10 17:28   ` Måns Rullgård
  1 sibling, 0 replies; 6+ messages in thread
From: Dr. Thomas Tensi @ 2019-08-10 12:06 UTC (permalink / raw)
  To: sox-users

Hello Jeremy,


thanks for the explanation!

You wrote:
 > > [sox requires at least two input files for mixing]
 > > I understand that at least one input file is necessary
 > > (for finding the target length, sample rate etc.), but
 > > why does sox fail when mixing a single input file?
 > Probably because it's simpler to write programmes that
 > assume the user means what they say.  So if you ask sox to
 > mix several files, it is written assuming that you will
 > provide more than one.

Hmm, I am not convinced yet.  When I use my analog mixing
desk, I can easily "mix" even one input to the master.  So
mixing should even be possible for one file.

When using sox manually I am fine with changing my command
line accordingly; for an automatic use of a command line
tool boundary cases should just work if there is a
reasonable interpretation.

So
     sox -m -v 0.3 inputfile outputfile
is just equivalent to
     sox -v 0.3 inputfile outputfile

 > You say you're using a script to drive this.  That means
 > you are in control.  Your script can - surely - determine
 > that there's only one input file and adjust the sox
 > command(s) you're using accordingly.

It is a bit more complicated than that, because the script
does not know at all about sox, but is configurable for
arbitrary command-line audio processors.  Unfortunately
the configuration now has to take care of a special case for
single file mixing in sox, where other audio processors
(like e.g. ecasound) have no problem at all.

Nevertheless I found a workaround: I always add a null file
as an input partner for all mixing steps.  This is ugly, but
it works.


         Best regards,

                 Thomas


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

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

* Re: Reason for sox mix restriction to two or more input files?
  2019-08-10  9:52 ` Jeremy Nicoll - ml sox users
  2019-08-10 12:06   ` Dr. Thomas Tensi
@ 2019-08-10 17:28   ` Måns Rullgård
  1 sibling, 0 replies; 6+ messages in thread
From: Måns Rullgård @ 2019-08-10 17:28 UTC (permalink / raw)
  To: Jeremy Nicoll - ml sox users; +Cc: sox-users, thomas

Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk> writes:

> On 2019-08-09 20:42, Dr. Thomas Tensi wrote:
>> Dear all,
>>
>>
>> I am using sox for automatic, scripted file generation.
>>
>> One step is a mix of several input files.  It may happen
>> that - by configuration - only a single input file remains
>> for that mixing step.
>>
>> This cannot be handled by sox, because sox _requires_
>> at least two input files and quits with the message
>>   "Not enough input filenames specified"
>>
>> I understand that at least one input file is necessary
>> (for finding the target length, sample rate etc.), but
>> why does sox fail when mixing a single input file?
>
> Probably because it's simpler to write programmes that assume
> the user means what they say.  So if you ask sox to mix several
> files, it is written assuming that you will provide more than
> one.

There doesn't seem to be any good reason for this.  The below patch
removes the restriction and doesn't seem to break anything based on a
quick test.

diff --git a/src/sox.c b/src/sox.c
index 0b103e269092..39533bac831d 100644
--- a/src/sox.c
+++ b/src/sox.c
@@ -2924,7 +2924,7 @@ int main(int argc, char **argv)
     combine_method = sox_concatenate;
 
   /* Make sure we got at least the required # of input filenames */
-  if (input_count < (size_t)(is_serial(combine_method) ? 1 : 2))
+  if (input_count < 1)
     usage("Not enough input filenames specified");
 
   /* Check for misplaced input/output-specific options */


-- 
Måns Rullgård


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

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

* Re: Reason for sox mix restriction to two or more input files?
@ 2019-08-11 19:22 Dr. Thomas Tensi
  2019-08-12  9:29 ` Måns Rullgård
  0 siblings, 1 reply; 6+ messages in thread
From: Dr. Thomas Tensi @ 2019-08-11 19:22 UTC (permalink / raw)
  To: sox-users

Hello Måns,


thanks for your effort!

I have the same opinion: mixing should be possible for
a single input.

Nevertheless be careful with your patch: one has to
check whether other operations (like multiply) are
still meaningful for a single input.  I think so,
but I have not looked deeply into that.


        Best regards,

                 Thomas



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

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

* Re: Reason for sox mix restriction to two or more input files?
  2019-08-11 19:22 Dr. Thomas Tensi
@ 2019-08-12  9:29 ` Måns Rullgård
  0 siblings, 0 replies; 6+ messages in thread
From: Måns Rullgård @ 2019-08-12  9:29 UTC (permalink / raw)
  To: Dr. Thomas Tensi; +Cc: sox-users

"Dr. Thomas Tensi" <t.tensi@gmx.de> writes:

> Hello Måns,
>
> thanks for your effort!
>
> I have the same opinion: mixing should be possible for
> a single input.
>
> Nevertheless be careful with your patch: one has to
> check whether other operations (like multiply) are
> still meaningful for a single input.  I think so,
> but I have not looked deeply into that.

I tested the merge, mix, and multiply options with a single input, and
it came out unchanged.  Seems like reasonable behaviour to me.

-- 
Måns Rullgård


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

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

end of thread, other threads:[~2019-08-12  9:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 19:42 Reason for sox mix restriction to two or more input files? Dr. Thomas Tensi
2019-08-10  9:52 ` Jeremy Nicoll - ml sox users
2019-08-10 12:06   ` Dr. Thomas Tensi
2019-08-10 17:28   ` Måns Rullgård
  -- strict thread matches above, loose matches on Subject: below --
2019-08-11 19:22 Dr. Thomas Tensi
2019-08-12  9:29 ` Måns Rullgård

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