dtas 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/.gemtest +0 -0
  3. data/.gitignore +9 -0
  4. data/.rsync_doc +3 -0
  5. data/COPYING +674 -0
  6. data/Documentation/.gitignore +3 -0
  7. data/Documentation/GNUmakefile +46 -0
  8. data/Documentation/dtas-console.txt +42 -0
  9. data/Documentation/dtas-ctl.txt +64 -0
  10. data/Documentation/dtas-cueedit.txt +24 -0
  11. data/Documentation/dtas-enq.txt +29 -0
  12. data/Documentation/dtas-msinkctl.txt +45 -0
  13. data/Documentation/dtas-player.txt +110 -0
  14. data/Documentation/dtas-player_effects.txt +45 -0
  15. data/Documentation/dtas-player_protocol.txt +181 -0
  16. data/Documentation/dtas-sinkedit.txt +41 -0
  17. data/Documentation/dtas-sourceedit.txt +33 -0
  18. data/Documentation/dtas-xdelay.txt +57 -0
  19. data/Documentation/troubleshooting.txt +13 -0
  20. data/GIT-VERSION-GEN +30 -0
  21. data/GNUmakefile +9 -0
  22. data/HACKING +12 -0
  23. data/INSTALL +53 -0
  24. data/README +103 -0
  25. data/Rakefile +97 -0
  26. data/TODO +4 -0
  27. data/bin/dtas-console +160 -0
  28. data/bin/dtas-ctl +10 -0
  29. data/bin/dtas-cueedit +78 -0
  30. data/bin/dtas-enq +13 -0
  31. data/bin/dtas-msinkctl +51 -0
  32. data/bin/dtas-player +34 -0
  33. data/bin/dtas-sinkedit +58 -0
  34. data/bin/dtas-sourceedit +48 -0
  35. data/bin/dtas-xdelay +85 -0
  36. data/dtas-linux.gemspec +18 -0
  37. data/dtas-mpris.gemspec +16 -0
  38. data/examples/dtas_state.yml +18 -0
  39. data/lib/dtas.rb +7 -0
  40. data/lib/dtas/buffer.rb +90 -0
  41. data/lib/dtas/buffer/read_write.rb +102 -0
  42. data/lib/dtas/buffer/splice.rb +142 -0
  43. data/lib/dtas/command.rb +43 -0
  44. data/lib/dtas/compat_onenine.rb +18 -0
  45. data/lib/dtas/disclaimer.rb +18 -0
  46. data/lib/dtas/format.rb +151 -0
  47. data/lib/dtas/pipe.rb +39 -0
  48. data/lib/dtas/player.rb +393 -0
  49. data/lib/dtas/player/client_handler.rb +463 -0
  50. data/lib/dtas/process.rb +87 -0
  51. data/lib/dtas/replaygain.rb +41 -0
  52. data/lib/dtas/rg_state.rb +99 -0
  53. data/lib/dtas/serialize.rb +9 -0
  54. data/lib/dtas/sigevent.rb +10 -0
  55. data/lib/dtas/sigevent/efd.rb +20 -0
  56. data/lib/dtas/sigevent/pipe.rb +28 -0
  57. data/lib/dtas/sink.rb +121 -0
  58. data/lib/dtas/source.rb +147 -0
  59. data/lib/dtas/source/command.rb +40 -0
  60. data/lib/dtas/source/common.rb +14 -0
  61. data/lib/dtas/source/mp3.rb +37 -0
  62. data/lib/dtas/state_file.rb +33 -0
  63. data/lib/dtas/unix_accepted.rb +76 -0
  64. data/lib/dtas/unix_client.rb +51 -0
  65. data/lib/dtas/unix_server.rb +110 -0
  66. data/lib/dtas/util.rb +15 -0
  67. data/lib/dtas/writable_iter.rb +22 -0
  68. data/perl/dtas-graph +129 -0
  69. data/pkg.mk +26 -0
  70. data/setup.rb +1586 -0
  71. data/test/covshow.rb +30 -0
  72. data/test/helper.rb +76 -0
  73. data/test/player_integration.rb +121 -0
  74. data/test/test_buffer.rb +216 -0
  75. data/test/test_format.rb +61 -0
  76. data/test/test_format_change.rb +49 -0
  77. data/test/test_player.rb +47 -0
  78. data/test/test_player_client_handler.rb +86 -0
  79. data/test/test_player_integration.rb +220 -0
  80. data/test/test_rg_integration.rb +117 -0
  81. data/test/test_rg_state.rb +32 -0
  82. data/test/test_sink.rb +32 -0
  83. data/test/test_sink_tee_integration.rb +34 -0
  84. data/test/test_source.rb +102 -0
  85. data/test/test_unixserver.rb +66 -0
  86. data/test/test_util.rb +15 -0
  87. metadata +208 -0
