From: "Måns Rullgård" <mans@mansr.com>
To: Jeremy Nicoll - ml sox users <jn.ml.sxu.88@wingsandbeaks.org.uk>
Cc: sox-users@lists.sourceforge.net, thomas@tensi.eu
Subject: Re: Reason for sox mix restriction to two or more input files?
Date: Sat, 10 Aug 2019 18:28:43 +0100 [thread overview]
Message-ID: <yw1x7e7ldj5g.fsf@mansr.com> (raw)
In-Reply-To: <f8fcdf1156c2691934c68a3b8287d3b5@wingsandbeaks.org.uk> (Jeremy Nicoll's message of "Sat, 10 Aug 2019 10:52:54 +0100")
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
next prev parent reply other threads:[~2019-08-10 17:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
-- 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
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=yw1x7e7ldj5g.fsf@mansr.com \
--to=sox-users@lists.sourceforge.net \
--cc=jn.ml.sxu.88@wingsandbeaks.org.uk \
--cc=thomas@tensi.eu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).