banjo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/lib/banjo.rb +3 -2
- data/lib/banjo/channel.rb +7 -0
- data/lib/banjo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1602d6a96258f60f5abd2b1266f9f7ab042a06a2
|
4
|
+
data.tar.gz: 02de585c8ea9fad0d8dc02e060d8aeb0b7daa247
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 865bca105bcdcc6061cdcc7af867cbd60173814f8668cc32f53776cd01103a1d47003c695423210f829dd811c771cd236a178f485a3c7f1352fa7d9b3b9e595a
|
7
|
+
data.tar.gz: 18c29122e833874acd3227d876825357a370e211e582577183ffba57202c6871a5f920504d2c5f6b3a9dfe9862a912a0782079b4cb0a30e329ed55b873370a27
|
data/README.md
CHANGED
data/lib/banjo.rb
CHANGED
@@ -10,6 +10,7 @@ $: << '.'
|
|
10
10
|
module Banjo
|
11
11
|
class << self
|
12
12
|
attr_accessor :tempo
|
13
|
+
attr_accessor :ticks_per_period
|
13
14
|
end
|
14
15
|
|
15
16
|
def self.load_channels
|
@@ -19,7 +20,7 @@ module Banjo
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def self.play
|
22
|
-
tempo_in_ms = 60.0 / Banjo.tempo /
|
23
|
+
tempo_in_ms = 60.0 / Banjo.tempo / ticks_per_period
|
23
24
|
|
24
25
|
EventMachine.run do
|
25
26
|
n = 0
|
@@ -33,7 +34,7 @@ module Banjo
|
|
33
34
|
channel.perform
|
34
35
|
end
|
35
36
|
|
36
|
-
n <
|
37
|
+
n < (ticks_per_period - 1) ? n += 1 : n = 0
|
37
38
|
end
|
38
39
|
|
39
40
|
puts "Banjo Reactor started..."
|
data/lib/banjo/channel.rb
CHANGED
@@ -31,6 +31,13 @@ module Banjo
|
|
31
31
|
Thread.new { play_note!(note, velocity, duration) }
|
32
32
|
end
|
33
33
|
|
34
|
+
def arpeggio(notes, velocity = 50)
|
35
|
+
step = (1.0 * Banjo.ticks_per_period / notes.size).round
|
36
|
+
notes.each_with_index do |note, index|
|
37
|
+
tick_note((index * step), note, velocity)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
34
41
|
def play_note!(note, velocity = 50, duration = 0.5)
|
35
42
|
output.open do |o|
|
36
43
|
o.puts(0x80, note, velocity)
|
data/lib/banjo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Padilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unimidi
|