musicality 0.5.0 → 0.5.1

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
  SHA1:
3
- metadata.gz: 0f671084b7ea13c0ac038a4b52cfcdfa51aeb76e
4
- data.tar.gz: 19e843c3f803fc34fcd3520dbbdea8bf100102f0
3
+ metadata.gz: 2b88f653838ad19299cc067b8b849a521cf7ca95
4
+ data.tar.gz: 1be51ce70f8a1c873ef95cd7887d63db02f50ccf
5
5
  SHA512:
6
- metadata.gz: 592b30da2943856712ddda8b78b0710d7311ef3ae9f2a9f8afad5b37a586ff4dc0227de98431b01da740b1b20d82956eaed0fe3cbfa2ddf47e7eaeba52bf968f
7
- data.tar.gz: 38a0389ee700b706a3b384e4a8702b9e1743ccf36a98090c7046c3c4e9dfc731b3ff9de946e2adcb856318d15686e95e5b75d9f9814b07fcfb06c52364683540
6
+ metadata.gz: f4c6cc3c5383cf641734519e7bdb32969426252914d74f80649bf2d01fdc697dda211d73b31040550918688eb998a033c634b5b5413737a653780948fc1f396e
7
+ data.tar.gz: 7b5be121f5efa1881a309dbcda6209718428ee2ab8ebf73593d3345724b18b9d1983e3c0af40161e752f8aa988343129c49d24a414880b661ba4c076ec5ca702
data/ChangeLog.md CHANGED
@@ -1,8 +1,17 @@
1
- ### 0.4.0 / 2014-12-02
2
- * Make Program inherit from Array.
3
- * Make Program#initialize take either a single array or variable number of args.
4
-
5
- ### 0.3.1 / 2014-12-01
1
+ ### 0.5.0 / 2015-04-27
2
+ * Alter note syntax
3
+ * shift articulation placement to after pitches
4
+ * disallow articulation and accent when pitches aren't present
5
+ * do not provide syntax for targeted slur and legato links
6
+ * Add *basic* support for Lilypond engraving (sheet music printing)
7
+ * Add `#to_midi_seq` convenience method to `Timed` and `TempoBased` scores.
8
+ * Add some rudimentary composition features
9
+ * `ScaleClass` class: contains a series of increasing pitch intervals. Can be realized as a scale given a starting pitch class.
10
+ * `Scale` class: contains a starting pitch class, and a series of pitch intervals. Can be realized as a series of pitches given a starting octave.
11
+ * Biinfinite sequence generators for adding and repeating
12
+ * Random rhythm generator
13
+ * Counterpoint generator
14
+ * Instead of `Program` class, use plain array for Score program
6
15
  * Add (optional) argument to Score::Measured#measures_long, to convert a specific note duration to measure duration. If not specified, the note duration of the longest part is used (as before).
7
16
 
8
17
  ### 0.3.0 / 2014-12-01
data/README.md CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install musicality
20
20
 
21
- ## Usage
21
+ ## Basic Usage
22
22
 
23
23
  Raw notation objects can be created like this:
24
24
  ```ruby
@@ -35,9 +35,37 @@ part = Part.new(MP, notes:[single,rest,chord])
35
35
 
36
36
  Or, a compact, string representation can be used, instead.
37
37
  ```ruby
38
- Part.new(FF, "/4Ab4 /4 1C3,E3,G3".to_notes)
38
+ Part.new(FF, notes: "/4Ab4 /4 1C3,E3,G3".to_notes)
39
39
  ```
40
40
 
41
+ Parts can be put together to make a whole musical score. The block syntax can be used for embedding parts in the score.
42
+ ```ruby
43
+ require 'musicality'
44
+ include Musicality
45
+ include Meters
46
+ include Dynamics
47
+
48
+ twinkle = Score::Measured.new(TWO_FOUR, 120) do |s|
49
+ s.parts["rhand"] = Part.new(MF) do |p|
50
+ p.notes += ("/4C4 "*2 + "/4G4 "*2 +
51
+ "/4A4 "*2 + "/2G4").to_notes
52
+ end
53
+ s.parts["lhand"] = Part.new(MF) do |p|
54
+ p.notes += ("/2C3,E3,G3 "*2 +
55
+ "/2F2,A2,C3 /2C3,E3,G3").to_notes
56
+ end
57
+ s.program.push 0...4
58
+ end
59
+ ```
60
+
61
+ To continue the above example, a score can be prepare for MIDI playback using the `Score::Measured#to_midi_seq` method.
62
+ ```ruby
63
+ TEMPO_SAMPLE_RATE = 500
64
+ seq = twinkle.to_midi_seq TEMPO_SAMPLE_RATE
65
+ File.open('twinkle.mid', 'wb'){ |fout| seq.write(fout) }
66
+ ```
67
+ ##
68
+
41
69
  ## Contributing
