ramekin 0.2.8 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 822404007ec094a4910d097982e43afd844eaefa1b561a6a51b90c005c23e970
4
- data.tar.gz: a67f165b4ac578fae530f10080743d503bda72ecc8e4aaffe19034db426abe65
3
+ metadata.gz: dc9d8831c982112091407c651b5f183b750c75d43d1e3d2615fbd89dc7b4446b
4
+ data.tar.gz: 23b5db297f7166f9257609ab45888f81894e2d5df8d40a922920efe56f4e948d
5
5
  SHA512:
6
- metadata.gz: 49d18c1c3b746d6866b4aec8e8aa400b42a296437326fd0a76a7c5736aab1e92ed1ffa33d55c7053daa876b317e03d34cb85c29ccdd87dcb616057e5c2dc53b3
7
- data.tar.gz: 3097307fb155950f8dbd239a36eba3e594220738066477fbd695d89a54f9faf848e00e8f7298ac837c0f18d27a89a0956b17f9779fdd65646412b62685ab1917
6
+ metadata.gz: bd69f5639e4f86fb7792b38021a13e02f0604fd375f1821e59909b674d7160b9df2efad996cae43a94d47540f1ba33e051097b00f5278e02806b9f460859d916
7
+ data.tar.gz: 449a4e060eba4cb7b93d6ab6ea92a10f7ba99411f2f66d6b94f105f465541547c7c92475fd23891208ac806395bf7b1a575ea0737b906c6f03c6a505005c88b7
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 README and packaged samples.
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:
@@ -78,21 +78,26 @@ 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
- FileUtils.cp(stats_file, "./#{basename}.stats.txt")
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("samples/#{basename}")
98
+ FileUtils.mkdir_p("./#{sampledir_name}")
94
99
  @meta.instruments.each do |inst|
95
- FileUtils.cp(inst.sample_path, "./samples/#{basename}/#{inst.sample_name}")
100
+ FileUtils.cp(inst.sample_path, "./#{sampledir_name}/#{inst.sample_name}")
96
101
  end
97
102
  end
98
103
 
@@ -132,6 +137,10 @@ module Ramekin
132
137
  "#@workdir/stats/#{basename}.txt"
133
138
  end
134
139
 
140
+ def vis_file
141
+ "#@workdir/Visualizations/#{basename}.png"
142
+ end
143
+
135
144
  def spc
136
145
  File.read(spc_file)
137
146
  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 README and packaged samples."
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?
@@ -259,6 +264,11 @@ module Ramekin
259
264
  MSG
260
265
  end
261
266
 
267
+ binding.pry
268
+ if @output_vis
269
+ FileUtils.cp(runner.vis_file, @output_vis)
270
+ end
271
+
262
272
  if @wav_file
263
273
  SPCPlayer.instance.setup!
264
274
  SPCPlayer.instance.render(@play_spc, @wav_file, @wav_seconds)
@@ -298,6 +308,8 @@ module Ramekin
298
308
  when '--list'
299
309
  @mode = :list
300
310
  @term = argv.shift || ''
311
+ else
312
+ usage!("unknown argument: #{h.inspect}")
301
313
  end
302
314
  end
303
315
 
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,21 @@ module Ramekin
23
22
  @options = {}
24
23
  end
25
24
 
25
+ def sample_path_unsafe
26
+ return @sample_path if @sample_path
27
+
28
+ return "#{@title.value} - #{@game.value}" if @title && @game
29
+ return (@title || @game).value if @title || @game
30
+ nil
31
+ end
32
+
33
+ def sample_path
34
+ p = sample_path_unsafe
35
+ return nil if p.nil?
36
+
37
+ p.gsub(/[\\\/.]/, '_').gsub(/\s+/m, ' ')
38
+ end
39
+
26
40
  def echo_channel_bits
27
41
  (@echo_channels ||= Set.new).map { |x| 1 << x }.inject(0, &:|)
28
42
  end
@@ -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,7 +51,7 @@ 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"
59
56
 
60
57
  amk = @track.meta.amk&.value || 4
@@ -70,7 +67,7 @@ module Ramekin
70
67
  yield "#path #{(m.sample_path || @filename.chomp('.rmk')).inspect}\n"
71
68
  yield "#samples {\n"
72
69
  if m.sample_groups.empty?
73
- yield " #default"
70
+ yield " #default\n"
74
71
  else
75
72
  m.sample_groups.each do |group|
76
73
  yield " ##{group.value}\n"
@@ -85,7 +82,6 @@ module Ramekin
85
82
  yield "#instruments {\n"
86
83
  m.instruments.each_with_index do |inst, i|
87
84
  @instrument_index[inst.name.value] = 30 + i
88
- @default_octaves[inst.name.value] = inst.octave
89
85
  yield " #{inst.to_amk}\n"
90
86
  end
91
87
  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.2.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jneen
8
8
  bindir: gembin
9
9
  cert_chain: []
10
- date: 2025-03-22 00:00:00.000000000 Z
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.5
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: []