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