42
70
 
43
71
  1. Fork it ( https://github.com/[my-github-username]/musicality/fork )
@@ -9,7 +9,7 @@ class Score
9
9
 
10
10
  class TempoBased < Score
11
11
  def to_midi_seq tempo_sample_rate, instr_map = {}
12
- to_timed(tempo_sample_rate).to_midi(instr_map)
12
+ to_timed(tempo_sample_rate).to_midi_seq(instr_map)
13
13
  end
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Musicality
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -0,0 +1,45 @@
1
+ describe Score::Timed do
2
+ before :all do
3
+ @score = Score::Timed.new do |s|
4
+ s.parts["rhand"] = Part.new(Dynamics::MF) do |p|
5
+ p.notes += ("/2C4 "*2 + "/2G4 "*2 +
6
+ "/2A4 "*2 + "1G4").to_notes
7
+ end
8
+ s.parts["lhand"] = Part.new(Dynamics::MF) do |p|
9
+ p.notes += ("1C3,E3,G3 "*2 +
10
+ "1F2,A2,C3 1C3,E3,G3").to_notes
11
+ end
12
+ s.program.push 0...8
13
+ end
14
+ end
15
+
16
+ describe '#to_midi_seq' do
17
+ it 'should produce a MIDI::Sequence' do
18
+ seq = @score.to_midi_seq
19
+ seq.should be_a MIDI::Sequence
20
+ end
21
+ end
22
+ end
23
+
24
+ describe Score::TempoBased do
25
+ before :all do
26
+ @score = Score::Measured.new(TWO_FOUR, 120) do |s|
27
+ s.parts["rhand"] = Part.new(Dynamics::MF) do |p|
28
+ p.notes += ("/4C4 "*2 + "/4G4 "*2 +
29
+ "/4A4 "*2 + "/2G4").to_notes
30
+ end
31
+ s.parts["lhand"] = Part.new(Dynamics::MF) do |p|
32
+ p.notes += ("/2C3,E3,G3 "*2 +
33
+ "/2F2,A2,C3 /2C3,E3,G3").to_notes
34
+ end
35
+ s.program.push 0...4
36
+ end
37
+ end
38
+
39
+ describe '#to_midi_seq' do
40
+ it 'should produce a MIDI::Sequence' do
41
+ seq = @score.to_midi_seq 200
42
+ seq.should be_a MIDI::Sequence
43
+ end
44
+ end
45
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: musicality
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Tunnell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -291,6 +291,7 @@ files:
291
291
  - spec/performance/midi/midi_util_spec.rb
292
292
  - spec/performance/midi/part_sequencer_spec.rb
293
293
  - spec/performance/midi/score_sequencer_spec.rb
294
+ - spec/performance/midi/score_sequencing_spec.rb
294
295
  - spec/performance/model/note_sequence_spec.rb
295
296
  - spec/performance/util/note_linker_spec.rb
296
297
  - spec/performance/util/optimization_spec.rb
@@ -377,6 +378,7 @@ test_files:
377
378
  - spec/performance/midi/midi_util_spec.rb
378
379
  - spec/performance/midi/part_sequencer_spec.rb
379
380
  - spec/performance/midi/score_sequencer_spec.rb
381
+ - spec/performance/midi/score_sequencing_spec.rb
380
382
  - spec/performance/model/note_sequence_spec.rb
381
383
  - spec/performance/util/note_linker_spec.rb
382
384
  - spec/performance/util/optimization_spec.rb