@@ -0,0 +1,41 @@
1
+ % dtas-sinkedit(1) dtas user manual
2
+ %
3
+
4
+ # NAME
5
+
6
+ dtas-sinkedit - edit the command and environment of a sink
7
+
8
+ # SYNOPSYS
9
+
10
+ dtas-sinkedit SINKNAME
11
+
12
+ # DESCRIPTION
13
+
14
+ dtas-sinkedit spawns an editor to allow editing of a sink as a YAML file.
15
+ See dtas-player_protocol(7) for details on SINKARGS.
16
+
17
+ # EXAMPLES
18
+
19
+ To get a list of existing sink names
20
+
21
+ $ dtas-ctl ls
22
+
23
+ Invoking dtas-sinkedit will spawn your favorite text editor on a
24
+ given SINKNAME:
25
+
26
+ $ dtas-sinkedit SINKNAME
27
+
28
+ If SINKNAME was not listed, it will be created (in an inactive state).
29
+ Successfully exiting your text editor will send the changes to the
30
+ running dtas-player.
31
+
32
+ # ENVIRONMENT
33
+
34
+ VISUAL / EDITOR - your favorite *nix text editor, defaults to 'vi' if unset.
35
+
36
+ DTAS_PLAYER_SOCK - the path to the dtas-player control socket.
37
+ This defaults to ~/.dtas/player.sock
38
+
39
+ # SEE ALSO
40
+
41
+ dtas-player(1), dtas-player_protocol(7), dtas-ctl(1)
@@ -0,0 +1,33 @@
1
+ % dtas-sourceedit(1) dtas user manual
2
+ %
3
+
4
+ # NAME
5
+
6
+ dtas-sourceedit - edit the command and environment of the decoder
7
+
8
+ # SYNOPSYS
9
+
10
+ dtas-sourceedit
11
+
12
+ # DESCRIPTION
13
+
14
+ dtas-sourceedit spawns an editor to allow editing of a sink as a YAML file.
15
+ See dtas-player_protocol(7) for details on SINKARGS.
16
+
17
+ # EXAMPLES
18
+
19
+ Invoking dtas-sourceedit will spawn your favorite text editor on a
20
+ given SINKNAME:
21
+
22
+ $ dtas-sourceedit
23
+
24
+ # ENVIRONMENT
25
+
26
+ VISUAL / EDITOR - your favorite *nix text editor, defaults to 'vi' if unset.
27
+
28
+ DTAS_PLAYER_SOCK - the path to the dtas-player control socket.
29
+ This defaults to ~/.dtas/player.sock
30
+
31
+ # SEE ALSO
32
+
33
+ dtas-player(1), dtas-player_protocol(7), dtas-ctl(1)
@@ -0,0 +1,57 @@
1
+ % dtas-xdelay(1) dtas user manual
2
+ %
3
+
4
+ # NAME
5
+
6
+ dtas-xdelay - play audio with a crossover delay
7
+
8
+ # SYNOPSYS
9
+
10
+ dtas-xdelay [OPTIONS] INPUT1 INPUT2 DELAY
11
+
12
+ # DESCRIPTION
13
+
14
+ dtas-xdelay will delay an audio band by a given delay (in seconds or
15
+ fractions thereof). This can be useful for tuning a sub/sat speaker
16
+ system. It is intended for use a dtas-player sink command as displayed
17
+ in the synopsis.
18
+
19
+ The INPUT arguments (/dev/fd/lo and /dev/fd/hi) are automatically
20
+ changed by dtas-player to match the given file descriptors of the pipes.
21
+
22
+ Both descriptors receive the same audio data, but will be split using a
23
+ Linkwitz-Riley crossover. The high-band (second argument) will be
24
+ delayed by default.
25
+
26
+ # EXAMPLE
27
+
28
+ To set this via dtas-player to delay the high frequencies by 20ms.
29
+
30
+ dtas-ctl sink ed SINKNAME \
31
+ command='dtas-xdelay /dev/fd/lo /dev/fd/hi 0.020'
32
+
33
+ # OPTIONS
34
+
35
+ -x, \--crossover-frequency FREQUENCY
36
+ : Frequency at which to set the crossover. This defaults to 80 (Hz).
37
+
38
+ -l, \--lowpass-delay
39
+ : Delay the lowpass frequency instead of the highpass one.
40
+
41
+ # ENVIRONMENT
42
+
43
+ SOXFMT - this environment is automatically set if used as a dtas-player
44
+ sink
45
+
46
+ DTAS_PLAYER_SOCK - the path to the dtas-player control socket.
47
+ This defaults to ~/.dtas/player.sock
48
+
49
+ # NOTES
50
+
51
+ The author of this knows little about signal processing and is just
52
+ parroting things he's learned on the sox documentation and mailing list.
53
+ Corrections greatly appreciated (email Eric Wong e@80x24.org)
54
+
55
+ # SEE ALSO
56
+
57
+ dtas-player(1), dtas-player_protocol(7), dtas-ctl(1), sox(1)
@@ -0,0 +1,13 @@
1
+ dtas-player troubleshooting guide
2
+ ---------------------------------
3
+
4
+ dtas-player is heavily dependent on external commands such as sox(1)/play(1)
5
+ and ecasound(1).
6
+
7
+ * problem: audio playback does not start
8
+
9
+ Since dtas-player just runs the play(1) command, the first step is to
10
+ ensure play(1) works without dtas-player.
11
+
12
+ Consult SoX documentation and mailing lists for getting play(1) to work,
13
+ first.
data/GIT-VERSION-GEN ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (C) 2013, Eric Wong <normalperson@yhbt.net>
3
+ # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
4
+ CONSTANT = "DTAS::VERSION"
5
+ RVF = "lib/dtas/version.rb"
6
+ DEF_VER = "v0.0.0"
7
+ vn = DEF_VER
8
+
9
+ # First see if there is a version file (included in release tarballs),
10
+ # then try git-describe, then default.
11
+ if File.exist?(".git")
12
+ describe = `git describe --abbrev=4 HEAD 2>/dev/null`.strip
13
+ case describe
14
+ when /\Av[0-9]*/
15
+ vn = describe
16
+ system(*%w(git update-index -q --refresh))
17
+ unless `git diff-index --name-only HEAD --`.chomp.empty?
18
+ vn << "-dirty"
19
+ end
20
+ vn.tr!('-', '.')
21
+ end
22
+ end
23
+
24
+ vn = vn.sub!(/\Av/, "")
25
+ new_ruby_version = "#{CONSTANT} = '#{vn}'\n"
26
+ cur_ruby_version = File.read(RVF) rescue nil
27
+ if new_ruby_version != cur_ruby_version
28
+ File.open(RVF, "w") { |fp| fp.write("# :enddoc:\n#{new_ruby_version}") }
29
+ end
30
+ puts vn if $0 == __FILE__
data/GNUmakefile ADDED
@@ -0,0 +1,9 @@
1
+ all::
2
+ include pkg.mk
3
+
4
+ check: test
5
+ coverage: export COVERAGE=1
6
+ coverage:
7
+ > coverage.dump
8
+ $(MAKE) check
9
+ $(RUBY) ./test/covshow.rb
data/HACKING ADDED
@@ -0,0 +1,12 @@
1
+ serialization (dtas-player)
2
+ ---------------------------
3
+
4
+ * objects serialize using the "to_hsh" method (like "to_hash", but omits
5
+ default values) and then to YAML. We avoid exposing the fact we use
6
+ Ruby (or any programming language) in any formats.
7
+
8
+ * every serializable class defines a "load" singleton method which takes the
9
+ output Hash of "to_hsh"
10
+
11
+ * we avoid serializing default values to make the state file shorter and
12
+ more suitable for human viewing and editing.
data/INSTALL ADDED
@@ -0,0 +1,53 @@
1
+ Uncommon for audio software, dtas is implemented in Ruby.
2
+
3
+ The latest stable release of Ruby is recommended, currently 2.0.0-p247.
4
+ However, Ruby 1.9.3 should work, too. Older versions of Ruby are not
5
+ recommended.
6
+
7
+ SoX is a dependency of dtas-player. While not _strictly_ required, the
8
+ dtas-player uses SoX by default and you will need it unless you've
9
+ reconfigured dtas-player to use something else.
10
+
11
+ mp3gain is required if you use ReplayGain with MP3s
12
+
13
+ If you only intend to use dtas-cueedit, you will need metaflac(1) from
14
+ the FLAC package.
15
+
16
+ Debian users can install sox, mp3gain, and flac dependencies easily:
17
+
18
+ apt-get install sox libsox-fmt-all mp3gain flac
19
+
20
+ = installing dtas RubyGem on GNU/Linux (Linux kernel 2.6.32+)
21
+
22
+ Be sure to have Ruby development headers and a working C compiler.
23
+ This will pull in the io_splice and sleepy_penguin RubyGems for minor
24
+ speedups. If you cannot be bothered to have a development
25
+ environment, just use "gem install dtas"
26
+
27
+ gem install dtas-linux
28
+
29
+ This should pull in the "io_splice" and "sleepy_penguin" RubyGems
30
+
31
+ For future upgrades of dtas (upgrades to dtas-linux will be infrequent)
32
+
33
+ gem update dtas
34
+
35
+ = installing the dtas RubyGem on non-GNU/Linux or old GNU/Linux systems
36
+
37
+ gem install dtas
38
+
39
+ = installing dtas via tarball and setup.rb
40
+
41
+ Grab the latest tarball from our HTTP site:
42
+
43
+ http://dtas.80x24.org/2013/dtas-0.0.0.tar.gz
44
+
45
+ $ tar zxvf dtas-0.0.0.tar.gz
46
+ $ cd dtas-0.0.0
47
+ $ ruby setup.rb
48
+
49
+ GNU/Linux users may optionally install "io_splice" and
50
+ "sleepy_penguin" packages:
51
+
52
+ io_splice - http://bogomips.org/ruby_io_splice/
53
+ sleepy_penguin - http://bogomips.org/sleepy_penguin/
data/README ADDED
@@ -0,0 +1,103 @@
1
+ = dtas - duct tape audio suite for *nix
2
+
3
+ Free Software command-line tools for audio playback, mastering, and
4
+ whatever else related to audio. dtas follows the worse-is-better
5
+ philosophy and acts as duct tape to combine existing command-line tools
6
+ for flexibility and ease-of-development. dtas is currently implemented
7
+ in Ruby (and some embedded shell), but may use other languages in the
8
+ future.
9
+
10
+ Primary executables available are:
11
+
12
+ * dtas-player - gapless music player (or pipeline/process manager :P)
13
+ * dtas-cueedit - embedded cuesheet editor (FLAC-only for now)
14
+
15
+ The centerpiece is dtas-player, a gapless music player designed to aid
16
+ in writing scripts for sox/ecasound use. Unlike monolithic music
17
+ players, dtas-player is close to a *nix shell in functionality, allowing
18
+ for the execution of arbitrary commands as sources, filters, and sinks
19
+ for audio. dtas-player supports:
20
+
21
+ * any DSP effects offered by SoX, ecasound, LADSPA, LV2, etc..
22
+ * multiple outputs for playback (including dumping audio to
23
+ files or piping to arbitrary commands)
24
+ * ReplayGain (including fallback gain and peak normalization)
25
+
26
+ dtas-player is a *nix pipeline and process manager. It may be used
27
+ spawn and pipe to abitrary Unix commands, not just audio-related
28
+ commands. It can interactively restart/replace the source (audio
29
+ decoder) component of a pipeline while keeping the sink (playback
30
+ endpoint) running.
31
+
32
+ Users of dtas-player will also be interested in the following scripts:
33
+
34
+ * dtas-ctl - "raw" command-line scripting interface for dtas-player
35
+ * dtas-enq - enqueue files/commands for dtas-player
36
+ * dtas-msinkctl - enable/disable multiple sinks with one command
37
+ * dtas-console - rudimentary curses interface for dtas-player
38
+ * dtas-sinkedit - edit sinks (playback targets) for dtas-player
39
+ * dtas-sourceedit - edit source (decoder process parameters) for dtas-player
40
+ * dtas-xdelay - alternative sink for dtas-player
41
+
42
+ All scripts have some documentation in the Documentation/ directory or
43
+ manpages distributed with the gem. dtas exposes no public APIs outside
44
+ of command-line and YAML text. dtas is aimed at users familiar with the
45
+ *nix command-line and editing text files. Familiarity with the Ruby
46
+ programming language is absolutely NOT required.
47
+
48
+ Coming:
49
+
50
+ * MPRIS/MPRIS 2.0 bridge for partial dtas-player control
51
+ * tracklist support in dtas-player (maybe?)
52
+ * whatever command-line tools come to mind...
53
+ * native ffmpeg/avconv/gst support in dtas-player
54
+ * better error handling, many bugfixes, etc...
55
+ * better documentation
56
+
57
+ == Source code
58
+
59
+ git clone git://80x24.org/dtas
60
+
61
+ Please use git-format-patch(1) and git-send-email(1) distributed with
62
+ the git(7) suite for generating and sending patches. Please format
63
+ pull requests with the git-request-pull(1) script (also distributed
64
+ with git(7)) and send them via email.
65
+
66
+ See http://www.git-scm.com/ for more information on git.
67
+
68
+ == Contact
69
+
70
+ Feedback (results, bug reports, patches, pull-requests) via plain-text
71
+ email is very much appreciated.
72
+
73
+ Please send plain-text email to Eric Wong <normalperson@yhbt.net>,
74
+ HTML will not be read. dtas is for GUI-phobes, by GUI-phobes.
75
+ Public mailing list coming soon.
76
+
77
+ == License
78
+
79
+ dtas is copyrighted Free Software by all contributors, see logs
80
+ in revision control for names and email addresses of all of them.
81
+
82
+ dtas is free software; you can redistribute it and/or modify it
83
+ under the terms of the GNU General Public License as published by the
84
+ Free Software Foundation; either version 3 of the License, or (at your
85
+ option) any later version.
86
+
87
+ dtas is distributed in the hope that it will be useful, but WITHOUT ANY
88
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
89
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
90
+ for more details.
91
+
92
+ You should have received a copy of the GNU General Public License along
93
+ with this program; if not, see https://www.gnu.org/licenses/gpl-3.0.txt
94
+
95
+ dtas is distributed in the hope that it will be useful, but WITHOUT ANY
96
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
97
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
98
+ for more details.
99
+
100
+ Note: The GPL does not and can not apply to external commands run by
101
+ dtas scripts, so users _may_ run any non-Free Software you want via dtas
102
+ (just like one may do so via bash). However, the dtas project does not
103
+ endorse nor support the use of any non-Free Software.
data/Rakefile ADDED
@@ -0,0 +1,97 @@
1
+ load "./GIT-VERSION-GEN"
2
+ manifest = "Manifest.txt"
3
+ gitidx = File.stat(".git/index") rescue nil
4
+ if ! File.exist?(manifest) || File.stat(manifest).mtime < gitidx.mtime
5
+ system("git ls-files > #{manifest}")
6
+ File.open(manifest, "a") do |fp|
7
+ fp.puts "NEWS"
8
+ fp.puts "lib/dtas/version.rb"
9
+
10
+ if system("make -C Documentation")
11
+ require 'fileutils'
12
+ FileUtils.rm_rf 'man'
13
+ if system("make -C Documentation gem-man")
14
+ `git ls-files -o man`.split(/\n/).each do |man|
15
+ fp.puts man
16
+ end
17
+ else
18
+ warn "failed to install manpages for distribution"
19
+ end
20
+ else
21
+ warn "failed to build manpages for distribution"
22
+ end
23
+ end
24
+ File.open("NEWS", "w") do |fp|
25
+ `git tag -l`.split(/\n/).each do |tag|
26
+ %r{\Av([\d\.]+)} =~ tag or next
27
+ version = $1
28
+ header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
29
+ header = header.split(/\n/)
30
+ tagger = header.grep(/\Atagger /)[0]
31
+ time = Time.at(tagger.split(/ /)[-2].to_i).utc
32
+ date = time.strftime("%Y-%m-%d")
33
+
34
+ fp.write("=== #{version} / #{date}\n\n#{subject}\n\n#{body}")
35
+ end
36
+ fp.flush
37
+ if fp.size <= 5
38
+ fp.puts "Unreleased"
39
+ end
40
+ end
41
+ end
42
+
43
+ require 'hoe'
44
+ Hoe.plugin :git
45
+ include Rake::DSL
46
+
47
+ h = Hoe.spec('dtas') do |p|
48
+ developer 'Eric Wong', 'e@80x24.org'
49
+
50
+ self.readme_file = 'README'
51
+ self.history_file = 'NEWS'
52
+ self.urls = %w(http://dtas.80x24.org/)
53
+ self.summary = x = File.readlines("README")[0].split(/\s+/)[1].chomp
54
+ self.description = self.paragraphs_of("README", 1)
55
+ # no public APIs, no HTML, either
56
+ self.need_rdoc = false
57
+ self.extra_rdoc_files = []
58
+ license "GPLv3+"
59
+ end
60
+
61
+ task :rsync_docs do
62
+ dest = "80x24.org:/srv/dtas/"
63
+ system("rsync --chmod=Fugo=r --files-from=.rsync_doc -av ./ #{dest}")
64
+ system("rsync --chmod=Fugo=r -av ./Documentation/*.txt #{dest}")
65
+ end
66
+
67
+ task :coverage do
68
+ env = {
69
+ "COVERAGE" => "1",
70
+ "RUBYOPT" => "-r./test/helper",
71
+ }
72
+ File.open("coverage.dump", "w").close # clear
73
+ pid = Process.spawn(env, "rake")
74
+ _, status = Process.waitpid2(pid)
75
+ require './test/covshow'
76
+ exit status.exitstatus
77
+ end
78
+
79
+ base = "dtas-#{h.version}"
80
+ task tarball: "pkg/#{base}" do
81
+ Dir.chdir("pkg") do
82
+ tgz = "#{base}.tar.gz"
83
+ tmp = "#{tmp}.#$$"
84
+ cmd = "tar cf - #{base} | gzip -9 > #{tmp}"
85
+ system(cmd) or abort "#{cmd}: #$?"
86
+ File.rename(tmp, tgz)
87
+ end
88
+ end
89
+
90
+ task dist: [ :tarball, :package ] do
91
+ Dir.chdir("pkg") do
92
+ %w(dtas-linux dtas-mpris).each do |gem|
93
+ cmd = "gem build ../#{gem}.gemspec"
94
+ system(cmd) or abort "#{cmd}: #$?"
95
+ end
96
+ end
97
+ end