mpd32api 0.1.0
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.
- checksums.yaml +15 -0
- data/.gitignore +20 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/bin/mpd32api +27 -0
- data/lib/mpd32api.rb +63 -0
- data/lib/mpd32api/mapping.rb +42 -0
- data/lib/mpd32api/version.rb +3 -0
- data/mpd32api.gemspec +25 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjUyMzAxYjFkNmE2ZjA1NjllODhlOGM4MmZiODg5ZGM3NWViM2ZiZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTEyMDBhNjNlOTNkMDIxZmVjMGFiNTc2YWQ3ZTlhYWNhNjM2ZTlkNg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzY3YTE5ZTYyMDE5NmFhZjMwMWYxY2EyODVjNWI5OWM2ODMxNjIyMWE4YmQ3
|
10
|
+
ZDdlNzlmYzljNmJlYjA5YzFmYTJmYzUyZGI4YzM1ZDIzMDcyNDdmYTY3MWIz
|
11
|
+
Y2ViNGJjMzA3MzA3ODY3YmY3NTY1ZmFhMzVjMGQzZGM4N2M4ODc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGI2YmRiZTk3YjgzYjc1MDY4ZmVjNDNiMzA2N2RjMmM4MzNmNGQ3MzM1MGNj
|
14
|
+
YmZmMWRmNGYwY2NlNmVmZTFiMjU0N2EwYWZjYmI1NzI2N2VlOTE1MmY0YTRk
|
15
|
+
OGZjNGFlZGQzMjg5MGQxYmE2YzliOWFiZWIyNDlhNDEwMzdmMjk=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Oskar Malnowicz
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
Mpd32Api
|
2
|
+
========
|
3
|
+
|
4
|
+
Control akai mpd32
|
5
|
+
|
6
|
+
**Features**
|
7
|
+
* Select input / output midi device with cli
|
8
|
+
* Read from midi input
|
9
|
+
* Select control bank
|
10
|
+
* Select pad bank
|
11
|
+
* Toggle note repeat
|
12
|
+
* Set note repeat value
|
13
|
+
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
$ gem 'mpd32api'
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install mpd32api
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
See bin/mpd32api
|
32
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/mpd32api
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
if File.symlink?(__FILE__)
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', File.readlink(__FILE__))
|
4
|
+
else
|
5
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'mpd32api'
|
9
|
+
|
10
|
+
begin
|
11
|
+
|
12
|
+
# Get midi input and output
|
13
|
+
input = Mpd32Api.get_midi_input_device
|
14
|
+
output = Mpd32Api.get_midi_output_device
|
15
|
+
|
16
|
+
# Create an instance of Mpd32Api::Library
|
17
|
+
mpd32api = Mpd32Api::Library.new input, output
|
18
|
+
|
19
|
+
# Use the Mpd32Api methods
|
20
|
+
mpd32api.showcase
|
21
|
+
|
22
|
+
rescue Exception => e
|
23
|
+
puts e.backtrace
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
data/lib/mpd32api.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'mpd32api/version'
|
2
|
+
require 'mpd32api/mapping'
|
3
|
+
require 'unimidi'
|
4
|
+
|
5
|
+
module Mpd32Api
|
6
|
+
def Mpd32Api.get_midi_input_device
|
7
|
+
UniMIDI::Input.gets
|
8
|
+
end
|
9
|
+
|
10
|
+
def Mpd32Api.get_midi_output_device
|
11
|
+
UniMIDI::Output.gets
|
12
|
+
end
|
13
|
+
|
14
|
+
class Library
|
15
|
+
def initialize(input_device, output_device)
|
16
|
+
input_device.instance_of?(UniMIDI::CoreMIDIAdapter::Input) ?
|
17
|
+
@input = input_device :
|
18
|
+
@input = UniMIDI::Input.use(input_device)
|
19
|
+
output_device.instance_of?(UniMIDI::CoreMIDIAdapter::Output) ?
|
20
|
+
@output = output_device :
|
21
|
+
@output = UniMIDI::Output.use(output_device)
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_read_input
|
25
|
+
@input.open
|
26
|
+
loop {
|
27
|
+
message = @input.gets
|
28
|
+
p message
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def send_msg(message)
|
33
|
+
@output.open { |output|
|
34
|
+
output.puts(message)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def switch_to_control_bank(x)
|
39
|
+
self.send_msg Mpd32Api::MIDI_MAPPING[:control_bank][x]
|
40
|
+
end
|
41
|
+
|
42
|
+
def switch_to_pad_bank(x)
|
43
|
+
self.send_msg Mpd32Api::MIDI_MAPPING[:pad_bank][x]
|
44
|
+
end
|
45
|
+
|
46
|
+
def note_repeat(x)
|
47
|
+
self.send_msg Mpd32Api::MIDI_MAPPING[:note_repeat][x]
|
48
|
+
end
|
49
|
+
|
50
|
+
def time_division(x)
|
51
|
+
self.send_msg Mpd32Api::MIDI_MAPPING[:time_division][x]
|
52
|
+
end
|
53
|
+
|
54
|
+
def showcase
|
55
|
+
Mpd32Api::MIDI_MAPPING.each do |kx,vx|
|
56
|
+
vx.each do |ky,vy|
|
57
|
+
self.send_msg vy
|
58
|
+
sleep 1
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Mpd32Api
|
2
|
+
MIDI_MAPPING = {
|
3
|
+
:control_bank => {
|
4
|
+
c1: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0C, 0x00, 0xF7],
|
5
|
+
c2: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0C, 0x01, 0xF7],
|
6
|
+
c3: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0C, 0x02, 0xF7]
|
7
|
+
},
|
8
|
+
:pad_bank => {
|
9
|
+
c1: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x00, 0xF7],
|
10
|
+
c2: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x01, 0xF7],
|
11
|
+
c3: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x02, 0xF7],
|
12
|
+
c4: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x03, 0xF7]
|
13
|
+
},
|
14
|
+
:note_repeat => {
|
15
|
+
on: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x10, 0x01, 0xF7],
|
16
|
+
off: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x10, 0x00, 0xF7]
|
17
|
+
},
|
18
|
+
:time_division => {
|
19
|
+
on: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x1E, 0x01, 0xF7],
|
20
|
+
t1: [0xF0, 0x47, 0x00, 0x6c, 0x31, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x00, 0xF7],
|
21
|
+
t2: [0xF0, 0x47, 0x00, 0x6c, 0x31, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x01, 0xF7],
|
22
|
+
t3: [0xF0, 0x47, 0x00, 0x6c, 0x31, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x02, 0xF7],
|
23
|
+
t4: [0xF0, 0x47, 0x00, 0x6c, 0x31, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x03, 0xF7],
|
24
|
+
t5: [0xF0, 0x47, 0x00, 0x6c, 0x31, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x04, 0xF7],
|
25
|
+
t6: [0xF0, 0x47, 0x00, 0x6c, 0x31, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x05, 0xF7],
|
26
|
+
t7: [0xF0, 0x47, 0x00, 0x6c, 0x31, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x06, 0xF7],
|
27
|
+
t8: [0xF0, 0x47, 0x00, 0x6c, 0x31, 0x00, 0x04, 0x01, 0x00, 0x0B, 0x07, 0xF7],
|
28
|
+
off: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x1E, 0x00, 0xF7],
|
29
|
+
},
|
30
|
+
:levels16 => {
|
31
|
+
on: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0E, 0x01, 0xF7],
|
32
|
+
off: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0E, 0x00, 0xF7]
|
33
|
+
},
|
34
|
+
:fulllevel => {
|
35
|
+
on: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0D, 0x01, 0xF7],
|
36
|
+
off: [0xF0, 0x47, 0x00, 0x6C, 0x30, 0x00, 0x04, 0x01, 0x00, 0x0D, 0x00, 0xF7]
|
37
|
+
},
|
38
|
+
:status => {
|
39
|
+
loaded_preset: [0xF0, 0x47, 0x00, 0x6C, 0x22, 0x00, 0x04, 0x7c, 0x00, 0x00, 0x00, 0xF7]
|
40
|
+
}
|
41
|
+
}
|
42
|
+
end
|
data/mpd32api.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mpd32api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'mpd32api'
|
8
|
+
spec.version = Mpd32Api::VERSION
|
9
|
+
spec.authors = ['Oskar Malnowicz']
|
10
|
+
spec.email = %w(oscarsix@gmail.com)
|
11
|
+
spec.description = %q{Control akai mpd32}
|
12
|
+
spec.summary = %q{Send midi sysex to the device}
|
13
|
+
spec.homepage = 'https://github.com/oscarsix'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = %w(lib)
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
|
24
|
+
spec.add_dependency 'unimidi'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mpd32api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Oskar Malnowicz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: unimidi
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Control akai mpd32
|
56
|
+
email:
|
57
|
+
- oscarsix@gmail.com
|
58
|
+
executables:
|
59
|
+
- mpd32api
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/mpd32api
|
69
|
+
- lib/mpd32api.rb
|
70
|
+
- lib/mpd32api/mapping.rb
|
71
|
+
- lib/mpd32api/version.rb
|
72
|
+
- mpd32api.gemspec
|
73
|
+
homepage: https://github.com/oscarsix
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.1.11
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Send midi sysex to the device
|
97
|
+
test_files: []
|