dtas 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Documentation/dtas-env.txt +1 -1
- data/Documentation/dtas-player_effects.txt +3 -3
- data/Documentation/dtas-splitfx.txt +23 -7
- data/GIT-VERSION-GEN +1 -1
- data/Rakefile +1 -1
- data/bin/dtas-splitfx +4 -0
- data/examples/splitfx.sample.yml +1 -1
- data/examples/tfx.sample.yml +2 -2
- data/lib/dtas/rg_state.rb +7 -5
- data/lib/dtas/splitfx.rb +21 -4
- data/lib/dtas/tracklist.rb +3 -2
- data/test/test_rg_integration.rb +6 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 469ec379619540656d9a2decafe6eea0a53d963c
|
4
|
+
data.tar.gz: 7893b222746613c3365c1ea7a2b98276708a1ad5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 762b5e63dadda1b2c6128103a7899b6d981f52b025ebeb967139d9a6253bca433fcd8b96a3d066eb73aebcc4362ba289d2a88fa882f8fdbaefd66a231ceef59d
|
7
|
+
data.tar.gz: 278c853d6f5bb6116bf8d9c6516c2a6412d72ce2036d77fe9d6abc19b088208af78b1027f5949b1625d8d6e846235a3477c28fa9c59ad94de28437ba20032962
|
data/Documentation/dtas-env.txt
CHANGED
@@ -24,7 +24,7 @@ INFILE - the primary input file for playback or processing.
|
|
24
24
|
(e.g. "/path/to/ex.flac")
|
25
25
|
|
26
26
|
RGFX - the sox effect used for applying ReplayGain compensation.
|
27
|
-
Only used during playback in dtas-player. (e.g. "
|
27
|
+
Only used during playback in dtas-player. (e.g. "gain -6.0").
|
28
28
|
Removing this prevents ReplayGain from working and may damage
|
29
29
|
playback equipment with loudly mastered music.
|
30
30
|
|
@@ -7,9 +7,9 @@ They are applied in the order described.
|
|
7
7
|
rely on inter-track information.
|
8
8
|
|
9
9
|
Examples include:
|
10
|
-
- ReplayGain (simple
|
10
|
+
- ReplayGain (simple gain changes)
|
11
11
|
- anything which does not change the length of the audio:
|
12
|
-
|
12
|
+
gain, stereo, highpass, lowpass, loudness, bass, treble, equalizer, ...
|
13
13
|
|
14
14
|
Modifying source effects should introduce no extra gaps in playback.
|
15
15
|
Effects which modify the length of the audio is not recommended here,
|
@@ -34,7 +34,7 @@ They are applied in the order described.
|
|
34
34
|
- delaying a certain channel or frequency range for time-alignment
|
35
35
|
- compressors/limiters
|
36
36
|
- reverb
|
37
|
-
-
|
37
|
+
- gain
|
38
38
|
- remix (for stereo image adjustments)
|
39
39
|
|
40
40
|
Additionally, effects which are necessary due to the limitation of the
|
@@ -35,12 +35,28 @@ to use ecasound(1), too.
|
|
35
35
|
: Disable automatic setting of the DITHERFX env. This also passes
|
36
36
|
the option to sox(1) via SOX_OPTS.
|
37
37
|
|
38
|
+
-O, \--outdir OUTDIR
|
39
|
+
: Set output directory instead of current directory.
|
40
|
+
User-created targets must allow a placeholder for the
|
41
|
+
(by default, an empty string) $OUTDIR environment variable
|
42
|
+
in the output command.
|
43
|
+
|
44
|
+
-C, \--compression FACTOR
|
45
|
+
: Set the compression factor passed to sox(1). See soxformat(7)
|
46
|
+
for more information on how it works across different formats.
|
47
|
+
|
48
|
+
-r, \--rate RATE
|
49
|
+
: Override the output sample rate in the specified TARGET
|
50
|
+
|
51
|
+
-b, \--bits BITS
|
52
|
+
: Override the output bit depth in the specified TARGET
|
53
|
+
|
38
54
|
# FILE FORMAT
|
39
55
|
|
40
56
|
* infile - string, the pathname of the original audio file
|
41
57
|
* env - ordered hash of environment variables to set for all commands
|
42
58
|
env: !omap
|
43
|
-
FX:
|
59
|
+
FX: gain 3 stats
|
44
60
|
* comments - hash of common tags for all audio (e.g. ARTIST, ALBUM, YEAR)
|
45
61
|
comments:
|
46
62
|
ARTIST: John Smith
|
@@ -106,13 +122,13 @@ use in targets:
|
|
106
122
|
* TRIMFX - essential, this supplys the necessary sox(1) trim effect to
|
107
123
|
each track. In other words, this is: "trim ${TBEG}s ${TLEN}s"
|
108
124
|
* COMMENTS - expands to --comment-file=PATH for sox(1)
|
109
|
-
*
|
125
|
+
* OUTDIR - placeholder for --outdir, defaults to an empty string
|
110
126
|
* SUFFIX - the suffix of the output format without "." (e.g. "flac", "ogg")
|
111
127
|
* TRACKNUMBER - the track number, useful for comments and filenames
|
112
128
|
* RATEFX - rate effect and arguments for sox(1) resampling
|
113
129
|
* DITHERFX - dither effect and arguments for sox(1) dithering
|
114
130
|
* FX - any user-specified sox effects which encompases the entire file.
|
115
|
-
(e.g. "highpass 35
|
131
|
+
(e.g. "highpass 35 gain 3 stats")
|
116
132
|
|
117
133
|
# TARGETS
|
118
134
|
|
@@ -144,10 +160,10 @@ imbalance in a live concert recording from the audience:
|
|
144
160
|
targets:
|
145
161
|
flac24:
|
146
162
|
command: sox -M
|
147
|
-
"|sox $INFILE -c1 -p $TRIMFX remix 1v1
|
148
|
-
"|sox $INFILE -c1 -p $TRIMFX remix 2v1
|
163
|
+
"|sox $INFILE -c1 -p $TRIMFX remix 1v1 gain 9.5"
|
164
|
+
"|sox $INFILE -c1 -p $TRIMFX remix 2v1 gain 8.5"
|
149
165
|
$COMMENTS $OUTFMT
|
150
|
-
bandYYYY-MM-DD.FOO.t0"$TRACKNUMBER.$SUFFIX"
|
166
|
+
${OUTDIR}bandYYYY-MM-DD.FOO.t0"$TRACKNUMBER.$SUFFIX"
|
151
167
|
$RATEFX $DITHERFX stats
|
152
168
|
format:
|
153
169
|
type: flac
|
@@ -163,7 +179,7 @@ For reference, the "opusenc" default target is implemented as follows:
|
|
163
179
|
--raw-bits $BITS_PER_SAMPLE
|
164
180
|
$OPUSENC_BITRATE --raw-rate $RATE --raw-chan $CHANNELS
|
165
181
|
--raw-endianness $ENDIAN_OPUSENC
|
166
|
-
$OPUSENC_COMMENTS - $TRACKNUMBER.opus
|
182
|
+
$OPUSENC_COMMENTS - $OUTDIR$TRACKNUMBER.opus
|
167
183
|
format:
|
168
184
|
bits: 16
|
169
185
|
rate: 48000
|
data/GIT-VERSION-GEN
CHANGED
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ task "NEWS" do
|
|
6
6
|
latest = nil
|
7
7
|
fp = Tempfile.new("NEWS", ".")
|
8
8
|
fp.sync = true
|
9
|
-
`git tag -l`.split(/\n/).
|
9
|
+
`git tag -l --sort=-v:refname`.split(/\n/).each do |tag|
|
10
10
|
%r{\Av(.+)} =~ tag or next
|
11
11
|
version = $1
|
12
12
|
header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
|
data/bin/dtas-splitfx
CHANGED
@@ -14,6 +14,10 @@ OptionParser.new('', 24, ' ') do |op|
|
|
14
14
|
op.on('-j', '--jobs [JOBS]', Integer) { |val| opts[:jobs] = val }
|
15
15
|
op.on('-s', '--quiet', '--silent') { |val| opts[:silent] = true }
|
16
16
|
op.on('-D', '--no-dither') { |val| opts[:no_dither] = true }
|
17
|
+
op.on('-O', '--outdir OUTDIR') { |val| opts[:outdir] = val }
|
18
|
+
op.on('-C', '--compression FACTOR') { |val| opts[:compression] = val }
|
19
|
+
op.on('-r', '--rate RATE') { |val| opts[:rate] = val }
|
20
|
+
op.on('-b', '--bits RATE', Integer) { |val| opts[:bits] = val }
|
17
21
|
op.parse!(ARGV)
|
18
22
|
end
|
19
23
|
|
data/examples/splitfx.sample.yml
CHANGED
data/examples/tfx.sample.yml
CHANGED
@@ -16,8 +16,8 @@ comments:
|
|
16
16
|
track_start: 1
|
17
17
|
effects:
|
18
18
|
# the following commands are equivalent
|
19
|
-
- trim 52 =53 sh sox $SOXIN $SOXOUT $TRIMFX
|
20
|
-
- trim 52 1 sox
|
19
|
+
- trim 52 =53 sh sox $SOXIN $SOXOUT $TRIMFX gain -6
|
20
|
+
- trim 52 1 sox gain -6 # shorthand
|
21
21
|
|
22
22
|
# as are the following (for little endian machines)
|
23
23
|
- trim 52 1 eca -eadb:-6
|
data/lib/dtas/rg_state.rb
CHANGED
@@ -5,8 +5,10 @@
|
|
5
5
|
# MAYBE: account for non-standard reference loudness (89.0 dB is standard)
|
6
6
|
require_relative '../dtas'
|
7
7
|
require_relative 'serialize'
|
8
|
+
require_relative 'util'
|
8
9
|
class DTAS::RGState # :nodoc:
|
9
10
|
include DTAS::Serialize
|
11
|
+
include DTAS::Util
|
10
12
|
|
11
13
|
RG_MODE = {
|
12
14
|
# attribute name => method to use
|
@@ -53,19 +55,19 @@ class DTAS::RGState # :nodoc:
|
|
53
55
|
to_hash.delete_if { |k,v| RG_DEFAULT[k] == v }
|
54
56
|
end
|
55
57
|
|
56
|
-
# returns a dB argument to the "
|
58
|
+
# returns a dB argument to the "gain" effect, nil if nothing found
|
57
59
|
def rg_vol_gain(val)
|
58
60
|
val = val.to_f + @preamp
|
59
61
|
return if val.abs < @gain_threshold
|
60
|
-
sprintf('
|
62
|
+
sprintf('gain %0.8g', val)
|
61
63
|
end
|
62
64
|
|
63
|
-
# returns a
|
65
|
+
# returns a DB argument to the "gain" effect
|
64
66
|
def rg_vol_norm(val)
|
65
67
|
diff = @norm_level - val.to_f
|
66
68
|
return if (@norm_level - diff).abs < @norm_threshold
|
67
69
|
diff += @norm_level
|
68
|
-
sprintf('
|
70
|
+
sprintf('gain %0.8g', linear_to_db(diff))
|
69
71
|
end
|
70
72
|
|
71
73
|
# The ReplayGain fallback adjustment value (in dB), in case a file is
|
@@ -77,7 +79,7 @@ class DTAS::RGState # :nodoc:
|
|
77
79
|
val = @fallback_gain + @preamp
|
78
80
|
return if val.abs < @gain_threshold
|
79
81
|
warn(reason) if $DEBUG
|
80
|
-
"
|
82
|
+
"gain #{val}"
|
81
83
|
end
|
82
84
|
|
83
85
|
# returns an array (for command-line argument) for the effect needed
|
data/lib/dtas/splitfx.rb
CHANGED
@@ -10,7 +10,7 @@ require 'tempfile'
|
|
10
10
|
# Unlike the stuff for dtas-player, dtas-splitfx is fairly tied to sox
|
11
11
|
# (but we may still pipe to ecasound or anything else)
|
12
12
|
class DTAS::SplitFX # :nodoc:
|
13
|
-
CMD = 'sox "$INFILE" $COMMENTS $OUTFMT "$TRACKNUMBER.$SUFFIX" '\
|
13
|
+
CMD = 'sox "$INFILE" $COMMENTS $OUTFMT "$OUTDIR$TRACKNUMBER.$SUFFIX" '\
|
14
14
|
'$TRIMFX $FX $RATEFX $DITHERFX'
|
15
15
|
include DTAS::Process
|
16
16
|
include DTAS::XS
|
@@ -55,6 +55,10 @@ class DTAS::SplitFX # :nodoc:
|
|
55
55
|
@track_zpad = true
|
56
56
|
@t2s = method(:t2s)
|
57
57
|
@infile = nil
|
58
|
+
@outdir = nil
|
59
|
+
@compression = nil
|
60
|
+
@rate = nil
|
61
|
+
@bits = nil
|
58
62
|
@targets = {
|
59
63
|
"flac-cdda" => {
|
60
64
|
"command" => CMD,
|
@@ -72,7 +76,7 @@ class DTAS::SplitFX # :nodoc:
|
|
72
76
|
'$OPUSENC_BITRATE --raw-rate $RATE --raw-chan $CHANNELS ' \
|
73
77
|
'--raw-endianness $ENDIAN_OPUSENC ' \
|
74
78
|
'$OPUSENC_COMMENTS ' \
|
75
|
-
'- $TRACKNUMBER.opus',
|
79
|
+
'- $OUTDIR$TRACKNUMBER.opus',
|
76
80
|
"format" => {
|
77
81
|
"bits" => 16,
|
78
82
|
"rate" => 48000,
|
@@ -155,6 +159,8 @@ class DTAS::SplitFX # :nodoc:
|
|
155
159
|
def generic_target(target = "flac")
|
156
160
|
outfmt = @infmt.dup
|
157
161
|
outfmt.type = target
|
162
|
+
outfmt.bits = @bits if @bits
|
163
|
+
outfmt.rate = @rate if @rate
|
158
164
|
{ "command" => CMD, "format" => outfmt }
|
159
165
|
end
|
160
166
|
|
@@ -184,7 +190,7 @@ class DTAS::SplitFX # :nodoc:
|
|
184
190
|
# add noise-shaped dither for 16-bit (sox manual seems to recommend this)
|
185
191
|
if opts[:no_dither]
|
186
192
|
env["SOX_OPTS"] = "#{ENV["SOX_OPTS"]} -D"
|
187
|
-
|
193
|
+
elsif outfmt.bits && outfmt.bits <= 16
|
188
194
|
env["DITHERFX"] = "dither -s"
|
189
195
|
end
|
190
196
|
comments = Tempfile.new(%W(dtas-splitfx-#{t.comments["TRACKNUMBER"]} .txt))
|
@@ -195,8 +201,11 @@ class DTAS::SplitFX # :nodoc:
|
|
195
201
|
end
|
196
202
|
env["COMMENTS"] = "--comment-file=#{comments.path}"
|
197
203
|
infile_env(env, @infile)
|
198
|
-
|
204
|
+
outarg = outfmt.to_sox_arg
|
205
|
+
outarg << "-C#@compression" if @compression
|
206
|
+
env["OUTFMT"] = xs(outarg)
|
199
207
|
env["SUFFIX"] = outfmt.type
|
208
|
+
env["OUTDIR"] = @outdir ? "#@outdir/".squeeze('/') : ''
|
200
209
|
env.merge!(t.env)
|
201
210
|
|
202
211
|
command = target["command"]
|
@@ -323,6 +332,14 @@ class DTAS::SplitFX # :nodoc:
|
|
323
332
|
end
|
324
333
|
|
325
334
|
def run(target, opts = {})
|
335
|
+
if @outdir = opts[:outdir]
|
336
|
+
require 'fileutils'
|
337
|
+
FileUtils.mkpath(@outdir)
|
338
|
+
end
|
339
|
+
@compression = opts[:compression]
|
340
|
+
@rate = opts[:rate]
|
341
|
+
@bits = opts[:bits]
|
342
|
+
|
326
343
|
fails = []
|
327
344
|
tracks = @tracks.dup
|
328
345
|
pids = {}
|
data/lib/dtas/tracklist.rb
CHANGED
@@ -69,12 +69,13 @@ class DTAS::Tracklist # :nodoc:
|
|
69
69
|
def advance_track(repeat_ok = true)
|
70
70
|
return if @list.empty?
|
71
71
|
# @repeat == 1 for single track repeat
|
72
|
-
|
72
|
+
repeat = repeat_ok ? @repeat : false
|
73
|
+
next_pos = @goto_pos || @pos + (repeat == 1 ? 0 : 1)
|
73
74
|
next_off = @goto_off # nil by default
|
74
75
|
@goto_pos = @goto_off = nil
|
75
76
|
if @list[next_pos]
|
76
77
|
@pos = next_pos
|
77
|
-
elsif
|
78
|
+
elsif repeat
|
78
79
|
next_pos = @pos = 0
|
79
80
|
else
|
80
81
|
return
|
data/test/test_rg_integration.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org>
|
2
2
|
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
3
|
require './test/player_integration'
|
4
|
+
require 'dtas/util'
|
4
5
|
class TestRgIntegration < Testcase
|
5
6
|
include PlayerIntegration
|
7
|
+
include DTAS::Util
|
6
8
|
|
7
9
|
def tmp_pluck(len = 5)
|
8
10
|
pluck = Tempfile.open(%w(pluck .flac))
|
@@ -58,10 +60,10 @@ class TestRgIntegration < Testcase
|
|
58
60
|
assert_match expect, cur["current"]["env"]["RGFX"]
|
59
61
|
end
|
60
62
|
|
61
|
-
check_gain.call(%r{
|
62
|
-
check_gain.call(%r{
|
63
|
-
check_gain.call(%r{
|
64
|
-
check_gain.call(%r{
|
63
|
+
check_gain.call(%r{gain -3}, "album_gain")
|
64
|
+
check_gain.call(%r{gain -2}, "track_gain")
|
65
|
+
check_gain.call(%r{gain 0\.0}, "album_peak")
|
66
|
+
check_gain.call(%r{gain 2\.5}, "track_peak")
|
65
67
|
|
66
68
|
s.req_ok("rg preamp+=1")
|
67
69
|
rg = YAML.load(yaml = s.req("rg"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dtas hackers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Free Software command-line tools for audio playback, mastering, and
|