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 A25AD1FACE for ; Sun, 10 May 2015 11:23:22 +0000 (UTC) Received: from localhost ([::1]:33214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrPKM-0005RV-26 for dtas-all@80x24.org; Sun, 10 May 2015 07:23:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrPKI-0005Qk-TJ for dtas-all@nongnu.org; Sun, 10 May 2015 07:23:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrPKH-0004wM-Rp for dtas-all@nongnu.org; Sun, 10 May 2015 07:23:18 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:57434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrPKH-0004wE-Mz for dtas-all@nongnu.org; Sun, 10 May 2015 07:23:17 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 505421FACE; Sun, 10 May 2015 11:23:17 +0000 (UTC) From: Eric Wong To: Subject: [PATCH] splitfx: --bits and --rate for quick-n-dirty generic targets Date: Sun, 10 May 2015 11:23:16 +0000 Message-Id: <1431256996-18740-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 generic targets (e.g. "wav") is useful for quickly checking if clipping is introduced by dither and resampling, so we'll support changing the sample rate and bits-per-sample from the command-line so users don't need to setup their own targets or wait on FLAC encoding. --- Documentation/dtas-splitfx.txt | 6 ++++++ bin/dtas-splitfx | 2 ++ lib/dtas/splitfx.rb | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/Documentation/dtas-splitfx.txt b/Documentation/dtas-splitfx.txt index 38c1cca..049371f 100644 --- a/Documentation/dtas-splitfx.txt +++ b/Documentation/dtas-splitfx.txt @@ -45,6 +45,12 @@ to use ecasound(1), too. : Set the compression factor passed to sox(1). See soxformat(7) for more information on how it works across different formats. +-r, \--rate RATE +: Override the output sample rate in the specified TARGET + +-b, \--bits BITS +: Override the output bit depth in the specified TARGET + # FILE FORMAT * infile - string, the pathname of the original audio file diff --git a/bin/dtas-splitfx b/bin/dtas-splitfx index edd7dd3..b5741a0 100755 --- a/bin/dtas-splitfx +++ b/bin/dtas-splitfx @@ -16,6 +16,8 @@ OptionParser.new('', 24, ' ') do |op| 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.on('-r', '--rate RATE') { |val| opts[:rate] = val } + op.on('-b', '--bits RATE', Integer) { |val| opts[:bits] = val } op.parse!(ARGV) end diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb index 5b04854..a14d221 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -57,6 +57,8 @@ class DTAS::SplitFX # :nodoc: @infile = nil @outdir = nil @compression = nil + @rate = nil + @bits = nil @targets = { "flac-cdda" => { "command" => CMD, @@ -157,6 +159,8 @@ class DTAS::SplitFX # :nodoc: def generic_target(target = "flac") outfmt = @infmt.dup outfmt.type = target + outfmt.bits = @bits if @bits + outfmt.rate = @rate if @rate { "command" => CMD, "format" => outfmt } end @@ -333,6 +337,8 @@ class DTAS::SplitFX # :nodoc: FileUtils.mkpath(@outdir) end @compression = opts[:compression] + @rate = opts[:rate] + @bits = opts[:bits] fails = [] tracks = @tracks.dup -- EW