dtas 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Documentation/GNUmakefile +2 -0
  3. data/Documentation/dtas-player_protocol.txt +28 -1
  4. data/Documentation/dtas-splitfx.txt +167 -0
  5. data/Documentation/dtas-tl.txt +77 -0
  6. data/GIT-VERSION-GEN +2 -1
  7. data/GNUmakefile +1 -1
  8. data/README +2 -1
  9. data/Rakefile +7 -0
  10. data/bin/dtas-console +11 -1
  11. data/bin/dtas-splitfx +40 -0
  12. data/bin/dtas-tl +73 -0
  13. data/examples/README +3 -0
  14. data/examples/splitfx.sample.yml +19 -0
  15. data/lib/dtas/format.rb +11 -0
  16. data/lib/dtas/pipe.rb +0 -3
  17. data/lib/dtas/player.rb +38 -11
  18. data/lib/dtas/player/client_handler.rb +94 -7
  19. data/lib/dtas/process.rb +25 -3
  20. data/lib/dtas/sink.rb +0 -3
  21. data/lib/dtas/source/sox.rb +2 -1
  22. data/lib/dtas/splitfx.rb +342 -0
  23. data/lib/dtas/tracklist.rb +130 -0
  24. data/test/helper.rb +14 -1
  25. data/test/player_integration.rb +5 -3
  26. data/test/test_buffer.rb +4 -2
  27. data/test/test_env.rb +55 -0
  28. data/test/test_format.rb +1 -1
  29. data/test/test_format_change.rb +1 -1
  30. data/test/test_player.rb +1 -1
  31. data/test/test_player_client_handler.rb +1 -1
  32. data/test/test_player_integration.rb +3 -2
  33. data/test/test_process.rb +1 -1
  34. data/test/test_rg_integration.rb +4 -5
  35. data/test/test_rg_state.rb +1 -1
  36. data/test/test_sink.rb +1 -1
  37. data/test/test_sink_pipe_size.rb +1 -1
  38. data/test/test_sink_tee_integration.rb +1 -1
  39. data/test/test_source_av.rb +1 -1
  40. data/test/test_source_sox.rb +1 -1
  41. data/test/test_splitfx.rb +79 -0
  42. data/test/test_tracklist.rb +76 -0
  43. data/test/test_unixserver.rb +1 -1
  44. data/test/test_util.rb +1 -1
  45. metadata +23 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5583678ac4bac1a9255750144a74b243f6344f47
4
- data.tar.gz: 7635bf1345477bc6ff1ca269be15f79090de639c
3
+ metadata.gz: d233bbb0a87d1fc6c4bdb7f18eba692c721a3333
4
+ data.tar.gz: 8f14c5645b6535bd6c22b1e4854ef39ec85d528a
5
5
  SHA512:
6
- metadata.gz: 15424a207857ad4b102b109c02890db06337a3772ea071230bd6e40fee9da4d64e2c5c1666ba95878d8015b9021f31629a76c38585a37648e60d02cc42a4127d
7
- data.tar.gz: bfec766d9470d8d0a09f3b7b8d2db33f748de0086d5362923c9aaf773e6cb8dcc773438ec0949ec5fc3c12eb3ac808fc471faae7931994fd29e64fbfba9fd665
6
+ metadata.gz: 93592a5294b214260e938746ad75408a32889aae8c3667a49ede5952364dd6a9f3d99b793a77c134a9bd66ec15a21eda0f078475d2d375543ebf153714170c68
7
+ data.tar.gz: 8fc83ba70d8a7a57f2e4ca26c936bd237b0fd9f4130142f8c500d7eeb4a0f7b15542bf305b79e891c7a2acd7f5edb3750281776ad7d730edc95fcdd3078c5b1b
@@ -16,6 +16,8 @@ m1 += dtas-player
16
16
  m1 += dtas-xdelay
17
17
  m1 += dtas-sinkedit
18
18
  m1 += dtas-sourceedit
19
+ m1 += dtas-tl
20
+ m1 += dtas-splitfx
19
21
 
