ramekin 0.2.1 → 0.2.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/lib/ramekin/bends.rb +10 -16
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 399438b57abf19c6d68cbc4db7fbb96586985bf801f0f94cea4cd1365d2839e9
4
- data.tar.gz: 5abb75a51346fa517c749f3dd78d469459d02bef30bb3478060f2ed9527a0792
3
+ metadata.gz: f859d4c5dc75cc34a8053dcf5d9958aa48a80aea10d58bb44ac130e1b37c9af0
4
+ data.tar.gz: b1f2678cb27b008646ad250346c5345c7bf173749ba119d1b42ca5b8dbd3f1f4
5
5
  SHA512:
6
- metadata.gz: e9306550e91db609450792179302dce6752cb6fa9cb5fe97f95f1ac926bf28bc8548719c5e0d55e7909c0e4c8817149675f7caff6a86c0d4b37bbeaaf634840b
7
- data.tar.gz: 38abeba0943b587b1559e9fe0a1fe5fe0875f349a1b7fa5883b1e7da57e1e52898a0bd0ef2b7fee02b418a8f739aae118baae74627cbfce6d773d6d4fba5a4a9
6
+ metadata.gz: 5ac7a907935cdb923dd3007b739b257c89262cbd862fd7b987189487330c3b39c6ae762741c5cd91ffa0b8e5f07455ab40ad90fef6178e773db8db32fb9ecf23
7
+ data.tar.gz: 3ab59a78f14c06923c2f93011567b8fa6a41aa9c5d56ef8121088157b43f7775da6c8c43ebfe497039498348f3583d3c70523e121904922614215c094f410431
data/README.md CHANGED
@@ -10,6 +10,8 @@ Ramekin is a pre-processor for AddMusicK syntax that is in very early developmen
10
10
 
11
11
  Please keep in mind that as alpha software, **I may make breaking changes at any time.** After initial testing is done, I will release 1.0.0, at which point I will make a reasonable commitment to back-compatibility. That time is not yet.
12
12
 
13
+ For a preview of what full Ramekin tracks look like, feel free to check out [the examples repo](https://codeberg.org/jneen/ramekin-examples).
14
+
13
15
  # Installation
14
16
 
15
17
  First, [Install Ruby](https://ruby-lang.org). Windows users can use [RubyInstaller](https://rubyinstaller.org/).
data/lib/ramekin/bends.rb CHANGED
@@ -56,6 +56,8 @@ module Ramekin
56
56
 
57
57
  leftover = total_duration - bend_duration
58
58
 
59
+ return '' unless check_duration!(from, div)
60
+
59
61
  # ensure there is some leftover so we can toggle legato
60
62
  # before the end
61
63
  if leftover < 2
@@ -67,8 +69,6 @@ module Ramekin
67
69
  end
68
70
  end
69
71
 
70
- return '' unless check_duration!(from)
71
-
72
72
  out = StringIO.new
73
73
 
74
74
  out << from.octave_amk(oct)
@@ -94,8 +94,8 @@ module Ramekin
94
94
  true
95
95
  end
96
96
 
97
- def check_duration!(note)
98
- ticks = note.ticks
97
+ def check_duration!(note, divisor)
98
+ ticks = note.ticks / divisor
99
99
  return true if ticks > 0 && ticks <= 96
100
100
 
101
101
  error! 'bend length too short (must be at least one tick)', el: note if ticks <= 0
@@ -116,31 +116,25 @@ module Ramekin
116
116
  to_note = @notes[i+1]
117
117
 
118
118
  if i == 0
119
- ticks = note.ticks + to_note.ticks
120
119
  out << note.octave_amk(octave)
121
120
  out << note.note_name
122
121
  else
123
- ticks = to_note.ticks
124
122
  out << '^'
125
123
  end
126
124
 
127
- ticks /= divisor
128
- next unless check_duration!(note)
125
+ next unless check_duration!(note, divisor)
129
126
 
130
- # $dd doesn't work properly if the note
131
- # beforehand is more than a half note, so we have to
132
- # split it up
133
- clamped_ticks = [0x60, ticks].min
134
- leftover_ticks = [0, ticks-0x60].max
127
+ ticks = note.ticks
128
+ ticks /= divisor
135
129
 
136
130
  # always use tick count notation here because
137
131
  # amk can insert ties in some cases which will break $dd
138
- out << "=#{clamped_ticks}"
139
- out << dd(note.ticks, to_note)
132
+ out << "=#{ticks}"
133
+ out << dd(ticks, to_note)
140
134
  out << '$f4$01' if @end_legato && i == 0
141
- out << "^=#{leftover_ticks}" if leftover_ticks > 0
142
135
  end
143
136
 
137
+ out << "^#{@notes.last.length_amk(divisor)}" if @notes.last.ticks > 0
144
138
  out.string
145
139
  end
146
140
 
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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jneen
8
8
  bindir: gembin
9
9
  cert_chain: []
10
- date: 2025-03-07 00:00:00.000000000 Z
10
+ date: 2025-03-08 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: strscan