dtas-all
[Top][All Lists]
Advanced

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

[PATCH] splitfx: support --no-dither/-D option


From: Eric Wong
Subject: [PATCH] splitfx: support --no-dither/-D option
Date: Sun, 1 Dec 2013 06:50:00 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

splitfx is incapable of knowing in 100% of cases whether dithering
should be used (as it has no visibility into sox internals), so
support disabling it completely via command-line.
This is like the identical sox option, and passed to sox(1), too.

This feature is useful for splitting already-mastered 16-bit
recordings.
---
 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 2367aba..49e55dc 100644
--- a/Documentation/dtas-splitfx.txt
+++ b/Documentation/dtas-splitfx.txt
@@ -31,6 +31,10 @@ to use ecasound(1), too.
 -s, \--quiet, \--silent
 :    Silent operation, commands are not printed as executed
 
+-D, \--no-dither
+:    Disable automatic setting of the DITHERFX env.  This also passes
+    the option to sox(1) via SOX_OPTS.
+
 # FILE FORMAT
 
 * infile - string, the pathname of the original audio file
diff --git a/bin/dtas-splitfx b/bin/dtas-splitfx
index d75c1de..6e98aba 100755
--- a/bin/dtas-splitfx
+++ b/bin/dtas-splitfx
@@ -13,6 +13,7 @@ OptionParser.new('', 24, '  ') do |op|
   op.on('-n', '--dry-run') { opts[:dryrun] = true }
   op.on('-j', '--jobs [JOBS]', Integer) { |val| opts[:jobs] = val }
   op.on('-s', '--quiet', '--silent') { |val| opts[:silent] = true }
+  op.on('-D', '--no-dither') { |val| opts[:no_dither] = true }
   op.parse!(ARGV)
 end
 
diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb
index 6f1654e..2a0b9de 100644
--- a/lib/dtas/splitfx.rb
+++ b/lib/dtas/splitfx.rb
@@ -173,7 +173,11 @@ class DTAS::SplitFX # :nodoc:
     end
 
     # add noise-shaped dither for 16-bit (sox manual seems to recommend this)
-    outfmt.bits && outfmt.bits <= 16 and env["DITHERFX"] = "dither -s"
+    if opts[:no_dither]
+      env["SOX_OPTS"] = "#{ENV["SOX_OPTS"]} -D"
+    else outfmt.bits && outfmt.bits <= 16
+      env["DITHERFX"] = "dither -s"
+    end
     comments = Tempfile.new(%W(dtas-splitfx-#{t.comments["TRACKNUMBER"]} .txt))
     comments.sync = true
     t.comments.each do |k,v|
-- 
EW




reply via email to

[Prev in Thread] Current Thread [Next in Thread]