micromidi 0.0.9 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b24c6172a05c94a000abde89ec6a4a4ad235171b
4
+ data.tar.gz: 434f16cdc62a248d1647b09f16d069ac9cdf9179
5
+ SHA512:
6
+ metadata.gz: 7d843f8e9b610312ed6941f7134eb1d791a7f92c422a9a90871f1733b55d7e433fb3c54790924a2a05b459d6458d637be3b67bc2678b18b4400590671449c5aa
7
+ data.tar.gz: 4e6d36412362eb10c53dd68779594e1a1d0e99dd948d081acc3bea7f7c6485ed75da0eda9b71f31df59d5db1ca38944e7587a867b2f0106335bc55122c6b622a
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2011 Ari Russo
1
+ Copyright 2011-2014 Ari Russo
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software
10
10
  distributed under the License is distributed on an "AS IS" BASIS,
11
11
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  See the License for the specific language governing permissions and
13
- limitations under the License.
13
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # MicroMIDI
2
+
3
+ A Ruby DSL for MIDI
4
+
5
+ ![micromidi](http://img855.imageshack.us/img855/9804/midi.png)
6
+
7
+ ## Features
8
+
9
+ * Cross-platform compatible using MRI or JRuby.
10
+ * Simplified MIDI and Sysex message output
11
+ * MIDI Thru, processing and custom input events
12
+ * Optional shorthand for [live coding](http://en.wikipedia.org/wiki/Live_coding)
13
+
14
+ ## Installation
15
+
16
+ `gem install micromidi`
17
+
18
+ or using Bundler, add this to your Gemfile
19
+
20
+ `gem "micromidi"`
21
+
22
+ ## Usage
23
+
24
+ Here's a quick example that plays some arpeggios
25
+
26
+ ```ruby
27
+ require "midi"
28
+
29
+ # prompt the user to select an input and output
30
+
31
+ @input = UniMIDI::Input.gets
32
+ @output = UniMIDI::Output.gets
33
+
34
+ MIDI.using(@output) do
35
+
36
+ 5.times do |oct|
37
+ octave oct
38
+ %w{C E G B}.each { |n| play n 0.5 }
39
+ end
40
+
41
+ end
42
+ ```
43
+
44
+ This next example filters outs notes if their octave is between 1 and 3. All other messages are sent thru.
45
+
46
+ Output is also printed to the console by passing `$stdout` as though it's a MIDI device
47
+
48
+ ```ruby
49
+ MIDI.using(@input, @output, $stdout) do
50
+
51
+ thru_except :note { |msg| only(msg, :octave, (1..3)) }
52
+
53
+ join
54
+
55
+ end
56
+ ```
57
+
58
+ This is the same example redone using shorthand aliases
59
+
60
+ ```ruby
61
+ M(@input, @output) do
62
+
63
+ te :n { |m| only(m, :oct, (1..3)) }
64
+
65
+ j
66
+
67
+ end
68
+ ```
69
+
70
+ Finally, here is an example that maps some MIDI Control Change messages to SysEx
71
+
72
+ ```ruby
73
+ MIDI.using(@input, @output) do
74
+
75
+ *@the_map =
76
+ [0x40, 0x7F, 0x00],
77
+ [0x41, 0x7F, 0x00],
78
+ [0x42, 0x7F, 0x00]
79
+
80
+ node :roland, :model_id => 0x42, :device_id => 0x10
81
+
82
+ receive :cc do |message|
83
+
84
+ command @the_map[message.index - 1], message.value
85
+
86
+ end
87
+
88
+ end
89
+ ```
90
+
91
+ Here are a few posts explaining each of the concepts used here in greater detail:
92
+
93
+ * [Output](http://tx81z.blogspot.com/2011/08/micromidi-midi-messages-and-output.html)
94
+ * [MIDI Thru and Processing](http://tx81z.blogspot.com/2011/08/micromidi-midi-thru-and-midi-processing.html)
95
+ * [Binding Custom Input Events](http://tx81z.blogspot.com/2011/08/micromidi-custom-events.html)
96
+ * [Shorthand](http://tx81z.blogspot.com/2011/08/micromidi-shorthand.html)
97
+ * [Sysex](http://tx81z.blogspot.com/2011/09/generating-sysex-messages-with.html)
98
+ * [Etc](http://tx81z.blogspot.com/2011/09/more-micromidi-tricks.html)
99
+
100
+ ## Documentation
101
+
102
+ * [rdoc](http://rubydoc.info/github/arirusso/micromidi)
103
+
104
+ ## Author
105
+
106
+ * [Ari Russo](http://github.com/arirusso) <ari.russo at gmail.com>
107
+
108
+ ## License
109
+
110
+ Apache 2.0, See the file LICENSE
111
+
112
+ Copyright (c) 2011-2014 Ari Russo
@@ -1,6 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
-
4
1
  module MicroMIDI
5
2
 
6
3
  class Context
@@ -62,4 +59,4 @@ module MicroMIDI
62
59
  end
63
60
 
64
61
  end
65
- end
62
+ end
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
1
  module MicroMIDI
4
2
 
5
3
  module Instructions
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
1
  module MicroMIDI
4
2
 
5
3
  module Instructions
@@ -111,4 +109,4 @@ module MicroMIDI
111
109
 
112
110
  end
113
111
 
114
- end
112
+ end
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
1
  module MicroMIDI
4
2
 
5
3
  module Instructions
@@ -97,4 +95,4 @@ module MicroMIDI
97
95
 
98
96
  end
99
97
 
100
- end
98
+ end
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
1
  module MicroMIDI
4
2
 
5
3
  module Instructions
@@ -25,4 +23,4 @@ module MicroMIDI
25
23
 
26
24
  end
27
25
 
28
- end
26
+ end
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
1
  module MicroMIDI
4
2
 
5
3
  module Instructions
@@ -54,4 +52,4 @@ module MicroMIDI
54
52
 
55
53
  end
56
54
 
57
- end
55
+ end
@@ -1,6 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
-
4
1
  module MicroMIDI
5
2
 
6
3
  alias l loop
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
1
  module MicroMIDI
4
2
 
5
3
  module Instructions
@@ -56,4 +54,4 @@ module MicroMIDI
56
54
 
57
55
  end
58
56
 
59
- end
57
+ end
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
1
  module MicroMIDI
4
2
 
5
3
  module Instructions
@@ -40,4 +38,4 @@ module MicroMIDI
40
38
 
41
39
  end
42
40
 
43
- end
41
+ end
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
- #
3
1
  module MicroMIDI
4
2
 
5
3
  class State
@@ -76,4 +74,4 @@ module MicroMIDI
76
74
 
77
75
  end
78
76
 
79
- end
77
+ end
data/lib/micromidi.rb CHANGED
@@ -1,22 +1,21 @@
1
- #!/usr/bin/env ruby
2
1
  #
3
2
  # micromidi
3
+ #
4
4
  # A Ruby DSL for MIDI
5
5
  #
6
- # (c)2011 Ari Russo
6
+ # (c)2011-2014 Ari Russo
7
7
  # licensed under the Apache 2.0 License
8
8
  #
9
9
 
10
10
  # libs
11
11
  require "forwardable"
12
-
13
12
  require "midi-eye"
14
13
  require "midi-message"
15
14
  require "unimidi"
16
15
 
17
16
  module MicroMIDI
18
17
 
19
- VERSION = "0.0.9"
18
+ VERSION = "0.1.1"
20
19
 
21
20
  module Instructions
22
21
  end
@@ -65,5 +64,5 @@ require "micromidi/instructions/output"
65
64
  require "micromidi/instructions/sticky"
66
65
  require "micromidi/instructions/sysex"
67
66
 
68
- # re-open
69
- require "micromidi/instructions/shorthand"
67
+ # extension
68
+ require "micromidi/instructions/shorthand"
data/lib/midi.rb CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  #
3
2
  # micromidi
4
3
  # A Ruby DSL for MIDI
@@ -7,9 +6,10 @@
7
6
  # licensed under the Apache 2.0 License
8
7
  #
9
8
 
10
- # the purpose of this file is just to allow both
9
+ # The purpose of this file is just to allow both:
10
+ #
11
11
  # <em>require "micromidi"</em>
12
12
  # and
13
13
  # <em>require "midi"</em>
14
14
 
15
- require 'micromidi'
15
+ require "micromidi"
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class CompositeTest < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class ContextTest < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class EffectTest < Test::Unit::TestCase
6
4
 
data/test/helper.rb CHANGED
@@ -1,10 +1,8 @@
1
- #!/usr/bin/env ruby
2
-
3
1
  dir = File.dirname(File.expand_path(__FILE__))
4
- $LOAD_PATH.unshift dir + '/../lib'
2
+ $LOAD_PATH.unshift dir + "/../lib"
5
3
 
6
- require 'test/unit'
7
- require 'midi'
4
+ require "test/unit"
5
+ require "midi"
8
6
 
9
7
  module TestHelper
10
8
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class InputTest < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class MessageTest < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class OutputTest < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class StateTest < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class StickyTest < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'helper'
1
+ require "helper"
4
2
 
5
3
  class SysexTest < Test::Unit::TestCase
6
4
 
metadata CHANGED
@@ -1,49 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micromidi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ari Russo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-11-08 00:00:00.000000000Z
11
+ date: 2014-08-31 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: midi-eye
16
- requirement: &70167309782300 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ - - ">="
20
21
  - !ruby/object:Gem::Version
21
22
  version: 0.1.3
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *70167309782300
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.1.3
25
33
  - !ruby/object:Gem::Dependency
26
34
  name: midi-message
27
- requirement: &70167309781280 !ruby/object:Gem::Requirement
28
- none: false
35
+ requirement: !ruby/object:Gem::Requirement
29
36
  requirements:
30
- - - ! '>='
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.2'
40
+ - - ">="
31
41
  - !ruby/object:Gem::Version
32
42
  version: 0.2.2
33
43
  type: :runtime
34
44
  prerelease: false
35
- version_requirements: *70167309781280
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.2'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.2.2
36
53
  - !ruby/object:Gem::Dependency
37
54
  name: unimidi
38
- requirement: &70167309779980 !ruby/object:Gem::Requirement
39
- none: false
55
+ requirement: !ruby/object:Gem::Requirement
40
56
  requirements:
41
- - - ! '>='
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.2'
60
+ - - ">="
42
61
  - !ruby/object:Gem::Version
43
62
  version: 0.2.3
44
63
  type: :runtime
45
64
  prerelease: false
46
- version_requirements: *70167309779980
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.2'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 0.2.3
47
73
  description: A Ruby DSL for MIDI
48
74
  email:
49
75
  - ari.russo@gmail.com
@@ -51,6 +77,9 @@ executables: []
51
77
  extensions: []
52
78
  extra_rdoc_files: []
53
79
  files:
80
+ - LICENSE
81
+ - README.md
82
+ - lib/micromidi.rb
54
83
  - lib/micromidi/context.rb
55
84
  - lib/micromidi/instructions/composite.rb
56
85
  - lib/micromidi/instructions/input.rb
@@ -61,43 +90,39 @@ files:
61
90
  - lib/micromidi/instructions/sticky.rb
62
91
  - lib/micromidi/instructions/sysex.rb
63
92
  - lib/micromidi/state.rb
64
- - lib/micromidi.rb
65
93
  - lib/midi.rb
94
+ - test/composite_test.rb
95
+ - test/context_test.rb
96
+ - test/effect_test.rb
66
97
  - test/helper.rb
67
- - test/test_composite.rb
68
- - test/test_context.rb
69
- - test/test_effect.rb
70
- - test/test_input.rb
71
- - test/test_message.rb
72
- - test/test_output.rb
73
- - test/test_state.rb
74
- - test/test_sticky.rb
75
- - test/test_sysex.rb
76
- - LICENSE
77
- - README.rdoc
78
- - TODO
98
+ - test/input_test.rb
99
+ - test/message_test.rb
100
+ - test/output_test.rb
101
+ - test/state_test.rb
102
+ - test/sticky_test.rb
103
+ - test/sysex_test.rb
79
104
  homepage: http://github.com/arirusso/micromidi
80
- licenses: []
105
+ licenses:
106
+ - Apache 2.0
107
+ metadata: {}
81
108
  post_install_message:
82
109
  rdoc_options: []
83
110
  require_paths:
84
111
  - lib
85
112
  required_ruby_version: !ruby/object:Gem::Requirement
86
- none: false
87
113
  requirements:
88
- - - ! '>='
114
+ - - ">="
89
115
  - !ruby/object:Gem::Version
90
116
  version: '0'
91
117
  required_rubygems_version: !ruby/object:Gem::Requirement
92
- none: false
93
118
  requirements:
94
- - - ! '>='
119
+ - - ">="
95
120
  - !ruby/object:Gem::Version
96
121
  version: 1.3.6
97
122
  requirements: []
98
123
  rubyforge_project: micromidi
99
- rubygems_version: 1.8.6
124
+ rubygems_version: 2.2.2
100
125
  signing_key:
101
- specification_version: 3
126
+ specification_version: 4
102
127
  summary: A Ruby DSL for MIDI
103
128
  test_files: []
data/README.rdoc DELETED
@@ -1,104 +0,0 @@
1
- = micromidi
2
-
3
- A Ruby DSL for MIDI
4
-
5
- {pic}[http://img855.imageshack.us/img855/9804/midi.png]
6
-
7
- == Features
8
-
9
- * Cross-platform compatible using MRI or JRuby.
10
- * Simplified MIDI and Sysex message output
11
- * MIDI Thru, processing and custom input events
12
- * Optional shorthand for {live coding}[http://en.wikipedia.org/wiki/Live_coding]
13
-
14
- == Installation
15
-
16
- gem install micromidi
17
-
18
- == Requirements
19
-
20
- Ruby 1.9.2+ or JRuby in 1.9 mode
21
-
22
- Requires {midi-eye}[http://github.com/arirusso/midi-eye], {midi-message}[http://github.com/arirusso/midi-message] and {unimidi}[http://github.com/arirusso/unimidi]. These should install automatically with the gem.
23
-
24
- == Usage
25
-
26
- The following are basic examples that use {unimidi}[http://github.com/arirusso/unimidi] inputs and outputs. ({see an example here that explains selecting an output...}[http://github.com/arirusso/unimidi/blob/master/examples/select_a_device.rb])
27
-
28
- require "midi"
29
-
30
- @i = UniMIDI::Input.use(:first)
31
- @o = UniMIDI::Output.use(:first)
32
-
33
- This example plays some arpeggios
34
-
35
- MIDI.using($o) do
36
-
37
- 5.times do |oct|
38
- octave oct
39
- %w{C E G B}.each { |n| play n 0.5 }
40
- end
41
-
42
- end
43
-
44
- While running, this next example sends all input directly to the output except for notes; notes that are received are only sent to the output if their octave is between 1 and 3. Output is also printed to the console by passing in <em>$stdout</em>.
45
-
46
- MIDI.using(@i, @o, $stdout) do
47
-
48
- thru_except :note { |msg| only(msg, :octave, (1..3)) }
49
-
50
- join
51
-
52
- end
53
-
54
- This is the same example redone using shorthand aliases
55
-
56
- M(@i, @o) do
57
-
58
- te :n { |m| only(m, :oct, (1..3)) }
59
-
60
- j
61
-
62
- end
63
-
64
- Finally, here is an example that maps some MIDI Control Change messages to SysEx
65
-
66
- MIDI.using(@i, @o) do
67
-
68
- *@the_map =
69
- [0x40, 0x7F, 0x00],
70
- [0x41, 0x7F, 0x00],
71
- [0x42, 0x7F, 0x00]
72
-
73
- node :roland, :model_id => 0x42, :device_id => 0x10
74
-
75
- receive :cc do |message|
76
-
77
- command @the_map[message.index - 1], message.value
78
-
79
- end
80
-
81
- end
82
-
83
- I've written up a few posts explaining each of the concepts used here in greater detail:
84
-
85
- * {Output}[http://tx81z.blogspot.com/2011/08/micromidi-midi-messages-and-output.html]
86
- * {MIDI Thru and Processing}[http://tx81z.blogspot.com/2011/08/micromidi-midi-thru-and-midi-processing.html]
87
- * {Binding Custom Input Events}[http://tx81z.blogspot.com/2011/08/micromidi-custom-events.html]
88
- * {Shorthand}[http://tx81z.blogspot.com/2011/08/micromidi-shorthand.html]
89
- * {Sysex}[http://tx81z.blogspot.com/2011/09/generating-sysex-messages-with.html]
90
- * {Etc}[http://tx81z.blogspot.com/2011/09/more-micromidi-tricks.html]
91
-
92
- == Documentation
93
-
94
- * {rdoc}[http://rubydoc.info/github/arirusso/micromidi]
95
-
96
- == Author
97
-
98
- * {Ari Russo}[http://github.com/arirusso] <ari.russo at gmail.com>
99
-
100
- == License
101
-
102
- Apache 2.0, See the file LICENSE
103
-
104
- Copyright (c) 2011 Ari Russo
data/TODO DELETED
@@ -1,5 +0,0 @@
1
- Functionality
2
- * MIDI files?
3
-
4
- Documentation
5
- * More rdoc