alda-rb 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8611e285f17508512f263503da8ef56f9d5763233cf980023738d677c1ffaa7e
4
- data.tar.gz: 82cf627eb924cc40f2c033333296daeefb3341f6dd194edc260eb6f986a2d374
3
+ metadata.gz: 6e35ecf8cca36fa942f004ba62c203226064ec3de09f21974ba57eb04cddd79a
4
+ data.tar.gz: 96f6a6540591c4a890034b234a737b68a678c199e2f88a8f73b4eadd5f824477
5
5
  SHA512:
6
- metadata.gz: 688aa784bd4581ff144a7a40a35f9d00df3cb662fe938f0bb8fcb8e8690b7f4040620d8332cb407a1726f6b3a9e3fe6e95f279be8062be64c206b56904bba002
7
- data.tar.gz: 3f209a0d2cd67c5d39f276d9816ea1af7798c0ad060ed93a5578c8c5ffbedf6ecb056f61d826eeb6275bf9fddccc84ebaf13e2051b096e8d96e4dd11b24ae848
6
+ metadata.gz: b8eb886e53075b0d4d154c0f2f29415eb366ce0ad1ca38aa6a0757eee136b028d952dab3e42f557d4037fcc41704b64f9467de4c89205f0cbd8d040b1d3ce70e
7
+ data.tar.gz: cec492d17877348e1023b5d488bd3cb2b6e874d13e13eaa1141eee5260853ff094e0daa9b412fbb7210f6a91b5fb2808bfe0831e932a84a510b1809a8df97b91
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7.0
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler
17
+ bundle install
18
+ bundle exec rake
data/.gitignore CHANGED
@@ -8,5 +8,5 @@
8
8
  /tmp/
9
9
 
10
10
  /.idea/
