Re: Reason for sox mix restriction to two or more input files?

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

 



Jeremy Nicoll - ml sox users <jn.ml.sxu.88@xxxxxxxxxxxxxxxxxxxx> 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@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