20
22
  m7 =
21
23
  m7 += dtas-player_protocol
@@ -53,6 +53,9 @@ dtas-sinkedit(1), and dtas-enq(1) also implement this protocol.
53
53
  - COMMAND, this may be quoted string passed to sh -c "",
54
54
  variable/argument expansion will be performed by the shell
55
55
  - SOURCENAME - "sox" or "av", more backends may be supported in the future
56
+ - TIMESTAMP - a time stamp formatted in HH:MM:SS.FRAC (for seeking)
57
+ - TRACKID - a unique unsigned integer in decimal (base-10) representing a
58
+ track in the tracklist
56
59
  - FILENAME - an expanded pathname relative to / is recommended since
57
60
  dtas-player and the client may run in different directories
58
61
 
@@ -161,7 +164,7 @@ Commands here should be alphabetized according to `LC_ALL=C sort'
161
164
  + norm_level=FLOAT (1.0 == dBFS)
162
165
  Controls the level to normalize to when using album_norm or track_norm.
163
166
 
164
- * seek [+-]HH:MM:SS.FRAC - seek the current track to a specified time.
167
+ * seek [+-]TIMESTAMP - seek the current track to a specified time.
165
168
  This is passed directly as the first argument for the sox(1) "trim"
166
169
  command. See the sox(1) manpage for details.
167
170
  Seeking to a relative time is also supported by prefixing the time
@@ -211,6 +214,30 @@ Commands here should be alphabetized according to `LC_ALL=C sort'
211
214
  users requiring fsync should open(2) that file and fsync(2) it
212
215
  themselves if necessary.
213
216
 
217
+ * tl add FILENAME [TRACKID [BOOLEAN]] - add files to the tracklist
218
+ With one arg, adds FILENAME to the head of the tracklist.
219
+ If TRACKID is specified, FILENAME is added immediately after TRACKID
220
+ on the existing tracklist. The final BOOLEAN argument replaces the
221
+ currently playing track with the newly-added one.
222
+ Returns the TRACKID of the newly added track
223
+
224
+ * tl remove TRACKID - remove the track with the given TRACKID from
225
+ the track list
226
+
227
+ * tl get [TRACKIDS]
228
+ returns a list of TRACKIDS mapped to filenames.
229
+
230
+ * tl goto TRACKID [TIMESTAMP] - plays the given TRACKID
231
+ An optional timestamp may be added to prevent playing the
232
+ same part(s) repeated.y
233
+
234
+ * tl repeat [BOOLEAN|1] - show/or change repeat status of the tracklist.
235
+ With no args, this will show "true", "false", or "1"
236
+ If set to "1", dtas-player will repeat the current track.
237
+
238
+ * tl tracks
239
+ returns a list of all TRACKIDS in the tracklist
240
+
214
241
  * watch - adds the client to the passive watch list for notifications.
215
242
  It is recommended clients issue no further commands and open
216
243
  another client socket to issue non-watch commands.
