banjo 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/banjo.gemspec +2 -1
- data/lib/banjo.rb +22 -6
- data/lib/banjo/channel.rb +12 -4
- data/lib/banjo/version.rb +1 -1
- metadata +31 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25a2db070a4d537dd0f0507fa271e5b1392861d3
|
4
|
+
data.tar.gz: 2f9d961e602991034a2a90445b9c6b369390cfa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b98de3fd1fb5692a6ca401bfe86ec02dc35e2fb0596fc54853d77b6ca774881aac35304c8c50c8ad39e475c15038f953b92cb8817be048d954b29066b595619
|
7
|
+
data.tar.gz: b657cff30587dbac401d57dbb6656b2060150c634f95660b9ba67b1fe49e1e9763e871072aba129149672f9376e9dee58fc1c82494e838fa0130e349aafa6874
|
data/banjo.gemspec
CHANGED
@@ -18,8 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "unimidi", "
|
21
|
+
spec.add_dependency "unimidi", "0.3.3"
|
22
22
|
spec.add_dependency "eventmachine", "~> 1.0.3"
|
23
|
+
spec.add_dependency "rubysl-yaml", "2.0.0"
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
26
|
spec.add_development_dependency "rake"
|
data/lib/banjo.rb
CHANGED
@@ -14,9 +14,15 @@ module Banjo
|
|
14
14
|
attr_accessor :tempo
|
15
15
|
attr_accessor :ticks_per_beat
|
16
16
|
attr_accessor :ticks_per_period
|
17
|
+
attr_accessor :loop_count
|
17
18
|
end
|
18
19
|
|
19
20
|
def self.load_channels
|
21
|
+
load_channels!
|
22
|
+
rescue Exception
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.load_channels!
|
20
26
|
Dir['./channels/*.rb'].each do |file|
|
21
27
|
load file
|
22
28
|
end
|
@@ -29,21 +35,31 @@ module Banjo
|
|
29
35
|
puts "Beat every: #{tempo_in_ms}"
|
30
36
|
|
31
37
|
EventMachine.run do
|
32
|
-
|
38
|
+
tick = 0
|
39
|
+
self.loop_count = 0
|
40
|
+
|
33
41
|
EM.add_periodic_timer(tempo_in_ms) do
|
34
|
-
|
35
|
-
Banjo.load_channels
|
36
|
-
end
|
42
|
+
Banjo.load_channels if tick == 0
|
37
43
|
|
38
44
|
Banjo::Channel.channels.each do |klass|
|
39
|
-
channel = klass.new(
|
45
|
+
channel = klass.new(tick)
|
40
46
|
channel.perform
|
41
47
|
end
|
42
48
|
|
43
|
-
|
49
|
+
tick = update_counters(tick)
|
44
50
|
end
|
45
51
|
|
46
52
|
puts "Banjo Reactor started..."
|
47
53
|
end
|
48
54
|
end
|
55
|
+
|
56
|
+
def self.update_counters(tick)
|
57
|
+
if tick < (ticks_per_period - 1)
|
58
|
+
tick += 1
|
59
|
+
else
|
60
|
+
puts self.loop_count += 1
|
61
|
+
tick = 0
|
62
|
+
end
|
63
|
+
tick
|
64
|
+
end
|
49
65
|
end
|
data/lib/banjo/channel.rb
CHANGED
@@ -7,6 +7,10 @@ module Banjo
|
|
7
7
|
0
|
8
8
|
end
|
9
9
|
|
10
|
+
def midi_channels
|
11
|
+
[0x90, 0x80]
|
12
|
+
end
|
13
|
+
|
10
14
|
def self.channels
|
11
15
|
@channels ||= []
|
12
16
|
end
|
@@ -30,8 +34,8 @@ module Banjo
|
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
33
|
-
def mod_note(mod, note, offset = 0, velocity = 50)
|
34
|
-
play_note(note, velocity,
|
37
|
+
def mod_note(mod, note, offset = 0, velocity = 50, duration = DEFAULT_DURATION)
|
38
|
+
play_note(note, velocity, duration) if ((tick + offset) % mod == 0)
|
35
39
|
end
|
36
40
|
|
37
41
|
def play_note(note, velocity = 50, duration = DEFAULT_DURATION)
|
@@ -46,6 +50,10 @@ module Banjo
|
|
46
50
|
output.puts 0xE0, 0, value
|
47
51
|
end
|
48
52
|
|
53
|
+
def sustain(value = 0)
|
54
|
+
output.puts 0xB0, 0x40, value
|
55
|
+
end
|
56
|
+
|
49
57
|
def arpeggio(notes, velocity = 50)
|
50
58
|
step = (1.0 * Banjo.ticks_per_period / notes.size).round
|
51
59
|
notes.each_with_index do |note, index|
|
@@ -58,9 +66,9 @@ module Banjo
|
|
58
66
|
end
|
59
67
|
|
60
68
|
def play_note!(note, velocity = 50, duration = DEFAULT_DURATION)
|
61
|
-
output.puts(
|
69
|
+
output.puts(midi_channels[0], note, velocity)
|
62
70
|
sleep(duration)
|
63
|
-
output.puts(
|
71
|
+
output.puts(midi_channels[1], note, velocity)
|
64
72
|
end
|
65
73
|
end
|
66
74
|
end
|
data/lib/banjo/version.rb
CHANGED
metadata
CHANGED
@@ -1,83 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banjo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Padilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unimidi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.3.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.3.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: eventmachine
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.0.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubysl-yaml
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - ~>
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '1.3'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - ~>
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '1.3'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rr
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
description: MIDI looper designed for live performances
|
@@ -87,8 +101,8 @@ executables: []
|
|
87
101
|
extensions: []
|
88
102
|
extra_rdoc_files: []
|
89
103
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .travis.yml
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
92
106
|
- Gemfile
|
93
107
|
- LICENSE.txt
|
94
108
|
- README.md
|
@@ -111,17 +125,17 @@ require_paths:
|
|
111
125
|
- lib
|
112
126
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
127
|
requirements:
|
114
|
-
- -
|
128
|
+
- - ">="
|
115
129
|
- !ruby/object:Gem::Version
|
116
130
|
version: '0'
|
117
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
132
|
requirements:
|
119
|
-
- -
|
133
|
+
- - ">="
|
120
134
|
- !ruby/object:Gem::Version
|
121
135
|
version: '0'
|
122
136
|
requirements: []
|
123
137
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.0
|
138
|
+
rubygems_version: 2.2.0
|
125
139
|
signing_key:
|
126
140
|
specification_version: 4
|
127
141
|
summary: MIDI looper designed for live performances
|