11
- Gemfile.lock
12
- /html/
11
+ .alda-nrepl-port
12
+ *.mid
data/CHANGELOG.md ADDED
@@ -0,0 +1,271 @@
1
+ # CHANGELOG
2
+
3
+ ## v0.3.0 (2023-05-29)
4
+
5
+ ### Changes for \Alda 2
6
+
7
+ Added API for support \Alda 2 while still being able to support \Alda 1:
8
+
9
+ - Added Alda::COMMANDS_FOR_VERSIONS and Alda::GENERATIONS.
10
+ - Added Alda::generation, which can be `:v1` or `:v2`.
11
+ Specifically, one of the values in the array Alda::GENERATIONS.
12
+ - Added Alda::v1?, Alda::v2?, Alda::v1!, Alda::v2! (See Alda::GENERATIONS).
13
+ - Added Alda::deduce_generation.
14
+ - Added Alda::GenerationError.
15
+ - In Alda::Chord#to_alda_code, considering an undocumented breaking change about chords,
16
+ the behavior is slightly different for \Alda 1 and \Alda 2.
17
+ - Added Thread#inside_alda_list.
18
+ - Added Alda::REPL#message and Alda::REPL#raw_message.
19
+
20
+ APIs that are modified to support \Alda 2:
21
+
22
+ - (BREAKING CHANGE!) Changed Alda::COMMANDS from an array of symbols into a hash.
23
+ The keys are the names of the commands,
24
+ and the values are arrays of generations where the command is available.
25
+ - Because \Alda 2 does not have the notion of down and up, if we are in v2,
26
+ Alda::down? will always return false and Alda::up? will always return true.
27
+ - Array#to_alda_code and Hash#to_alda_code behaves differently for \Alda 1 and \Alda 2 regarding
28
+ [a breaking change](https://github.com/alda-lang/alda/blob/master/doc/alda-2-migration-guide.md#attribute-syntax-has-changed-in-some-cases).
29
+
30
+ Documents that modified for notice about \Alda 2:
31
+
32
+ - Alda::[], Alda::up?, Alda::down?, Alda::COMMANDS.
33
+ - Alda::EventList#method_missing.
34
+ - Alda::InlineLisp.
35
+ - Array#to_alda_code, Hash#to_alda_code.
36
+ - Alda::REPL.
37
+ - Alda::CommandLineError#port.
38
+
39
+ Examples that are modified to work in \Alda 2:
40
+
41
+ - clapping_music,
42
+ - dot_accessor,
43
+ - marriage_d_amour.
44
+
45
+ ### New things
46
+
47
+ New features:
48
+
49
+ - Added warnings about structures that probably trigger errors in \Alda.
50
+ See Alda::EventContainer#check_in_chord, Alda::EventList#method_missing.
51
+ - Now you can specify a parameter in Alda::Event#detach_from_parent to exclude some
52
+ classes of parents that will be detached from.
53
+ - (Potentially BREAKING) Alda::Event#detach_from_parent now tries to detach the topmost container
54
+ instead of the event itself from the parent.
55
+ - Added a commandline program called `alda-irb`. See Alda::REPL.
56
+ - Traceback of exception will also be printed now if an Interrupt is caught in \REPL.
57
+ - <kbd>Ctrl</kbd>+<kbd>C</kbd> can now be used to discard the current input in \REPL.
58
+ - Now, Alda::REPL takes better care of indents.
59
+ - Added no-color mode and no-preview mode for \REPL.
60
+ - Now Alda::REPL::TempScore#score and Alda::REPL::TempScore#map output in blue color.
61
+
62
+ New APIs:
63
+
64
+ - Added Alda::Raw.
65
+ - Added Alda::Utils::warn, Alda::Utils::win_platform?,
66
+ Alda::Utils::snake_to_slug, Alda::Utils::slug_to_snake.
67
+ - Added Alda::Event#is_event_of?. It is overridden in Alda::EventContainer#is_event_of?.
68
+ - Added Alda::Event#== and Alda::EventList#==. It is overridden in many subclasses.
69
+ - Added Alda::EventContainer#check_in_chord.
70
+ - Added Alda::EventList#l.
71
+ - Added Alda::EventList#raw.
72
+ - Added Alda::REPL#color, Alda::REPL#preview.
73
+ - Added Alda::REPL#setup_repl, Alda::REPL#readline.
74
+ - Added Alda::REPL::TempScore#new_score, Alda::REPL::TempScore#score_text,
75
+ Alda::REPL::TempScore#score_data, Alda::REPL::TempScore#score_events.
76
+ - Added Alda::pipe.
77
+ - Added Alda::processes.
78
+ - Added Alda::NREPLServerError.
79
+ - Added Alda::GenerationError::assert_generation.
80
+
81
+ Slightly improved docs:
82
+
83
+ - Alda::EventContainer#event.
84
+ - The overriding +to_alda_code+'s and +on_contained+'s.
85
+ - Alda::Sequence, Alda::Sequence::RefineFlatten#flatten.
86
+ - The patches to Ruby's core classes.
87
+ - Alda::repl.
88
+ - Kernel.
89
+ - Alda::EventList::new.
90
+ - Alda::OrderError::new.
91
+ - Alda::InlineLisp.
92
+ - Alda::OrderError#expected.
93
+
94
+ Much better docs:
95
+
96
+ - Alda::EventContainer#/.
97
+ - Alda::EventList#on_contained.
98
+ - Alda::REPL::TempScore.
99
+
100
+ New examples:
101
+
102
+ - dynamics,
103
+ - track-volume,
104
+ - variables-2.
105
+
106
+ ### BREAKING changes
107
+
108
+ Removed APIs:
109
+
110
+ - Removed Alda::SetVariable#original_events.
111
+ - Removed Alda::repl. Now calling `Alda.repl` will trigger commandline `alda repl`.
112
+ For the old REPL function, use `Alda::REPL.new.run` instead.
113
+ - Removed Alda::REPL::TempScore#history.
114
+
115
+ Modified APIs or features:
116
+
117
+ - Now Alda::REPL#play_score does not call Alda::REPL#try_command.
118
+ - Alda::Score#load now use Alda::Raw instead of an Alda::InlineLisp to load a file.
119
+
120
+ ### Fixed bugs
121
+
122
+ - Fixed: sometimes Alda::Event#parent returns wrong result
123
+ because it is not updated in some cases.
124
+ - Fixed (potentially BREAKING): Hash#to_alda_code returns `[[k1 v1] [k2 v2]]`.
125
+ Now, it returns `{k1 v1 k2 v2}`.
126
+ - Use reline instead of readline in Alda::REPL
127
+ because Ruby 3.3 is dropping the shipment of readline-ext.
128
+
129
+ ### Others
130
+
131
+ - Added changelog.
132
+ - Modified the homepage and changelog URI in gemspec.
133
+ - Fixed the email in code of conduct.
134
+
135
+ ## v0.2.1 (2020-08-13)
136
+
137
+ - Fixed the bug in `examples/bwv846_prelude.rb`.
138
+ The file isn't changed when the version change
139
+ from [v0.1.4](#v014-2020-04-23) to [v0.2.0](#v020-2020-05-08)
140
+ but the new features in 0.2.0 made some codes in that file stop working.
141
+
142
+ ## v0.2.0 (2020-05-08)
143
+
144
+ - Separated `alda-rb.rb` into several files.
145
+ - REPL now supports `map`, `score`, and `new`.
146
+ - Added a lot of docs. Can be seen [here](https://ulysseszh.github.io/doc/alda-rb).
147
+ - Added Alda::Event#detach_from_parent.
148
+ - Fixed the bug that dot accessor of Alda::Part does not return the container (or the part itself).
149
+ - Added Alda::LispIdentifier.
150
+ - Fixed Alda::EventList#import now returns `nil`.
151
+ - Added some unit tests.
152
+ - Fixed the bug that creating an Alda::GetVariable occasionally crashes.
153
+ - Fixed bug that inline lisp is mistakenly interpreted as set-variable.
154
+
155
+ ## v0.1.4 (2020-04-23)
156
+
157
+ - The Ruby requirements become `">= 2.7"`, so update your Ruby.
158
+ - Added a colorful REPL! Run Alda::repl and see.
159
+ ```
160
+ $ ruby -ralda-rb -e "Alda.repl"
161
+ > puts status
162
+ [27713] Server up (2/2 workers available, backend port: 33245)
163
+ > piano_ c d e f
164
+ [piano: c d e f]
165
+ > 5.times do
166
+ > c
167
+ > end
168
+ c c c c c
169
+ > puts history
170
+ [piano: c d e f]
171
+ c c c c c
172
+ > play
173
+ > save 'temp.alda'
174
+ > puts `cat temp.alda`
175
+ [piano: c d e f]
176
+ c c c c c
177
+ > system 'rm temp.alda'
178
+ > exit
179
+ ```
180
+ - More than 2 events written together will become an Alda::Sequence object
181
+ (contained by an Alda::EventContainer).
182
+ Events that can use such sugar includes:
183
+ part (supports dot accessor), note, rest, octave, voice, marker, at-marker.
184
+ ```ruby
185
+ Alda::Score.new { p((c d e).event.class) } # => Alda::Sequence
186
+ ```
187
+ - Added: `o!` means octave up, `o?` means octave down. This is to be compatible with the sugar above.
188
+ - Similarly added: `!` at the end of a note means sharp, and `?` for flat, `_` for natural. It conflicts with slur, so `__` means slur, and `___` means slur and natural.
189
+ ```ruby
190
+ Alda::Score.new { piano_ c o? b? o! c o? b? }.to_s
191
+ # => "[piano: c < b- > c < b-]"
192
+ ```
193
+ - Added attr accessor Alda::Event#container.
194
+ - Fixed the bug occurring when one uses a dot accessor wrongly.
195
+ - Added Alda::Sequence::join to join several events into a flatten sequence.
196
+ - Fixed the bug in `examples/alternate_endings.rb`.
197
+ - Some of the examples are rewritten using the new sugar feature.
198
+ - Assign an alda variable by using a method ending with 2 underlines, or pass a block for it. The following three are equivalent:
199
+ ```ruby
200
+ Alda::Score.new { var__ c d e; piano_ var }
201
+ ```
202
+ ```ruby
203
+ Alda::Score.new { var { c d e }; piano_ var }
204
+ ```
205
+ ```ruby
206
+ Alda::Score.new { var__ { c d e }; piano_ var }
207
+ ```
208
+ This one is slightly different but has the same effect:
209
+ ```ruby
210
+ Alda::Score.new { var__ c, d, e; piano_ var }
211
+ ```
212
+ The name of a variable can be same as that of a lisp function if there is no ambiguity.
213
+ - The message of Alda::CommandLineError is optimized.
214
+ - Added Alda::OrderError, which is used instead of RuntimeError, representing a disorder of events.
215
+ ```ruby
216
+ Alda::Score.new do
217
+ motif = f4 f e e d d c2
218
+ g4 f e d c2
219
+ p @events.size # => 2
220
+ c4 c g g a a g2 motif
221
+ rescue OrderError => e
222
+ p @events.size # => 1
223
+ p e.expected # => #<Alda::EventContainer:...>
224
+ p e.got # => #<Alda::EventContainer:...>
225
+ end
226
+ ```
227
+ - The block passed to an Alda::EventList object is now called in Alda::Event#on_contained, so `@parent`, `@container` etc can be gotten inside.
228
+ - Alda::EventList can access methods in `@parent`.
229
+ - Canceled Alda::method_missing. Use meta-programming to define methods instead. You can now use `include Alda` to import such commands.
230
+ ```ruby
231
+ include Alda
232
+ version # => "Client version: 1.4.1\nServer version: [27713] 1.4.1\n"
233
+ ```
234
+ - Added Kernel#alda. It runs `alda` at command line and does not capture the output.
235
+ ```ruby
236
+ alda 'version'
237
+ ```
238
+ - Use Alda::[] to specify command options (not subcommand options):
239
+ ```ruby
240
+ Alda[quiet: true].play code: 'piano: c d e f' # => ""
241
+ ```
242
+ The options specified will be remembered. Invoke `Alda::clear_options` to forget them.
243
+ - Added Alda::CommandLineError#port.
244
+ ```ruby
245
+ begin
246
+ Alda[port: 1108].play code: 'y'
247
+ rescue CommandLineError => e
248
+ e.port # => 1108
249
+ end
250
+ ```
251
+ - Added Alda::Score#save and Alda::Score#load to save and load \Alda files.
252
+ ```ruby
253
+ Alda::Score.new { c d e }.save 'temp.alda'
254
+ File.read 'temp.alda' # => "[c d e]\n"
255
+ ```
256
+
257
+ ## v0.1.2 (2020-04-16)
258
+
259
+ - Added examples
260
+ - Fixed bug when writing `key_sig b: [:flat]`
261
+ - Added sequence sugar(s) and alternative repetition sugar (`%`) (see examples/alternate_endings.rb)
262
+ - Write options naturally for alda command line (`Alda.play code: 'piano: c'`)
263
+ - Can pass scores to alda command line (`Alda.play code: Alda::Score.new`)
264
+ - Added Alda::Score#parse, Alda::Score#export, and Alda::Score#to_s
265
+ - Fixed bug when writing `+o/c`
266
+ - Added support for dot accessor (see example/dot_accessor.rb)
267
+ - Fixed some mistakes in docs and README
268
+
269
+ ## v0.1.0 (2020-04-15)
270
+
271
+ The original version.
data/CODE_OF_CONDUCT.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at 2938747508@qq.com. All
58
+ reported by contacting the project team at UlyssesZhan@gmail.com. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ gemspec
5
5
  gem "rake", "~> 12.0"
6
6
  gem "minitest", "~> 5.0"
7
7
  gem "colorize"
8
+ gem "bencode"
8
9
  group :develop do
9
10
  gem 'rubocop'
10
11
  gem 'rdoc'
data/Gemfile.lock ADDED
@@ -0,0 +1,54 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ alda-rb (0.3.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ bencode (0.8.2)
11
+ colorize (0.8.1)
12
+ json (2.6.3)
13
+ minitest (5.18.0)
14
+ parallel (1.23.0)
15
+ parser (3.2.2.1)
16
+ ast (~> 2.4.1)
17
+ psych (5.1.0)
18
+ stringio
19
+ rainbow (3.1.1)
20
+ rake (12.3.3)
21
+ rdoc (6.5.0)
22
+ psych (>= 4.0.0)
23
+ regexp_parser (2.8.0)
24
+ rexml (3.2.5)
25
+ rubocop (1.51.0)
26
+ json (~> 2.3)
27
+ parallel (~> 1.10)
28
+ parser (>= 3.2.0.0)
29
+ rainbow (>= 2.2.2, < 4.0)
30
+ regexp_parser (>= 1.8, < 3.0)
31
+ rexml (>= 3.2.5, < 4.0)
32
+ rubocop-ast (>= 1.28.0, < 2.0)
33
+ ruby-progressbar (~> 1.7)
34
+ unicode-display_width (>= 2.4.0, < 3.0)
35
+ rubocop-ast (1.28.1)
36
+ parser (>= 3.2.1.0)
37
+ ruby-progressbar (1.13.0)
38
+ stringio (3.0.6)
39
+ unicode-display_width (2.4.2)
40
+
41
+ PLATFORMS
42
+ x86_64-linux
43
+
44
+ DEPENDENCIES
45
+ alda-rb!
46
+ bencode
47
+ colorize
48
+ minitest (~> 5.0)
49
+ rake (~> 12.0)
50
+ rdoc
51
+ rubocop
52
+
53
+ BUNDLED WITH
54
+ 2.4.1
data/README.md CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
21
21
 
22
22
  ## Usage
23
23
 
24
- [Install Alda](https://github.com/alda-lang/alda#Installation),
24
+ [Install Alda](https://alda.io/install),
25
25
  and try the following Ruby codes yourself:
26
26
 
27
27
  ```ruby
@@ -56,21 +56,70 @@ Alda::Score.new do
56
56
  end.play
57
57
  ```
58
58
 
59
+ There is also an interactive mode.
60
+ You can run it by running `alda-irb` in your command line if you installed the gem.
61
+ Run `bundle exec alda-irb` instead if you installed it using the bundler.
62
+
63
+ ```plain
64
+ $ alda-irb
65
+ > p processes.last
66
+ {:id=>"dus", :port=>34317, :state=>nil, :expiry=>nil, :type=>:repl_server}
67
+ > piano_; c d e f
68
+ piano: [c d e f]
69
+ > 5.times do
70
+ . c
71
+ > end
72
+ c c c c c
73
+ > score_text
74
+ piano: [c d e f]
75
+ c c c c c
76
+ > play
77
+ Playing...
78
+ > save 'temp.alda'
79
+ > puts `cat temp.alda`
80
+ piano: [c d e f]
81
+ c c c c c
82
+ > system 'rm temp.alda'
83
+ > exit
84
+ ```
85
+
86
+ You can also use it to programmatically communicate with the nREPL server:
87
+
88
+ ```ruby
89
+ repl = Alda::REPL.new
90
+ repl.message :eval_and_play, code: 'piano: c d e f' # => nil
91
+ repl.message :eval_and_play, code: 'g a b > c' # => nil
92
+ repl.message :score_text # => "piano: [c d e f]\ng a b > c\n"
93
+ repl.message :eval_and_play, code: 'this will cause an error' # (raises Alda::NREPLServerError)
94
+ ```
95
+
59
96
  ## Development
60
97
 
61
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
98
+ After checking out the repo, run `bin/setup` to install dependencies.
99
+ Then, run `rake test` to run the tests.
100
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
62
101
 
63
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
102
+ To install this gem onto your local machine, run `bundle exec rake install`.
103
+ To release a new version, update the version number in `version.rb`,
104
+ and then run `bundle exec rake release`,
105
+ which will create a git tag for the version,
106
+ push git commits and tags,
107
+ and push the `.gem` file to [rubygems.org](https://rubygems.org).
64
108
 
65
109
  ## Contributing
66
110
 
67
- Bug reports and pull requests are welcome on GitHub at https://github.com/UlyssesZh/alda-rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/UlyssesZh/alda-rb/blob/master/CODE_OF_CONDUCT.md).
68
-
111
+ Bug reports and pull requests are welcome on GitHub at https://github.com/UlyssesZh/alda-rb.
112
+ This project is intended to be a safe, welcoming space for collaboration,
113
+ and contributors are expected to adhere to the
114
+ [code of conduct](https://github.com/UlyssesZh/alda-rb/blob/master/CODE_OF_CONDUCT.md).
69
115
 
70
116
  ## License
71
117
 
72
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
118
+ The gem is available as open source under the terms of the
119
+ [MIT License](https://opensource.org/licenses/MIT).
73
120
 
74
121
  ## Code of Conduct
75
122
 
76
- Everyone interacting in the alda-rb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/UlyssesZh/alda-rb/blob/master/CODE_OF_CONDUCT.md).
123
+ Everyone interacting in the alda-rb project's codebases, issue trackers,
124
+ chat rooms and mailing lists is expected to follow the
125
+ [code of conduct](https://github.com/UlyssesZh/alda-rb/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -4,8 +4,8 @@ require 'rdoc/task'
4
4
 
5
5
  RDoc::Task.new do |t|
6
6
  t.main = 'README.md'
7
- t.rdoc_files.include 'README.md', 'CODE_OF_CONDUCT.md',
8
- 'LICENSE.txt', 'lib/**/*.rb'
7
+ t.rdoc_dir = 'doc'
8
+ t.rdoc_files.include 'README.md', 'CODE_OF_CONDUCT.md', 'CHANGELOG.md', 'LICENSE.txt', 'lib/**/*.rb'
9
9
  t.options << '--tab-width'
10
10
  t.options << '2'
11
11
  end
data/alda-rb.gemspec CHANGED
@@ -10,15 +10,15 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = %q{A Ruby library for live-coding music with Alda.}
12
12
  # spec.description = %q{TODO: Write a longer description or delete this line.}
13
- spec.homepage = "https://github.com/UlyssesZh/alda-rb"
13
+ spec.homepage = "https://ulysseszh.github.io/doc/alda-rb"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
16
16
 
17
17
  # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
18
18
 
19
19
  spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = spec.homepage
21
- spec.metadata["changelog_uri"] = "https://github.com/UlyssesZh/alda-rb/releases"
20
+ spec.metadata["source_code_uri"] = "https://github.com/UlyssesZh/alda-rb"
21
+ spec.metadata["changelog_uri"] = "https://ulysseszh.github.io/doc/alda-rb/CHANGELOG_md.html"
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -15,13 +15,13 @@ class Alda::Sequence
15
15
  /(?<letter>[a-g][-+_]*)(?<octave>\d*)/ =~ pitch
16
16
  octave = @@last_octave ||= '4' if octave.empty?
17
17
  result = Alda::Note.new "o#{@@last_octave = octave} #{letter}", duration
18
- @events.push result.tap { _1.parent = self }
18
+ @events.push result.tap { _1.parent = self }
19
19
  result
20
20
  end
21
21
  end
22
22
 
23
23
  Alda::Score.new do
24
- piano_ tempo 60
24
+ piano_; tempo 60
25
25
  %w[
26
26
  c e g c5 e
27
27
  c4 d a d5 f
@@ -62,7 +62,7 @@ Alda::Score.new do
62
62
  v3 r8 s{ notes.each { absolute _1, '16' } }*2
63
63
  end * 2
64
64
  end
65
- alda_code <<~ENDING
65
+ raw <<~ENDING
66
66
  V1:
67
67
  o2 c1 | c1 | c1~1s
68
68
  V2:
@@ -18,7 +18,7 @@ Alda::Score.new do
18
18
  end
19
19
 
20
20
  tempo! 172
21
- midi_percussion_ o2 set_note_length 8
21
+ midi_percussion_; o2 set_note_length 8
22
22
  v1; s{ play }*12*13
23
23
  v2; 13.times { s{ play; pattern.rotate! }*12 }
24
24
  end.play
@@ -4,5 +4,5 @@ require 'alda-rb'
4
4
 
5
5
  Alda::Score.new do
6
6
  violin_/viola_/cello_('strings'); g1_1_1
7
- strings_.cello_ o? c1_1_1
7
+ strings_.cello_; o? c1_1_1
8
8
  end.play
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'alda-rb'
4
+
5
+ Alda::Score.new do
6
+ piano_
7
+ c8
8
+ pppppp; d
9
+ ppppp; e
10
+ pppp; f
11
+ ppp; g
12
+ l :pp; a
13
+ l :p; b
14
+ mp; o! c
15
+ mf; o? b
16
+ l :f; a
17
+ ff; g
18
+ fff; f
19
+ ffff; e
20
+ fffff; d
21
+ ffffff; c4
22
+ end.play
data/examples/entropy.rb CHANGED
@@ -13,8 +13,8 @@ Alda::Score.new do
13
13
  if rand < REST_RATE
14
14
  pause ms.()
15
15
  octave rand OCTAVE_UPPER
16
- note pitch('abcdefg'[rand 7].to_sym,
17
- %i[sharp flat natural].sample), ms.()
16
+ note pitch(['abcdefg'[rand 7].to_sym,
17
+ %i[sharp flat natural].sample]), ms.()
18
18
  end
19
19
  end
20
20
 
data/examples/hanon.rb CHANGED
@@ -22,8 +22,8 @@ end
22
22
 
23
23
  class Alda::Sequence
24
24
  def play_solfege solfege
25
- v1; octave solfege.octave; note pitch solfege.letter
26
- v2; octave solfege.octave-1; note pitch solfege.letter
25
+ v1; octave solfege.octave; note pitch [solfege.letter]
26
+ v2; octave solfege.octave-1; note pitch [solfege.letter]
27
27
  end
28
28
  def play_hanon ary, octave, delta
29
29
  solfeges = ary.map { Solfege.new _1, octave }