@@ -0,0 +1,167 @@
1
+ % dtas-splitfx(1) dtas user manual
2
+
3
+ # NAME
4
+
5
+ dtas-splitfx - split audio and apply effects to all tracks
6
+
7
+ # SYNOPSIS
8
+
9
+ dtas-splitfx SPLITFX_FILE.yml [OPTIONS] [TARGETS] [ARGS...]
10
+
11
+ # DESCRIPTION
12
+
13
+ dtas-splitfx reads as YAML file and can apply effects (including
14
+ resampling/dither), split, tag, and encode files in parallel.
15
+ dtas-splitfx is intended for splitting recordings from vinyl and live
16
+ concerts into separate files. dtas-splitfx is inspired by cuesheets for
17
+ CD audio and the make(1) build tool.
18
+
19
+ dtas-splitfx primarily uses sox(1), but it is possible to define targets
20
+ to use ecasound(1), too.
21
+
22
+ # OPTIONS
23
+
24
+ -j, \--jobs [JOBS]
25
+ : Number of jobs to run in parallel. If no number is specified, all
26
+ jobs are run in parallel.
27
+
28
+ -n, \--dry-run
29
+ : Print, but do not run the commands to be executed
30
+
31
+ -s, \--quiet, \--silent
32
+ : Silent operation, commands are not printed as executed
33
+
34
+ # FILE FORMAT
35
+
36
+ * infile - string, the pathname of the original audio file
37
+ * env - hash of environment variables to set for all commands
38
+ * comments - hash of common tags for all audio (e.g. ARTIST, ALBUM, YEAR)
39
+ comments:
40
+ ARTIST: John Smith
41
+ ALBUM: Hello World
42
+ YEAR: 2013
43
+ * track_start - integer, number to start the track count at (default: 1)
44
+ * cdda_align - boolean, enforce sector alignment for audio CDs (default: false)
45
+ * track_zpad - boolean or integer. Zero-pad the TRACKNUMBER in metadata and
46
+ filenames. If an integer, this creates a fixed padding even if the
47
+ padding is not necessary. If true, this only pads as needed for the
48
+ highest-numbered track (default: true)
49
+ * tracks - array, see "TRACKS" section
50
+ * targets - hash, see "TARGETS" section
51
+
52
+ # TRACKS
53
+
54
+ Tracks may be defined by a start time, with the stop time defined
55
+ automatically by the start of the next track, stop time, or a skip
56
+ segment.
57
+
58
+ * t TIME TITLE [fade_in/fade_out=FADE_ARGS] - the start of a new track
59
+ at TIME with TITLE. An optional fade_in and fade_out may be specified
60
+ for the first/last tracks.
61
+ * skip TIME - skip a segment starting at TIME. "skip" segments are
62
+ useful for skipping long gaps between tracks (such as flipping vinyl
63
+ or intermission at concerts)
64
+ * stop TIME - stop the last track This should be the last directive in
65
+ the "tracks" array.
66
+
67
+ An example of the tracks array for a 4 track EP follows:
68
+
69
+ tracks:
70
+ - t 0:21 "This is the first track of an EP" fade_in='t 1'
71
+ - t 7:11.6 "Second track of side A of an EP"
72
+ - skip 9:18 # this is where I flip the record, comments are allowed
73
+ - t 9:41 "3rd track of an EP"
74
+ - t 13:36.5 "Final track of the EP" fade_out='t 1'
75
+ - stop 18:11
76
+
77
+ # FADES
78
+
79
+ dtas-splitfx automatically sets up fade-in/fade-out effects for sox(1)
80
+ based on track times. These are to be used in "t" (track) directives in
81
+ the "tracks" array:
82
+
83
+ * fade_in="[TYPE] LENGTH"
84
+ * fade_out="[TYPE] LENGTH"
85
+
86
+ TYPE is optional, but LENGTH is required. See sox(1) for a description
87
+ of the fade type.
88
+
89
+ # ENVIRONMENT
90
+
91
+ dtas-splitfx sets several default environment variables for commands to
92
+ use in targets:
93
+
94
+ * INFILE - this matches the "infile" directive in the YAML file
95
+ * TRIMFX - essential, this supplys the necessary sox(1) trim effect to
96
+ each track.
97
+ * COMMENTS - expands to --comment-file=PATH for sox(1)
98
+ * OUTFMT - sox(1) arguments for the output format (e.g. "-ts32 -c2 -r44100"
99
+ * SUFFIX - the suffix of the output format without "." (e.g. "flac", "ogg")
100
+ * TRACKNUMBER - the track number, useful for comments and filenames
101
+ * RATEFX - rate effect and arguments for sox(1) resampling
102
+ * DITHERFX - dither effect and arguments for sox(1) dithering
103
+
104
+ # TARGETS
105
+
106
+ The default targets will split audio and avoid applying any effects.
107
+ They are named after common audio formats supported by sox(1):
108
+
109
+ * flac
110
+ * ogg
111
+ * mp3
112
+ * sox
113
+
114
+ If not specified, "flac" is the default target.
115
+
116
+ Additional targets supported by default.
117
+
118
+ * flac-cdda - this encodes the audio to "flac" format while being
119
+ easily decompressible to a format suitable for being burned to audio CD.
120
+
121
+ * opusenc - encodes to 16-bit, 48000 Hz Opus format using opusenc(1).
122
+ This uses sox(1) to dither/resample/apply effects as necessary.
123
+ This target exists as sox (as of v14.4.1) does not currently have
124
+ native opus encoding support.
125
+
126
+ Custom targets may easily be defined to apply effects and gain. For
127
+ example, the following "flac24" target raises the volume of the left
128
+ channel by 9.5dB and the right one by 8.5dB to compensate for channel
129
+ imbalance in a live concert recording from the audience:
130
+
131
+ targets:
132
+ flac24:
133
+ command: sox -M
134
+ "|sox $INFILE -c1 -p $TRIMFX remix 1v1 vol +9.5dB"
135
+ "|sox $INFILE -c1 -p $TRIMFX remix 2v1 vol +8.5dB"
136
+ $COMMENTS $OUTFMT
137
+ bandYYYY-MM-DD.FOO.t0"$TRACKNUMBER.$SUFFIX"
138
+ $RATEFX $DITHERFX stats
139
+ format:
140
+ type: flac
141
+ bits: 24
142
+ rate: 48000
143
+
144
+ For reference, the "opusenc" default target is implemented as follows:
145
+
146
+ targets:
147
+ opusenc:
148
+ command: sox "$INFILE" $COMMENTS $OUTFMT -
149
+ $TRIMFX $RATEFX $DITHERFX | opusenc --music
150
+ --raw-bits $BITS_PER_SAMPLE
151
+ $OPUSENC_BITRATE --raw-rate $RATE --raw-chan $CHANNELS
152
+ --raw-endianness $ENDIAN_OPUSENC
153
+ $OPUSENC_COMMENTS - $TRACKNUMBER.opus
154
+ format:
155
+ bits: 16
156
+ rate: 48000
157
+ type: s16
158
+ channels: 2
159
+
160
+ # COPYRIGHT
161
+
162
+ Copyright 2013, Eric Wong <normalperson@yhbt.net> and all contributors.\
163
+ License: GPLv3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>
164
+
165
+ # SEE ALSO
166
+
167
+ sox(1), ecasound(1), flac(1), opusenc(1)
@@ -0,0 +1,77 @@
1
+ % dtas-tl(1) dtas user manual
2
+
3
+ # NAME
4
+
5
+ dtas-tl - tracklist manipulation for dtas-player (development)
6
+
7
+ # SYNOPSYS
8
+
9
+ dtas-tl [COMMANDS]
10
+
11
+ # DESCRIPTION
12
+
13
+ dtas-tl provides utility functions for manipulating the tracklist of the
14
+ dtas-player (not the queue, the tracklist is separate from the queue).
15
+ It is mainly intended as a development tool and will likely go away in
16
+ the future or have its functionality merged into another tool (or MPRIS
17
+ client).
18
+
19
+ # COMMANDS
20
+
21
+ * addhead - add multiple tracks to the beginning of the tracklist
22
+ * addtail - add multiple tracks to the end of the tracklist
23
+ * current - display the current track, "NONE" if not playing
24
+ * current-id - display the TRACKID of the current track
25
+ "NONE" if not playing
26
+ * cat - display a newline-delimited list of TRACK_ID=PATH output
27
+ * clear - remove all tracks from the tracklist
28
+ * goto TRACKID [POS] - play TRACKID immediately, optionally seek to POS
29
+ TRACKID may be looked up via cat, and POS should be a timestamp in
30
+ HH:MM:SS.FRAC format.
31
+ * reto REGEXP [POS] - play first track with path matching REGEXP immediately,
32
+ optionally seek to POS. POS should be a timestamp in HH:MM:SS.FRAC format.
33
+ * next - play the next track in the tracklist
34
+ * previous - play the previous track in the tracklist
35
+ * repeat 1 - repeat the current track
36
+ * repeat false - disable repeat
37
+ * repeat true - enable repeat of the whole tracklist
38
+
39
+ See dtas-player_protocol(7) for a detailed description of the protocol.
40
+
41
+ # EXAMPLES
42
+
43
+ display the current tracklist
44
+
45
+ $ dtas-tl cat
46
+
47
+ to add an an entire directory of FLAC files
48
+
49
+ $ dtas-tl addtail /path/to/directory/*.flac
50
+
51
+ to skip forward in the tracklist
52
+
53
+ $ dtas-tl next
54
+
55
+ to skip backwards in the tracklist
56
+
57
+ $ dtas-tl previous
58
+
59
+ # ENVIRONMENT
60
+
61
+ DTAS_PLAYER_SOCK - the path to the dtas-player control socket.
62
+ This defaults to ~/.dtas/player.sock
63
+
64
+ # CONTACT
65
+
66
+ All feedback welcome via plain-text mail to <dtas-all@nongnu.org>\
67
+ Mailing list archives available at <ftp://lists.gnu.org/dtas-all/>\
68
+ No subscription is necessary to post to the mailing list.
69
+
70
+ # COPYRIGHT
71
+
72
+ Copyright 2013, Eric Wong <normalperson@yhbt.net> and all contributors.\
73
+ License: GPLv3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>
74
+
75
+ # SEE ALSO
76
+
77
+ dtas-player(1), dtas-player_protocol(7), dtas-ctl(1)
data/GIT-VERSION-GEN CHANGED
@@ -3,7 +3,7 @@
3
3
  # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
4
4
  CONSTANT = "DTAS::VERSION"
5
5
  RVF = "lib/dtas/version.rb"
6
- DEF_VER = "v0.3.0"
6
+ DEF_VER = "v0.4.0"
7
7
  vn = DEF_VER
8
8
 
9
9
  # First see if there is a version file (included in release tarballs),
@@ -27,4 +27,5 @@ cur_ruby_version = File.read(RVF) rescue nil
27
27
  if new_ruby_version != cur_ruby_version
28
28
  File.open(RVF, "w") { |fp| fp.write(new_ruby_version) }
29
29
  end
30
+ File.chmod(0644, RVF)
30
31
  puts vn if $0 == __FILE__
data/GNUmakefile CHANGED
@@ -13,7 +13,7 @@ test_units := $(wildcard test/test_*.rb)
13
13
  test: test-unit
14
14
  test-unit: $(test_units)
15
15
  $(test_units):
16
- $(RUBY) -I $(lib) $@ $(RUBY_TEST_OPTS)
16
+ $(RUBY) -w -I $(lib) $@ $(RUBY_TEST_OPTS)
17
17
 
18
18
  check-warnings:
19
19
  @(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
data/README CHANGED
@@ -11,6 +11,7 @@ Primary executables available are:
11
11
 
12
12
  * dtas-player - gapless music player (or pipeline/process manager :P)
13
13
  * dtas-cueedit - embedded cuesheet editor (FLAC-only for now)
14
+ * dtas-splitfx - split audio and apply effects to all tracks
14
15
 
15
16
  The centerpiece is dtas-player, a gapless music player designed to aid
16
17
  in writing scripts for sox/ecasound use. Unlike monolithic music
@@ -38,6 +39,7 @@ Users of dtas-player will also be interested in the following scripts:
38
39
  * dtas-sinkedit - edit sinks (playback targets) for dtas-player
39
40
  * dtas-sourceedit - edit source (decoder process parameters) for dtas-player
40
41
  * dtas-xdelay - alternative sink for dtas-player
42
+ * dtas-tl - command-line helpers for tracklist functionality in dtas-player
41
43
 
42
44
  All scripts have some documentation in the Documentation/ directory or
43
45
  manpages distributed with the gem. Documentation is also available on
@@ -50,7 +52,6 @@ Familiarity with the Ruby programming language is absolutely NOT required.
50
52
  Coming:
51
53
 
52
54
  * MPRIS/MPRIS 2.0 bridge for partial dtas-player control
53
- * tracklist support in dtas-player (maybe?)
54
55
  * whatever command-line tools come to mind...
55
56
  * better error handling, many bugfixes, etc...
56
57
  * better documentation
data/Rakefile CHANGED
@@ -110,6 +110,13 @@ task tarball: "pkg/#{base}" do
110
110
  end
111
111
  end
112
112
 
113
+ task "pkg/#{base}" => :fix_perms
114
+
115
+ task :fix_perms do
116
+ sh "git ls-tree -r HEAD | awk '/^100644 / {print $NF}' | xargs chmod 644"
117
+ sh "git ls-tree -r HEAD | awk '/^100755 / {print $NF}' | xargs chmod 755"
118
+ end
119
+
113
120
  task dist: [ :tarball, :package ] do
114
121
  Dir.chdir("pkg") do
115
122
  %w(dtas-linux dtas-mpris).each do |gem|
data/bin/dtas-console CHANGED
@@ -39,6 +39,8 @@ tfmt = update_tfmt(prec_step[prec_nr])
39
39
  events = []
40
40
  interval = 1.0 / 10 ** prec_nr
41
41
 
42
+ pause = nil
43
+
42
44
  def show_events(lineno, screen, events)
43
45
  Curses.setpos(lineno += 1, 0)
44
46
  Curses.clrtoeol
@@ -132,7 +134,7 @@ begin
132
134
  else
133
135
  Curses.setpos(lineno += 1, 0)
134
136
  Curses.clrtoeol
135
- Curses.addstr(cur['paused'] ? 'paused' : 'idle')
137
+ Curses.addstr(cur['paused'] ? "paused #{pause}" : 'idle')
136
138
  Curses.setpos(lineno += 1, 0)
137
139
  Curses.clrtoeol
138
140
  end
@@ -153,6 +155,14 @@ begin
153
155
  Curses.clear
154
156
  when w
155
157
  event = w.res_wait
158
+ case event
159
+ when "pause"
160
+ if current
161
+ pause = current['infile'] || current['command']
162
+ end
163
+ when %r{\Afile }
164
+ pause = nil
165
+ end
156
166
  events << "#{Time.now.strftime(tfmt)} #{event}"
157
167
  # something happened, refresh current
158
168
  # we could be more intelligent here, maybe, but too much work.
data/bin/dtas-splitfx ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
3
+ # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
4
+ require 'yaml'
5
+ require 'optparse'
6
+ require 'dtas/splitfx'
7
+ usage = "#$0 [-n|--dry-run][-j [JOBS]][-s|--silent] SPLITFX_FILE.yml [TARGET]"
8
+ overrides = {} # FIXME: not tested
9
+ opts = { jobs: 1 }
10
+ jobs = 1
11
+ OptionParser.new('', 24, ' ') do |op|
12
+ op.banner = usage
13
+ op.on('-n', '--dry-run') { opts[:dryrun] = true }
14
+ op.on('-j', '--jobs [JOBS]', Integer) { |val| opts[:jobs] = val }
15
+ op.on('-s', '--quiet', '--silent') { |val| opts[:silent] = true }
16
+ op.parse!(ARGV)
17
+ end
18
+
19
+ args = []
20
+ ARGV.each do |arg|
21
+ case arg
22
+ when %r{\A(\w+)=(.*)\z}
23
+ key, val = $1, $2
24
+ # only one that makes sense is infile=another_file
25
+ overrides[key] = YAML.load(val)
26
+ when %r{\A(\w+)\.(\w+)=(.*)\z}
27
+ # comments.ARTIST='blah'
28
+ top, key, val = $1, $2, $3
29
+ hsh = overrides[top] ||= {}
30
+ hsh[key] = val
31
+ else
32
+ args << arg
33
+ end
34
+ end
35
+
36
+ file = args.shift or abort usage
37
+ target = args.shift || "flac"
38
+ splitfx = DTAS::SplitFX.new
39
+ splitfx.import(YAML.load(File.read(file)), overrides)
40
+ splitfx.run(target, opts)