everything related to duct tape audio suite (dtas)
 help / color / mirror / Atom feed
* [PATCH] splitfx: pass compression factor to sox(1)
@ 2015-05-10 11:23 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-05-10 11:23 UTC (permalink / raw)
  To: dtas-all; +Cc: Eric Wong

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-10 11:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-10 11:23 [PATCH] splitfx: pass compression factor to sox(1) Eric Wong

everything related to duct tape audio suite (dtas)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://80x24.org/dtas-all
	git clone --mirror http://ou63pmih66umazou.onion/dtas-all

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 dtas-all dtas-all/ https://80x24.org/dtas-all \
		dtas-all@nongnu.org
	public-inbox-index dtas-all

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.dtas
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.dtas
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	dtas.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git