From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.2 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id EF4D71FACF for ; Sun, 10 May 2015 11:23:20 +0000 (UTC) Received: from localhost ([::1]:33213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrPKK-0005R1-5u for dtas-all@80x24.org; Sun, 10 May 2015 07:23:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrPKH-0005Qi-QX for dtas-all@nongnu.org; Sun, 10 May 2015 07:23:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrPKE-0004vc-Im for dtas-all@nongnu.org; Sun, 10 May 2015 07:23:17 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:57431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrPKE-0004vS-D6 for dtas-all@nongnu.org; Sun, 10 May 2015 07:23:14 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D462B1FA7B; Sun, 10 May 2015 11:23:13 +0000 (UTC) From: Eric Wong To: Subject: [PATCH] splitfx: pass compression factor to sox(1) Date: Sun, 10 May 2015 11:23:11 +0000 Message-Id: <1431256991-18671-1-git-send-email-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 Cc: Eric Wong X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org This can be useful for speeding up splitfx during development, as sox defaults to maximum compression with FLAC and that is extremely slow. --- Documentation/dtas-splitfx.txt | 4 ++++ bin/dtas-splitfx | 1 + lib/dtas/splitfx.rb | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/dtas-splitfx.txt b/Documentation/dtas-splitfx.txt index 27e6007..38c1cca 100644 --- a/Documentation/dtas-splitfx.txt +++ b/Documentation/dtas-splitfx.txt @@ -41,6 +41,10 @@ to use ecasound(1), too. (by default, an empty string) $OUTDIR environment variable in the output command. +-C, \--compression FACTOR +: Set the compression factor passed to sox(1). See soxformat(7) + for more information on how it works across different formats. + # FILE FORMAT * infile - string, the pathname of the original audio file diff --git a/bin/dtas-splitfx b/bin/dtas-splitfx index b8fc6c8..edd7dd3 100755 --- a/bin/dtas-splitfx +++ b/bin/dtas-splitfx @@ -15,6 +15,7 @@ OptionParser.new('', 24, ' ') do |op| op.on('-s', '--quiet', '--silent') { |val| opts[:silent] = true } op.on('-D', '--no-dither') { |val| opts[:no_dither] = true } op.on('-O', '--outdir OUTDIR') { |val| opts[:outdir] = val } + op.on('-C', '--compression FACTOR') { |val| opts[:compression] = val } op.parse!(ARGV) end diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb index 3f673ee..5b04854 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -56,6 +56,7 @@ class DTAS::SplitFX # :nodoc: @t2s = method(:t2s) @infile = nil @outdir = nil + @compression = nil @targets = { "flac-cdda" => { "command" => CMD, @@ -196,7 +197,9 @@ class DTAS::SplitFX # :nodoc: end env["COMMENTS"] = "--comment-file=#{comments.path}" infile_env(env, @infile) - env["OUTFMT"] = xs(outfmt.to_sox_arg) + outarg = outfmt.to_sox_arg + outarg << "-C#@compression" if @compression + env["OUTFMT"] = xs(outarg) env["SUFFIX"] = outfmt.type env["OUTDIR"] = @outdir ? "#@outdir/".squeeze('/') : '' env.merge!(t.env) @@ -329,6 +332,7 @@ class DTAS::SplitFX # :nodoc: require 'fileutils' FileUtils.mkpath(@outdir) end + @compression = opts[:compression] fails = [] tracks = @tracks.dup -- EW