about summary refs log tree commit homepage
path: root/lib/dtas/source/sox.rb
diff options
authorEric Wong <normalperson@yhbt.net>2013-08-25 12:03:11 +0000
committerEric Wong <normalperson@yhbt.net>2013-08-25 12:27:33 +0000
commit963d0b4be91e1050ba947a9bbddd511f78321c54 (patch)
tree7b0f8b0211b0dd96838873285ae5593f398aa8dd /lib/dtas/source/sox.rb
parent0f9bfb784b7bbccf86b7d7d241982ba4e703efd4 (diff)
We need to tell sox to use and resample to the _player_ format
instead of the source format.  Otherwise 48000 Hz audio (common for
video?) sounds very slow when attempting to play back on the default
44100 Hz.  It is also likely preferable to choose the audio stream
which matches the player channel count instead of letting sox
automatically invoke the remix effect.

Before this change, playing 6-channel, 48000 Hz source into a sink
expecting stereo, 44100 Hz is rather disturbing...

While we're at it, clarify the spawn code for the sox source, too.

We can drop the test_format_from_file test now, since
it's probably overkill at this point.
Diffstat (limited to 'lib/dtas/source/sox.rb')
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb
index 954c1a5..235cbbc 100644
--- a/lib/dtas/source/sox.rb
+++ b/lib/dtas/source/sox.rb
@@ -86,9 +86,9 @@ class DTAS::Source::Sox # :nodoc:
-  def spawn(format, rg_state, opts)
+  def spawn(player_format, rg_state, opts)
     raise "BUG: #{self.inspect}#spawn called twice" if @to_io
-    e = format.to_env
+    e = player_format.to_env
     e["INFILE"] = @infile
     # make sure these are visible to the "current" command...