mtk 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +3 -2
- data/DEVELOPMENT_NOTES.md +114 -0
- data/INTRO.md +64 -8
- data/LICENSE.txt +1 -1
- data/README.md +31 -102
- data/Rakefile +56 -18
- data/bin/mtk +215 -0
- data/examples/crescendo.rb +5 -5
- data/examples/drum_pattern1.rb +23 -0
- data/examples/dynamic_pattern.rb +8 -11
- data/examples/gets_and_play.rb +26 -0
- data/examples/notation.rb +22 -0
- data/examples/play_midi.rb +8 -10
- data/examples/random_tone_row.rb +2 -2
- data/examples/syntax_to_midi.rb +28 -0
- data/examples/test_output.rb +8 -0
- data/examples/tone_row_melody.rb +6 -6
- data/lib/mtk.rb +52 -40
- data/lib/mtk/chord.rb +55 -0
- data/lib/mtk/constants/durations.rb +57 -0
- data/lib/mtk/constants/intensities.rb +61 -0
- data/lib/mtk/constants/intervals.rb +73 -0
- data/lib/mtk/constants/pitch_classes.rb +29 -0
- data/lib/mtk/constants/pitches.rb +52 -0
- data/lib/mtk/duration.rb +211 -0
- data/lib/mtk/events/event.rb +119 -0
- data/lib/mtk/events/note.rb +112 -0
- data/lib/mtk/events/parameter.rb +54 -0
- data/lib/mtk/helpers/collection.rb +164 -0
- data/lib/mtk/helpers/convert.rb +36 -0
- data/lib/mtk/helpers/lilypond.rb +162 -0
- data/lib/mtk/helpers/output_selector.rb +67 -0
- data/lib/mtk/helpers/pitch_collection.rb +23 -0
- data/lib/mtk/helpers/pseudo_constants.rb +26 -0
- data/lib/mtk/intensity.rb +156 -0
- data/lib/mtk/interval.rb +155 -0
- data/lib/mtk/lang/mtk_grammar.citrus +190 -13
- data/lib/mtk/lang/parser.rb +29 -0
- data/lib/mtk/melody.rb +94 -0
- data/lib/mtk/midi/dls_synth_device.rb +144 -0
- data/lib/mtk/midi/dls_synth_output.rb +62 -0
- data/lib/mtk/midi/file.rb +67 -32
- data/lib/mtk/midi/input.rb +97 -0
- data/lib/mtk/midi/jsound_input.rb +36 -17
- data/lib/mtk/midi/jsound_output.rb +48 -46
- data/lib/mtk/midi/output.rb +195 -0
- data/lib/mtk/midi/unimidi_input.rb +117 -0
- data/lib/mtk/midi/unimidi_output.rb +121 -0
- data/lib/mtk/{_numeric_extensions.rb → numeric_extensions.rb} +12 -0
- data/lib/mtk/patterns/chain.rb +49 -0
- data/lib/mtk/{pattern → patterns}/choice.rb +14 -8
- data/lib/mtk/patterns/cycle.rb +18 -0
- data/lib/mtk/patterns/for_each.rb +71 -0
- data/lib/mtk/patterns/function.rb +39 -0
- data/lib/mtk/{pattern → patterns}/lines.rb +11 -17
- data/lib/mtk/{pattern → patterns}/palindrome.rb +11 -8
- data/lib/mtk/patterns/pattern.rb +171 -0
- data/lib/mtk/patterns/sequence.rb +20 -0
- data/lib/mtk/pitch.rb +7 -6
- data/lib/mtk/pitch_class.rb +124 -46
- data/lib/mtk/pitch_class_set.rb +58 -35
- data/lib/mtk/sequencers/event_builder.rb +131 -0
- data/lib/mtk/sequencers/legato_sequencer.rb +24 -0
- data/lib/mtk/sequencers/rhythmic_sequencer.rb +28 -0
- data/lib/mtk/{sequencer/abstract_sequencer.rb → sequencers/sequencer.rb} +37 -11
- data/lib/mtk/{sequencer → sequencers}/step_sequencer.rb +4 -4
- data/lib/mtk/timeline.rb +39 -22
- data/lib/mtk/variable.rb +32 -0
- data/spec/mtk/chord_spec.rb +83 -0
- data/spec/mtk/{_constants → constants}/durations_spec.rb +12 -41
- data/spec/mtk/{_constants → constants}/intensities_spec.rb +13 -37
- data/spec/mtk/{_constants → constants}/intervals_spec.rb +14 -32
- data/spec/mtk/{_constants → constants}/pitch_classes_spec.rb +8 -4
- data/spec/mtk/{_constants → constants}/pitches_spec.rb +5 -1
- data/spec/mtk/duration_spec.rb +372 -0
- data/spec/mtk/events/event_spec.rb +234 -0
- data/spec/mtk/events/note_spec.rb +174 -0
- data/spec/mtk/events/parameter_spec.rb +220 -0
- data/spec/mtk/{helper → helpers}/collection_spec.rb +86 -3
- data/spec/mtk/{helper → helpers}/pseudo_constants_spec.rb +2 -2
- data/spec/mtk/intensity_spec.rb +289 -0
- data/spec/mtk/interval_spec.rb +265 -0
- data/spec/mtk/lang/parser_spec.rb +597 -0
- data/spec/mtk/melody_spec.rb +223 -0
- data/spec/mtk/midi/file_spec.rb +16 -16
- data/spec/mtk/midi/jsound_input_spec.rb +11 -0
- data/spec/mtk/midi/jsound_output_spec.rb +11 -0
- data/spec/mtk/midi/output_spec.rb +102 -0
- data/spec/mtk/midi/unimidi_input_spec.rb +11 -0
- data/spec/mtk/midi/unimidi_output_spec.rb +11 -0
- data/spec/mtk/{_numeric_extensions_spec.rb → numeric_extensions_spec.rb} +1 -0
- data/spec/mtk/patterns/chain_spec.rb +110 -0
- data/spec/mtk/{pattern → patterns}/choice_spec.rb +20 -30
- data/spec/mtk/{pattern → patterns}/cycle_spec.rb +25 -35
- data/spec/mtk/patterns/for_each_spec.rb +136 -0
- data/spec/mtk/{pattern → patterns}/function_spec.rb +17 -30
- data/spec/mtk/{pattern → patterns}/lines_spec.rb +11 -27
- data/spec/mtk/{pattern → patterns}/palindrome_spec.rb +13 -29
- data/spec/mtk/patterns/pattern_spec.rb +132 -0
- data/spec/mtk/patterns/sequence_spec.rb +203 -0
- data/spec/mtk/pitch_class_set_spec.rb +23 -21
- data/spec/mtk/pitch_class_spec.rb +151 -39
- data/spec/mtk/pitch_spec.rb +22 -1
- data/spec/mtk/sequencers/event_builder_spec.rb +245 -0
- data/spec/mtk/sequencers/legato_sequencer_spec.rb +45 -0
- data/spec/mtk/sequencers/rhythmic_sequencer_spec.rb +84 -0
- data/spec/mtk/sequencers/sequencer_spec.rb +215 -0
- data/spec/mtk/{sequencer → sequencers}/step_sequencer_spec.rb +35 -13
- data/spec/mtk/timeline_spec.rb +109 -16
- data/spec/mtk/variable_spec.rb +52 -0
- data/spec/spec_coverage.rb +2 -0
- data/spec/spec_helper.rb +3 -0
- metadata +188 -91
- data/lib/mtk/_constants/durations.rb +0 -80
- data/lib/mtk/_constants/intensities.rb +0 -81
- data/lib/mtk/_constants/intervals.rb +0 -85
- data/lib/mtk/_constants/pitch_classes.rb +0 -35
- data/lib/mtk/_constants/pitches.rb +0 -49
- data/lib/mtk/event.rb +0 -70
- data/lib/mtk/helper/collection.rb +0 -114
- data/lib/mtk/helper/event_builder.rb +0 -85
- data/lib/mtk/helper/pseudo_constants.rb +0 -26
- data/lib/mtk/lang/grammar.rb +0 -17
- data/lib/mtk/note.rb +0 -63
- data/lib/mtk/pattern/abstract_pattern.rb +0 -132
- data/lib/mtk/pattern/cycle.rb +0 -51
- data/lib/mtk/pattern/enumerator.rb +0 -26
- data/lib/mtk/pattern/function.rb +0 -46
- data/lib/mtk/pattern/sequence.rb +0 -30
- data/lib/mtk/pitch_set.rb +0 -84
- data/lib/mtk/sequencer/rhythmic_sequencer.rb +0 -29
- data/lib/mtk/transform/invertible.rb +0 -15
- data/lib/mtk/transform/mappable.rb +0 -18
- data/lib/mtk/transform/set_theory_operations.rb +0 -34
- data/lib/mtk/transform/transposable.rb +0 -14
- data/spec/mtk/event_spec.rb +0 -139
- data/spec/mtk/helper/event_builder_spec.rb +0 -92
- data/spec/mtk/lang/grammar_spec.rb +0 -100
- data/spec/mtk/note_spec.rb +0 -115
- data/spec/mtk/pattern/abstract_pattern_spec.rb +0 -45
- data/spec/mtk/pattern/note_cycle_spec.rb.bak +0 -116
- data/spec/mtk/pattern/pitch_cycle_spec.rb.bak +0 -47
- data/spec/mtk/pattern/pitch_sequence_spec.rb.bak +0 -37
- data/spec/mtk/pattern/sequence_spec.rb +0 -151
- data/spec/mtk/pitch_set_spec.rb +0 -198
- data/spec/mtk/sequencer/abstract_sequencer_spec.rb +0 -159
- data/spec/mtk/sequencer/rhythmic_sequencer_spec.rb +0 -49
data/.yardopts
CHANGED
@@ -0,0 +1,114 @@
|
|
1
|
+
MTK
|
2
|
+
===
|
3
|
+
|
4
|
+
[![Build Status](https://secure.travis-ci.org/adamjmurray/mtk.png)](http://travis-ci.org/adamjmurray/mtk)
|
5
|
+
|
6
|
+
Music Tool Kit for Ruby
|
7
|
+
-----------------------
|
8
|
+
|
9
|
+
Classes for modeling music with a focus on simplicity. Support for reading/writing MIDI files and realtime MIDI.
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
Getting Started
|
14
|
+
---------------
|
15
|
+
|
16
|
+
gem install mtk
|
17
|
+
|
18
|
+
or download the source from here and add mtk/lib to your $LOAD_PATH. Then...
|
19
|
+
|
20
|
+
require 'mtk'
|
21
|
+
|
22
|
+
Some examples are available in the examples folder (more coming soon).
|
23
|
+
The specs provide a lot of details of usage...
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
Goals
|
28
|
+
-----
|
29
|
+
|
30
|
+
* Build musical generators to assist with composing music
|
31
|
+
* Re-implement Cosy (http://compusition.com/web/software/cosy) using these models as the "backend"
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
Status
|
36
|
+
------
|
37
|
+
|
38
|
+
Alpha phase, API subject to change. Feedback welcome!
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
Requirements
|
43
|
+
------------
|
44
|
+
|
45
|
+
### Ruby Version
|
46
|
+
|
47
|
+
Ruby 1.9+ or JRuby 1.6+
|
48
|
+
|
49
|
+
|
50
|
+
### Dependencies
|
51
|
+
|
52
|
+
MTK's core features should not depend on anything outside of the Ruby standard library.
|
53
|
+
|
54
|
+
|
55
|
+
MTK's optional features typically require gems. Currently the following gems are required:
|
56
|
+
|
57
|
+
* MIDI file I/O requires the __midilib__ gem
|
58
|
+
|
59
|
+
* realtime MIDI I/O with (MRI/YARV) Ruby requires the __unimidi__ and __gamelan__ gems
|
60
|
+
|
61
|
+
* realtime MIDI I/O with JRuby require the __jsound__ and __gamelan__ gems
|
62
|
+
|
63
|
+
* The custom MTK syntax (work in progress) requires the __citrus__ gem
|
64
|
+
|
65
|
+
|
66
|
+
Development requires the gems for optional features, plus the following:
|
67
|
+
|
68
|
+
* rake
|
69
|
+
* rspec (tests)
|
70
|
+
* yard (docs)
|
71
|
+
|
72
|
+
You shouldn't need to worry about the dependencies too much. A Gemfile is provided to sort this out for you:
|
73
|
+
|
74
|
+
gem install bundler
|
75
|
+
bundle install
|
76
|
+
|
77
|
+
[rvm](https://rvm.beginrescueend.com/) is required for cross version testing (see Development Notes below)
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
Documentation
|
82
|
+
-------------
|
83
|
+
|
84
|
+
Gem 0.0.2: http://rdoc.info/gems/mtk/0.0.2/frames (TODO: update this)
|
85
|
+
|
86
|
+
Latest for source: http://rubydoc.info/github/adamjmurray/mtk/master/frames
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
Development Notes
|
91
|
+
-----------------
|
92
|
+
|
93
|
+
### Run Tests ###
|
94
|
+
|
95
|
+
Test with current version of Ruby:
|
96
|
+
|
97
|
+
bundle exec rake test
|
98
|
+
|
99
|
+
Test with all supported versions of Ruby (requires [rvm](https://rvm.beginrescueend.com/), YARV 1.9.3, and JRuby 1.6.7):
|
100
|
+
|
101
|
+
bundle exec rake test:all
|
102
|
+
|
103
|
+
The test:all test must pass for a pull request to be accepted or for a release of the mtk gem.
|
104
|
+
|
105
|
+
|
106
|
+
### Generate Docs ###
|
107
|
+
|
108
|
+
bundle exec rake doc
|
109
|
+
open doc/frames.html
|
110
|
+
|
111
|
+
or, to automatically refresh the documentation as you work:
|
112
|
+
|
113
|
+
bundle exec yard server -r
|
114
|
+
open http://localhost:8808
|
data/INTRO.md
CHANGED
@@ -6,21 +6,19 @@ Core Concepts
|
|
6
6
|
### Core data types
|
7
7
|
|
8
8
|
These model the basic properties of musical events:
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
9
|
+
* PitchClass
|
10
|
+
* Pitch
|
11
|
+
* Duration
|
12
|
+
* Intensity
|
13
13
|
|
14
|
-
|
14
|
+
These types are all immutable. This helps avoid confusing bugs.
|
15
15
|
Mostly you don't need to worry about this. Just remember when you call methods that change the value, like #invert,
|
16
16
|
it does not change the value in-place. For example:
|
17
17
|
|
18
18
|
p = PitchClass[G]
|
19
19
|
p = p.invert(E) # because p.invert(E) does not change p
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
Intensity is intended to range from 0.0 (minimum intensity) to 1.0 (maximum intensity).
|
21
|
+
Intensity values are intended to range from 0.0 (minimum intensity) to 1.0 (maximum intensity).
|
24
22
|
|
25
23
|
A Duration of 1 is one beat (usually a quarter note, depending on the meter). By convention, negative durations
|
26
24
|
indicate a rest that lasts for the absolute value duration.
|
@@ -70,4 +68,62 @@ Future?
|
|
70
68
|
Convert patterns into timelines
|
71
69
|
|
72
70
|
|
71
|
+
<br/>
|
72
|
+
### Syntax
|
73
|
+
|
74
|
+
Basic Tenants
|
75
|
+
|
76
|
+
* Minimal syntax: less typing means more music!
|
77
|
+
* Be case-insensitive to avoid typos caused by lower vs upper case (there's one notable exception for intervals: m2 vs M2)
|
78
|
+
* pitch and duration are the most important properties
|
79
|
+
* pitch is more important than rhythm
|
80
|
+
|
81
|
+
Because pitch class and duration are such important properties, and we want to minimize typing, we represent these with 1 letter.
|
82
|
+
|
83
|
+
**Diatonic Pitch Class: c d e f g a b**
|
84
|
+
|
85
|
+
**Chromatic Pitch Class (Sharp/Flat): c c# db d d# eb e e# fb f f# gb g g# ab a a# bb b b#**
|
86
|
+
|
87
|
+
Double-sharps (c##) and double-flats (dbb) are also allowed. You may prefer Bb to bb, etc
|
88
|
+
|
89
|
+
**Pitch (Pitch Class + Octave Number): c4 db5 c-1 g9**
|
90
|
+
|
91
|
+
c-1 (that's octave number: negative 1) is the lowest note. g9 is the highest.
|
92
|
+
|
93
|
+
**Duration: w h q i s r x (that's: whole note, half, quarter, eighth, sixteenth, thirty-second, sixty-fourth)**
|
94
|
+
|
95
|
+
Why "i", "r", and "x"? We're trying to keep these one letter. 'e', 'r', and 's' were already used,
|
96
|
+
so we just move along the letters of the word until we find an unused letter.
|
97
|
+
|
98
|
+
For intensity, we'll try to use standard music notation, but 'f' conflicts, so we handle this the same way we did with durations:
|
99
|
+
|
100
|
+
**Intensity: ppp pp p mp mf o ff fff**
|
101
|
+
|
102
|
+
(You may find it helpful to think "loud" for "o")
|
103
|
+
|
104
|
+
|
105
|
+
TODO: keep documenting this...
|
106
|
+
|
107
|
+
|
108
|
+
Summary of single-letter assignments:
|
109
|
+
```
|
110
|
+
a -> pitch class a
|
111
|
+
b -> pitch class b, flat modifier on pitch class
|
112
|
+
c -> pitch class c
|
113
|
+
d -> pitch class d
|
114
|
+
e -> pitch class e
|
115
|
+
f -> pitch class f
|
116
|
+
|
117
|
+
h -> half note duration
|
118
|
+
i -> eighth note duration
|
119
|
+
|
120
|
+
o -> forte intensity
|
121
|
+
p -> piano intensity
|
122
|
+
q -> quarter note duration
|
123
|
+
r -> thirty-second note duration
|
124
|
+
s -> sixteenth note duration
|
125
|
+
t -> triplet modifier on durations
|
73
126
|
|
127
|
+
w -> whole note duration
|
128
|
+
x -> sixty-fourth note duration
|
129
|
+
```
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,127 +1,56 @@
|
|
1
|
-
MTK
|
1
|
+
MTK: a Music Tool Kit for Ruby
|
2
2
|
===
|
3
3
|
|
4
|
-
|
5
|
-
----------------------
|
4
|
+
MTK is a Ruby library and custom [domain-specific language](https://en.wikipedia.org/wiki/Domain-specific_language) (DSL) for generating musical material.
|
6
5
|
|
7
|
-
|
6
|
+
MTK is flexible: You may use the custom music-generating language without writing any Ruby code, or you may avoid the custom language
|
7
|
+
and only program in Ruby, or anywhere in between.
|
8
8
|
|
9
9
|
|
10
|
+
Features
|
11
|
+
--------
|
12
|
+
* A minimalist syntax (DSL) for generating musical patterns
|
13
|
+
* Read and write MIDI files
|
14
|
+
* Record and output realtime MIDI signals
|
15
|
+
* Sequence MIDI-compatible event streams
|
16
|
+
* Manipulate musical objects like pitch, duration, and intensity
|
17
|
+
* Generate deterministic and non-deterministic music via flexible patterns such as looping sequences and random choices
|
10
18
|
|
11
19
|
Getting Started
|
12
20
|
---------------
|
13
21
|
|
14
|
-
|
22
|
+
# NOTE: This project is not ready yet, these instructions will not work! Please check back in a little while once I have mtk version 0.0.3 released to rubygems.org.
|
15
23
|
|
16
|
-
|
24
|
+
MTK works with Ruby 1.9, Ruby 2.0, and JRuby
|
17
25
|
|
18
|
-
|
26
|
+
0. Install
|
19
27
|
|
20
|
-
|
21
|
-
The specs provide a lot of details of usage...
|
28
|
+
gem install mtk
|
22
29
|
|
30
|
+
or if using JRuby:
|
23
31
|
|
32
|
+
jgem install mtk
|
24
33
|
|
25
|
-
|
26
|
-
-----
|
34
|
+
0. Learn the command-line interface:
|
27
35
|
|
28
|
-
|
29
|
-
* Re-implement Cosy (http://compusition.com/web/software/cosy) using these models as the "backend"
|
36
|
+
mtk --help
|
30
37
|
|
38
|
+
0. Learn the MTK syntax:
|
31
39
|
|
40
|
+
mtk --tutorial
|
32
41
|
|
33
|
-
|
34
|
-
------
|
42
|
+
0. Check out examples: ... TODO
|
35
43
|
|
36
|
-
|
44
|
+
0. Read the [MTK Ruby library documentation](http://rubydoc.info/github/adamjmurray/mtk/master/frames) (TODO: update this 0.0.3 gem version when ready)
|
37
45
|
|
46
|
+
TODO: explain how to hear output on different platforms (maybe in the mtk command line help?)
|
38
47
|
|
39
48
|
|
40
|
-
|
41
|
-
|
49
|
+
About this project
|
50
|
+
------------------
|
51
|
+
This project is developed by [Adam Murray (github.com/adamjmurray)](http://github.com/adamjmurray).
|
42
52
|
|
43
|
-
|
53
|
+
It is a free and open source project licensed under [a permissive BSD-style license](https://raw.github.com/adamjmurray/mtk/master/LICENSE.txt).
|
54
|
+
I simply ask for credit by including my copyright in derivative works.
|
44
55
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
### Dependencies
|
49
|
-
|
50
|
-
MTK's core features should not depend on anything outside of the Ruby standard library.
|
51
|
-
|
52
|
-
MTK's optional features typically require gems. Currently the following gems are required:
|
53
|
-
|
54
|
-
* midilib: required by MTK::MIDI::File for file I/O
|
55
|
-
|
56
|
-
* jsound and gamelan: required by MTK::MIDI::JSoundInput/Output (also requires JRuby)
|
57
|
-
|
58
|
-
Development requires all the gems for optional features, plus the following development tools:
|
59
|
-
|
60
|
-
* rake
|
61
|
-
* rspec (tests)
|
62
|
-
* yard (docs)
|
63
|
-
* yard-rspec (docs)
|
64
|
-
* rdiscount (docs)
|
65
|
-
|
66
|
-
[rvm](https://rvm.beginrescueend.com/) is recommended for cross version testing (see Development Notes below)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
Documentation
|
71
|
-
-------------
|
72
|
-
|
73
|
-
Gem: http://rdoc.info/gems/mtk/0.0.2/frames
|
74
|
-
|
75
|
-
Latest for source: http://rubydoc.info/github/adamjmurray/mtk/master/frames
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
Development Notes
|
80
|
-
-----------------
|
81
|
-
|
82
|
-
### Run Tests ###
|
83
|
-
|
84
|
-
Test with current version of Ruby:
|
85
|
-
|
86
|
-
rake spec
|
87
|
-
|
88
|
-
Test with all supported versions of Ruby (requires [rvm](https://rvm.beginrescueend.com/), MRI 1.8.7, YARV 1.9.2, JRuby 1.5.6, and JRuby 1.6.2):
|
89
|
-
|
90
|
-
rake spec:xversion
|
91
|
-
|
92
|
-
The spec:xversion test must pass for a pull request to be accepted or for a release of the mtk gem.
|
93
|
-
|
94
|
-
|
95
|
-
### Generate Docs ###
|
96
|
-
|
97
|
-
yard
|
98
|
-
open doc/frames.html
|
99
|
-
|
100
|
-
or, to automatically refresh the documentation as you work:
|
101
|
-
|
102
|
-
yard server -r
|
103
|
-
open http://localhost:8808
|
104
|
-
|
105
|
-
|
106
|
-
### Project Roadmap ###
|
107
|
-
|
108
|
-
https://www.pivotaltracker.com/projects/295419
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
Changelog
|
113
|
-
---------
|
114
|
-
|
115
|
-
* July 8, 2011: version 0.0.2
|
116
|
-
- Added a Sequencer module to build Timelines out of Patterns
|
117
|
-
- Overhauled Pattern module: removed type-specific patterns, and added the Palindrome, Lines, and Function patterns
|
118
|
-
- Patterns can now be nested (they can contain other Patterns)
|
119
|
-
- Patterns can now be typed, to distinguish Numeric Patterns as :pitch (i.e. intervals), :intensity, :duration, or :rhythm patterns
|
120
|
-
- Removed auto-sorting behavior from PitchClassSet to support 12-tone rows and atonal composition techniques
|
121
|
-
- Added #quantize and #shift features to Timeline
|
122
|
-
- Got rid of Chord class, model Chords with PitchSets or Arrays of Notes instead
|
123
|
-
- Added support for realtime MIDI I/O with JSound (JRuby only)
|
124
|
-
- various cleanup and reorganization
|
125
|
-
|
126
|
-
* June 8, 2011: version 0.0.1
|
127
|
-
- First gem release.
|
56
|
+
You can learn more about the development of this project at the [development notes page](https://github.com/adamjmurray/mtk/blob/master/DEVELOPMENT_NOTES.md).
|
data/Rakefile
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require 'rspec/core/rake_task'
|
2
2
|
require 'rake/clean'
|
3
|
-
require 'yard'
|
4
3
|
|
5
|
-
|
4
|
+
MTK_VERSION = '0.0.3'
|
6
5
|
|
7
|
-
|
6
|
+
SUPPORTED_RUBIES = %w[ 1.9.3 2.0 jruby-1.7.4 ]
|
7
|
+
ENV['JRUBY_OPTS'] = '--1.9'
|
8
|
+
|
9
|
+
task :default => :test
|
10
|
+
|
11
|
+
CLEAN.include('html','doc','coverage.data','coverage', '*.gem') # clean and clobber do the same thing for now
|
8
12
|
|
9
13
|
desc "Run RSpec tests with full output"
|
10
|
-
RSpec::Core::RakeTask.new do |spec|
|
14
|
+
RSpec::Core::RakeTask.new('test') do |spec|
|
11
15
|
spec.rspec_opts = ["--color", "--format", "nested"]
|
12
16
|
if ARGV[1]
|
13
17
|
# only run specs with filenames starting with the command line argument
|
@@ -15,29 +19,63 @@ RSpec::Core::RakeTask.new do |spec|
|
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
18
|
-
|
22
|
+
task :spec => :test
|
23
|
+
|
24
|
+
|
25
|
+
namespace :gem do
|
26
|
+
desc "Install gems for supported versions of Ruby: #{SUPPORTED_RUBIES.join ', '}"
|
27
|
+
task :install_dependencies do
|
28
|
+
fail unless system("rvm #{SUPPORTED_RUBIES.join ','} do bundle install")
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Build the gemspec for C-Ruby and JRuby"
|
32
|
+
task :build do
|
33
|
+
ENV['MTK_VERSION'] = MTK_VERSION
|
34
|
+
ENV['MTK_BUILD_FOR_JRUBY'] = 'true'
|
35
|
+
`gem build ./mtk.gemspec`
|
36
|
+
`mv mtk-#{MTK_VERSION}.gem mtk-#{MTK_VERSION}-jruby.gem`
|
37
|
+
puts "Built mtk-#{MTK_VERSION}-jruby.gem"
|
19
38
|
|
20
|
-
|
39
|
+
ENV['MTK_BUILD_FOR_JRUBY'] = nil
|
40
|
+
`gem build ./mtk.gemspec`
|
41
|
+
puts "Built mtk-#{MTK_VERSION}.gem"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
namespace :test do
|
47
|
+
desc "Run RSpec tests with summary output and fast failure"
|
21
48
|
RSpec::Core::RakeTask.new(:fast) do |spec|
|
22
49
|
spec.rspec_opts = ["--color", "--fail-fast"]
|
23
50
|
end
|
24
51
|
|
25
|
-
desc "Run
|
26
|
-
|
27
|
-
|
52
|
+
desc "Run RSpec tests and generate a coverage report"
|
53
|
+
if RUBY_PLATFORM == "java"
|
54
|
+
task :cov do |t|
|
55
|
+
fail "#{t} task is not compatible with JRuby. Use Ruby 1.9 instead."
|
56
|
+
end
|
57
|
+
else
|
58
|
+
RSpec::Core::RakeTask.new(:cov) do |spec|
|
59
|
+
spec.rspec_opts = ["--color", "-r", "#{File.dirname __FILE__}/spec/spec_coverage.rb"]
|
60
|
+
end
|
28
61
|
end
|
29
62
|
|
63
|
+
desc "Profile RSpec tests and report 10 slowest"
|
64
|
+
RSpec::Core::RakeTask.new(:prof) do |spec|
|
65
|
+
spec.rspec_opts = ["--color", "-p"]
|
66
|
+
end
|
67
|
+
|
68
|
+
desc "Run RSpec tests on all supported versions of Ruby: #{SUPPORTED_RUBIES.join ', '}"
|
69
|
+
task :all do
|
70
|
+
fail unless system("rvm #{SUPPORTED_RUBIES.join ','} do bundle exec rake -f #{__FILE__} test:fast")
|
71
|
+
end
|
30
72
|
end
|
31
73
|
|
32
74
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
# prefer my local patched copy which can handle my rspec conventions better...
|
38
|
-
yard.options.concat ['-e' '../yard-spec-plugin/lib/yard-rspec.rb']
|
39
|
-
else
|
40
|
-
# use the gem
|
41
|
-
yard.options.concat ['-e' 'yard-rspec']
|
75
|
+
begin
|
76
|
+
require 'yard'
|
77
|
+
YARD::Rake::YardocTask.new(:doc) do |yard|
|
78
|
+
yard.files = ['lib/**/*.rb']
|
42
79
|
end
|
80
|
+
rescue Exception # yard is optional, so don't cause rake to fail if it's missing
|
43
81
|
end
|