ramekin 0.2.8 → 0.3.1
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 +5 -2
- data/lib/ramekin/amk_runner.rb +24 -25
- data/lib/ramekin/cli.rb +13 -6
- data/lib/ramekin/meta.rb +35 -1
- data/lib/ramekin/renderer.rb +9 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede8bd8e5c78aa94652f19f2cb65a687684f39fe569bfa50954d49202e24b732
|
4
|
+
data.tar.gz: 46457849f8df89c43f9070fc3de92bf515c1550d897c78574f94c62aeb6d0a26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 982278d0d678809e2132651ffbd8af5cac3352b4a1560bdfb4538689f394733becae31c8454e867ff170ed056d228af65b78df61787f8d1aadfbf7baa4537f98
|
7
|
+
data.tar.gz: ef74b770772546afb76a19a82f50c245fc54a39facfb5d187990821c23ffd66943735deff93eadeba9df1507d88fb6cef7cc8ed2f9e476c3972c316a59334e31
|
data/README.md
CHANGED
@@ -76,11 +76,14 @@ ramekin filename.rmk [flags]
|
|
76
76
|
set up an SPC player if none is detected.
|
77
77
|
--package my-cool-folder/
|
78
78
|
create a package directory suitable for submission
|
79
|
-
to SMWC, complete with
|
79
|
+
to SMWC, complete with packaged samples.
|
80
80
|
--wav filename.wav
|
81
81
|
--wav filename.wav:N
|
82
|
-
(non-windows only)
|
83
82
|
render N seconds of the file to WAV.
|
83
|
+
(non-windows only - windows users should use --play
|
84
|
+
and render from the SPCPlay program)
|
85
|
+
--vis filename.png
|
86
|
+
outputs AddmusicK's ARAM visualization to a specified file
|
84
87
|
|
85
88
|
ramekin pack [flags]
|
86
89
|
flags:
|
data/lib/ramekin/amk_runner.rb
CHANGED
@@ -78,49 +78,44 @@ module Ramekin
|
|
78
78
|
binding.pry if ENV['RAMEKIN_DEBUG'] == '1'
|
79
79
|
end
|
80
80
|
|
81
|
+
$stderr.puts(File.read(stats_file))
|
82
|
+
|
81
83
|
return res
|
82
84
|
end
|
83
85
|
|
86
|
+
def sampledir_name
|
87
|
+
@meta.sample_path || basename
|
88
|
+
end
|
89
|
+
|
84
90
|
def export(outdir)
|
85
91
|
Dir.chdir outdir do
|
86
92
|
FileUtils.cp(@filename, "./#{basename}.rmk")
|
87
93
|
FileUtils.cp(spc_file, "./#{basename}.spc")
|
88
|
-
|
89
|
-
FileUtils.cp("#@workdir/Visualizations/#{basename}.png", "./#{basename}.png")
|
94
|
+
|
90
95
|
File.write("./#{basename}.txt", @txt)
|
91
96
|
|
92
97
|
if @meta.instruments.any?
|
93
|
-
FileUtils.mkdir_p("
|
98
|
+
FileUtils.mkdir_p("./#{sampledir_name}")
|
94
99
|
@meta.instruments.each do |inst|
|
95
|
-
FileUtils.cp(inst.sample_path, "
|
100
|
+
FileUtils.cp(inst.sample_path, "./#{sampledir_name}/#{inst.sample_name}")
|
96
101
|
end
|
97
102
|
end
|
98
103
|
|
99
|
-
|
100
|
-
|
101
|
-
pack_info = packs.map do |pack|
|
102
|
-
out = StringIO.new
|
103
|
-
out << " #{pack.name}"
|
104
|
-
out << " (posted by #{pack.authors.join(', ')})" if pack.authors.any?
|
105
|
-
out << "\n"
|
104
|
+
readme = @meta.readme&.value
|
106
105
|
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
if readme
|
107
|
+
File.write("./README.txt", <<~README)
|
108
|
+
#{readme}
|
110
109
|
|
111
|
-
|
110
|
+
--
|
112
111
|
|
113
|
-
|
114
|
-
|
112
|
+
#{basename}.txt was composed as #{basename}.rmk with Ramekin
|
113
|
+
https://codeberg.org/jneen/ramekin
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
Sample sources:
|
122
|
-
#{pack_info}
|
123
|
-
README
|
115
|
+
Sample sources:
|
116
|
+
#{@meta.pack_info}
|
117
|
+
README
|
118
|
+
end
|
124
119
|
end
|
125
120
|
end
|
126
121
|
|
@@ -132,6 +127,10 @@ module Ramekin
|
|
132
127
|
"#@workdir/stats/#{basename}.txt"
|
133
128
|
end
|
134
129
|
|
130
|
+
def vis_file
|
131
|
+
"#@workdir/Visualizations/#{basename}.png"
|
132
|
+
end
|
133
|
+
|
135
134
|
def spc
|
136
135
|
File.read(spc_file)
|
137
136
|
end
|
data/lib/ramekin/cli.rb
CHANGED
@@ -53,12 +53,14 @@ module Ramekin
|
|
53
53
|
$stderr.puts " #{default_text}"
|
54
54
|
$stderr.puts " --package my-cool-folder/"
|
55
55
|
$stderr.puts " create a package directory suitable for submission"
|
56
|
-
$stderr.puts " to SMWC, complete with
|
56
|
+
$stderr.puts " to SMWC, complete with packaged samples."
|
57
57
|
unless Ramekin.config.windows?
|
58
58
|
$stderr.puts " --wav filename.wav"
|
59
59
|
$stderr.puts " --wav filename.wav:N"
|
60
60
|
$stderr.puts " render N seconds of the file to WAV. Requires spct."
|
61
61
|
end
|
62
|
+
$stderr.puts " --vis filename.png"
|
63
|
+
$stderr.puts " outputs AddmusicK's ARAM visualization to a specified file"
|
62
64
|
$stderr.puts ""
|
63
65
|
$stderr.puts "ramekin package [flags]"
|
64
66
|
$stderr.puts "ramekin pack [flags]"
|
@@ -129,6 +131,8 @@ module Ramekin
|
|
129
131
|
@sample_path = argv.shift or usage! 'missing path for --sample-path'
|
130
132
|
when '--txt'
|
131
133
|
@output_txt = argv.shift or usage! 'missing filename after --txt'
|
134
|
+
when '--vis'
|
135
|
+
@output_vis = argv.shift or usage! 'missing filename after --vis'
|
132
136
|
when '--spc'
|
133
137
|
@output_spc = argv.shift or usage! 'missing filename after --spc'
|
134
138
|
when '--package'
|
@@ -219,12 +223,13 @@ module Ramekin
|
|
219
223
|
exit 1
|
220
224
|
end
|
221
225
|
|
222
|
-
unless @output_txt || @output_package || @output_spc
|
226
|
+
unless @output_txt || @output_package || @output_spc || @output_vis
|
223
227
|
warn <<~WARN
|
224
228
|
no output specified. use either:
|
225
229
|
--txt my_cool_file.txt
|
226
230
|
--spc my_cool_file.spc
|
227
231
|
--package my_cool_output_dir
|
232
|
+
--vis my_cool_png.png
|
228
233
|
--play
|
229
234
|
--wav my_cool_file.wav
|
230
235
|
WARN
|
@@ -236,7 +241,7 @@ module Ramekin
|
|
236
241
|
File.write(@output_txt, txt)
|
237
242
|
end
|
238
243
|
|
239
|
-
if @output_spc || @output_package
|
244
|
+
if @output_spc || @output_package || @output_vis
|
240
245
|
runner = AMKRunner.new(@infile, channels.meta, txt)
|
241
246
|
result = runner.compile
|
242
247
|
unless result && result.success?
|
@@ -253,10 +258,10 @@ module Ramekin
|
|
253
258
|
$stderr.puts <<~MSG
|
254
259
|
Package directory generated at #{@output_package}
|
255
260
|
MSG
|
261
|
+
end
|
256
262
|
|
257
|
-
|
258
|
-
|
259
|
-
MSG
|
263
|
+
if @output_vis
|
264
|
+
FileUtils.cp(runner.vis_file, @output_vis)
|
260
265
|
end
|
261
266
|
|
262
267
|
if @wav_file
|
@@ -298,6 +303,8 @@ module Ramekin
|
|
298
303
|
when '--list'
|
299
304
|
@mode = :list
|
300
305
|
@term = argv.shift || ''
|
306
|
+
else
|
307
|
+
usage!("unknown argument: #{h.inspect}")
|
301
308
|
end
|
302
309
|
end
|
303
310
|
|
data/lib/ramekin/meta.rb
CHANGED
@@ -14,7 +14,6 @@ module Ramekin
|
|
14
14
|
attr_reader :volume
|
15
15
|
attr_reader :tempo
|
16
16
|
attr_reader :echo
|
17
|
-
attr_reader :sample_path
|
18
17
|
def initialize(elements, sample_path=nil)
|
19
18
|
@elements = elements
|
20
19
|
@instruments = []
|
@@ -23,6 +22,41 @@ module Ramekin
|
|
23
22
|
@options = {}
|
24
23
|
end
|
25
24
|
|
25
|
+
def sample_path_unsafe
|
26
|
+
return @sample_path if @sample_path
|
27
|
+
game = @game&.value
|
28
|
+
title = @title&.value
|
29
|
+
author = @author&.value
|
30
|
+
|
31
|
+
game = nil if game && game.upcase == "N/A"
|
32
|
+
|
33
|
+
return "#{game} - #{title}" if game && title
|
34
|
+
return "#{author} - #{title}" if author && title
|
35
|
+
return title if title
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
|
39
|
+
def pack_info
|
40
|
+
packs = self.instruments.map(&:pack).uniq
|
41
|
+
|
42
|
+
pack_info = packs.map do |pack|
|
43
|
+
out = StringIO.new
|
44
|
+
out << " #{pack.name}"
|
45
|
+
out << " (posted by #{pack.authors.join(', ')})" if pack.authors.any?
|
46
|
+
out << "\n"
|
47
|
+
|
48
|
+
out << " - #{pack.url}"
|
49
|
+
out.string
|
50
|
+
end.join("\n\n")
|
51
|
+
end
|
52
|
+
|
53
|
+
def sample_path
|
54
|
+
p = sample_path_unsafe
|
55
|
+
return nil if p.nil?
|
56
|
+
|
57
|
+
p.gsub(/[\\\/.]/, '_').gsub(/\s+/m, ' ')
|
58
|
+
end
|
59
|
+
|
26
60
|
def echo_channel_bits
|
27
61
|
(@echo_channels ||= Set.new).map { |x| 1 << x }.inject(0, &:|)
|
28
62
|
end
|
data/lib/ramekin/renderer.rb
CHANGED
@@ -26,9 +26,6 @@ module Ramekin
|
|
26
26
|
SMW::BUILTINS.each do |name, id|
|
27
27
|
@instrument_index[name] = id
|
28
28
|
end
|
29
|
-
|
30
|
-
# optional default octaves for instrument switching
|
31
|
-
@default_octaves = Hash.new(4)
|
32
29
|
end
|
33
30
|
|
34
31
|
def render(&b)
|
@@ -54,8 +51,15 @@ module Ramekin
|
|
54
51
|
yield " #comment #{m.comment.value.inspect}\n" if m.comment
|
55
52
|
yield "}\n\n"
|
56
53
|
|
57
|
-
yield "; generated from #{@filename} by Ramekin\n"
|
54
|
+
yield "; generated from #{@filename} by Ramekin v#{RAMEKIN_VERSION}\n"
|
58
55
|
yield "; https://codeberg.org/jneen/ramekin\n\n"
|
56
|
+
if m.instruments.any?
|
57
|
+
yield "; Sample Sources:\n"
|
58
|
+
m.pack_info.split("\n").each do |line|
|
59
|
+
yield "; #{line}\n"
|
60
|
+
end
|
61
|
+
yield "\n"
|
62
|
+
end
|
59
63
|
|
60
64
|
amk = @track.meta.amk&.value || 4
|
61
65
|
yield "#amk #{amk}\n"
|
@@ -70,7 +74,7 @@ module Ramekin
|
|
70
74
|
yield "#path #{(m.sample_path || @filename.chomp('.rmk')).inspect}\n"
|
71
75
|
yield "#samples {\n"
|
72
76
|
if m.sample_groups.empty?
|
73
|
-
yield " #default"
|
77
|
+
yield " #default\n"
|
74
78
|
else
|
75
79
|
m.sample_groups.each do |group|
|
76
80
|
yield " ##{group.value}\n"
|
@@ -85,7 +89,6 @@ module Ramekin
|
|
85
89
|
yield "#instruments {\n"
|
86
90
|
m.instruments.each_with_index do |inst, i|
|
87
91
|
@instrument_index[inst.name.value] = 30 + i
|
88
|
-
@default_octaves[inst.name.value] = inst.octave
|
89
92
|
yield " #{inst.to_amk}\n"
|
90
93
|
end
|
91
94
|
yield "}\n\n"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ramekin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jneen
|
8
8
|
bindir: gembin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-25 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: strscan
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.6.
|
118
|
+
rubygems_version: 3.6.6
|
119
119
|
specification_version: 4
|
120
120
|
summary: A tool for making SMW music with AddmusicK
|
121
121
|
test_files: []
|