everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: <dtas-all@nongnu.org>
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH] splitfx: --bits and --rate for quick-n-dirty generic targets
Date: Sun, 10 May 2015 11:23:16 +0000	[thread overview]
Message-ID: <1431256996-18740-1-git-send-email-e@80x24.org> (raw)

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



                 reply	other threads:[~2015-05-10 11:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://80x24.org/dtas/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1431256996-18740-1-git-send-email-e@80x24.org \
    --to=e@80x24.org \
    --cc=dtas-all@nongnu.org \
    --subject='Re: [PATCH] splitfx: --bits and --rate for quick-n-dirty generic targets' \
    /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

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://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.audio.dtas
 note: .onion URLs require Tor: https://www.torproject.org/

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

	../../dtas.git

AGPL code for this site: git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git