wavesync 1.0.0.alpha1 → 1.0.0.alpha3
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.
- checksums.yaml +4 -4
- data/README.md +58 -51
- data/config/devices.yml +3 -0
- data/lib/wavesync/acid_chunk.rb +9 -4
- data/lib/wavesync/analyzer.rb +13 -4
- data/lib/wavesync/audio.rb +43 -4
- data/lib/wavesync/audio_format.rb +1 -0
- data/lib/wavesync/bpm_detector.rb +14 -7
- data/lib/wavesync/cli.rb +9 -146
- data/lib/wavesync/commands/analyze.rb +25 -0
- data/lib/wavesync/commands/command.rb +30 -0
- data/lib/wavesync/commands/help.rb +87 -0
- data/lib/wavesync/commands/set.rb +66 -0
- data/lib/wavesync/commands/sync.rb +57 -0
- data/lib/wavesync/commands.rb +28 -0
- data/lib/wavesync/config.rb +7 -1
- data/lib/wavesync/cue_chunk.rb +179 -0
- data/lib/wavesync/device.rb +19 -3
- data/lib/wavesync/essentia_bpm_detector.rb +36 -0
- data/lib/wavesync/file_converter.rb +2 -0
- data/lib/wavesync/path_resolver.rb +14 -5
- data/lib/wavesync/percival_bpm_detector.rb +29 -0
- data/lib/wavesync/python_venv.rb +25 -0
- data/lib/wavesync/scanner.rb +58 -9
- data/lib/wavesync/set.rb +17 -1
- data/lib/wavesync/set_editor.rb +333 -31
- data/lib/wavesync/track_padding.rb +7 -4
- data/lib/wavesync/ui.rb +39 -3
- data/lib/wavesync/version.rb +2 -1
- data/lib/wavesync.rb +2 -0
- metadata +15 -3
data/lib/wavesync/ui.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
# rbs_inline: enabled
|
|
2
3
|
|
|
3
4
|
require 'tty-cursor'
|
|
5
|
+
require 'tty-prompt'
|
|
4
6
|
require 'rainbow'
|
|
5
7
|
|
|
6
8
|
module Wavesync
|
|
@@ -14,11 +16,14 @@ module Wavesync
|
|
|
14
16
|
extra: :deepskyblue
|
|
15
17
|
}.freeze
|
|
16
18
|
|
|
19
|
+
#: () -> void
|
|
17
20
|
def initialize
|
|
18
|
-
@cursor = TTY::Cursor
|
|
19
|
-
@sticky_lines = []
|
|
21
|
+
@cursor = TTY::Cursor #: untyped
|
|
22
|
+
@sticky_lines = [] #: Array[String]
|
|
23
|
+
@prompt = TTY::Prompt.new(interrupt: :exit, active_color: :red) #: untyped
|
|
20
24
|
end
|
|
21
25
|
|
|
26
|
+
#: (String filename) -> void
|
|
22
27
|
def file_progress(filename)
|
|
23
28
|
path = Pathname.new(filename)
|
|
24
29
|
file_stem = path.basename(path.extname).to_s
|
|
@@ -27,6 +32,7 @@ module Wavesync
|
|
|
27
32
|
sticky(in_color(file_stem, :tertiary), 2)
|
|
28
33
|
end
|
|
29
34
|
|
|
35
|
+
#: (Integer index, Integer total_count, Device device) -> void
|
|
30
36
|
def sync_progress(index, total_count, device)
|
|
31
37
|
parts = [
|
|
32
38
|
in_color("wavesync #{device.name}", :primary),
|
|
@@ -36,6 +42,7 @@ module Wavesync
|
|
|
36
42
|
sticky(parts.join(' '), 0)
|
|
37
43
|
end
|
|
38
44
|
|
|
45
|
+
#: (AudioFormat source_format, AudioFormat target_format) -> void
|
|
39
46
|
def conversion_progress(source_format, target_format)
|
|
40
47
|
effective = source_format.merge(target_format)
|
|
41
48
|
|
|
@@ -48,16 +55,19 @@ module Wavesync
|
|
|
48
55
|
sticky(formatted_line, 3)
|
|
49
56
|
end
|
|
50
57
|
|
|
58
|
+
#: (AudioFormat source_format) -> void
|
|
51
59
|
def copy(source_format)
|
|
52
60
|
info = audio_info(source_format.sample_rate, source_format.bit_depth)
|
|
53
61
|
|
|
54
62
|
sticky(in_color("Copying #{source_format.file_type} (#{info})", :highlight), 3)
|
|
55
63
|
end
|
|
56
64
|
|
|
65
|
+
#: () -> void
|
|
57
66
|
def skip
|
|
58
67
|
sticky(in_color('↷ Skipping, already synced', :highlight), 3)
|
|
59
68
|
end
|
|
60
69
|
|
|
70
|
+
#: ((String | Integer)? tbpm, ?original_bars: Integer?, ?target_bars: Integer?) -> void
|
|
61
71
|
def bpm(tbpm, original_bars: nil, target_bars: nil)
|
|
62
72
|
if tbpm.nil?
|
|
63
73
|
sticky('', 4)
|
|
@@ -69,6 +79,7 @@ module Wavesync
|
|
|
69
79
|
end
|
|
70
80
|
end
|
|
71
81
|
|
|
82
|
+
#: (Integer index, Integer total_count) -> void
|
|
72
83
|
def analyze_progress(index, total_count)
|
|
73
84
|
parts = [
|
|
74
85
|
in_color('wavesync analyze', :primary),
|
|
@@ -77,19 +88,35 @@ module Wavesync
|
|
|
77
88
|
sticky(parts.join(' '), 0)
|
|
78
89
|
end
|
|
79
90
|
|
|
91
|
+
#: (String file, (String | Integer)? bpm) -> void
|
|
80
92
|
def analyze_skip(file, bpm)
|
|
81
93
|
set_analyze_file_stickies(file, in_color("↷ #{bpm} BPM already set", :highlight))
|
|
82
94
|
end
|
|
83
95
|
|
|
96
|
+
#: (String file, Integer? bpm) -> void
|
|
84
97
|
def analyze_result(file, bpm)
|
|
85
98
|
label = bpm ? in_color("#{bpm} BPM", :highlight) : in_color('No BPM detected', :highlight)
|
|
86
99
|
set_analyze_file_stickies(file, label)
|
|
87
100
|
end
|
|
88
101
|
|
|
102
|
+
#: (String message) -> bool
|
|
103
|
+
def confirm(message)
|
|
104
|
+
print in_color(message, :secondary)
|
|
105
|
+
response = $stdin.gets.to_s.strip.downcase
|
|
106
|
+
response == 'y'
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
#: (String label, Array[String] options) -> String
|
|
110
|
+
def select(label, options)
|
|
111
|
+
@prompt.select(label, options, cycle: true)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
#: (String text, Symbol key) -> String
|
|
89
115
|
def color(text, key)
|
|
90
116
|
in_color(text, key)
|
|
91
117
|
end
|
|
92
118
|
|
|
119
|
+
#: () -> void
|
|
93
120
|
def clear
|
|
94
121
|
print @cursor.clear_screen
|
|
95
122
|
print @cursor.move_to(0, 0)
|
|
@@ -97,26 +124,31 @@ module Wavesync
|
|
|
97
124
|
|
|
98
125
|
private
|
|
99
126
|
|
|
127
|
+
#: (Integer? sample_rate, Integer? bit_depth) -> String
|
|
100
128
|
def audio_info(sample_rate, bit_depth)
|
|
101
129
|
[
|
|
102
130
|
sample_rate_to_khz(sample_rate),
|
|
103
|
-
bit_depth
|
|
131
|
+
bit_depth&.to_s
|
|
104
132
|
].compact.join('/')
|
|
105
133
|
end
|
|
106
134
|
|
|
135
|
+
#: (String string, Symbol key) -> String
|
|
107
136
|
def in_color(string, key)
|
|
108
137
|
Rainbow(string).color(THEME[key])
|
|
109
138
|
end
|
|
110
139
|
|
|
140
|
+
#: (String text, Integer index) -> void
|
|
111
141
|
def sticky(text, index)
|
|
112
142
|
set_sticky(text, index)
|
|
113
143
|
redraw
|
|
114
144
|
end
|
|
115
145
|
|
|
146
|
+
#: (String text, Integer index) -> void
|
|
116
147
|
def set_sticky(text, index)
|
|
117
148
|
@sticky_lines[index] = text
|
|
118
149
|
end
|
|
119
150
|
|
|
151
|
+
#: (String file, String label) -> void
|
|
120
152
|
def set_analyze_file_stickies(file, label)
|
|
121
153
|
path = Pathname.new(file)
|
|
122
154
|
set_sticky(in_color(path.parent.basename.to_s, :secondary), 1)
|
|
@@ -125,13 +157,17 @@ module Wavesync
|
|
|
125
157
|
redraw
|
|
126
158
|
end
|
|
127
159
|
|
|
160
|
+
#: () -> void
|
|
128
161
|
def redraw
|
|
129
162
|
print @cursor.clear_screen
|
|
130
163
|
print @cursor.move_to(0, 0)
|
|
131
164
|
puts @sticky_lines.join("\n")
|
|
132
165
|
end
|
|
133
166
|
|
|
167
|
+
#: (Integer? rate) -> String?
|
|
134
168
|
def sample_rate_to_khz(rate)
|
|
169
|
+
return nil unless rate
|
|
170
|
+
|
|
135
171
|
khz = rate.to_f / 1000
|
|
136
172
|
(khz % 1).zero? ? khz.to_i.to_s : khz.round(1).to_s
|
|
137
173
|
end
|
data/lib/wavesync/version.rb
CHANGED
data/lib/wavesync.rb
CHANGED
|
@@ -5,6 +5,7 @@ end
|
|
|
5
5
|
|
|
6
6
|
require 'wavesync/version'
|
|
7
7
|
require 'wavesync/acid_chunk'
|
|
8
|
+
require 'wavesync/cue_chunk'
|
|
8
9
|
require 'wavesync/audio_format'
|
|
9
10
|
require 'wavesync/audio'
|
|
10
11
|
require 'wavesync/track_padding'
|
|
@@ -18,4 +19,5 @@ require 'wavesync/bpm_detector'
|
|
|
18
19
|
require 'wavesync/analyzer'
|
|
19
20
|
require 'wavesync/set'
|
|
20
21
|
require 'wavesync/set_editor'
|
|
22
|
+
require 'wavesync/commands'
|
|
21
23
|
require 'wavesync/cli'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wavesync
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0.
|
|
4
|
+
version: 1.0.0.alpha3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andreas Zecher
|
|
@@ -109,10 +109,20 @@ files:
|
|
|
109
109
|
- lib/wavesync/audio_format.rb
|
|
110
110
|
- lib/wavesync/bpm_detector.rb
|
|
111
111
|
- lib/wavesync/cli.rb
|
|
112
|
+
- lib/wavesync/commands.rb
|
|
113
|
+
- lib/wavesync/commands/analyze.rb
|
|
114
|
+
- lib/wavesync/commands/command.rb
|
|
115
|
+
- lib/wavesync/commands/help.rb
|
|
116
|
+
- lib/wavesync/commands/set.rb
|
|
117
|
+
- lib/wavesync/commands/sync.rb
|
|
112
118
|
- lib/wavesync/config.rb
|
|
119
|
+
- lib/wavesync/cue_chunk.rb
|
|
113
120
|
- lib/wavesync/device.rb
|
|
121
|
+
- lib/wavesync/essentia_bpm_detector.rb
|
|
114
122
|
- lib/wavesync/file_converter.rb
|
|
115
123
|
- lib/wavesync/path_resolver.rb
|
|
124
|
+
- lib/wavesync/percival_bpm_detector.rb
|
|
125
|
+
- lib/wavesync/python_venv.rb
|
|
116
126
|
- lib/wavesync/scanner.rb
|
|
117
127
|
- lib/wavesync/set.rb
|
|
118
128
|
- lib/wavesync/set_editor.rb
|
|
@@ -122,7 +132,9 @@ files:
|
|
|
122
132
|
homepage: https://github.com/pixelate/wavesync
|
|
123
133
|
licenses:
|
|
124
134
|
- MIT
|
|
125
|
-
metadata:
|
|
135
|
+
metadata:
|
|
136
|
+
documentation_uri: https://github.com/pixelate/wavesync?tab=readme-ov-file#wavesync
|
|
137
|
+
rubygems_mfa_required: 'true'
|
|
126
138
|
rdoc_options: []
|
|
127
139
|
require_paths:
|
|
128
140
|
- lib
|
|
@@ -130,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
130
142
|
requirements:
|
|
131
143
|
- - ">="
|
|
132
144
|
- !ruby/object:Gem::Version
|
|
133
|
-
version: '3.
|
|
145
|
+
version: '3.3'
|
|
134
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
147
|
requirements:
|
|
136
148
|
- - ">="
|