banjo 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8a496a15be632461ce3eb7e036ef0dc70866d17
4
- data.tar.gz: 0e7813d096fdda17439fb761fad7e989dbe0c2f0
3
+ metadata.gz: 1602d6a96258f60f5abd2b1266f9f7ab042a06a2
4
+ data.tar.gz: 02de585c8ea9fad0d8dc02e060d8aeb0b7daa247
5
5
  SHA512:
6
- metadata.gz: a970378bc6b670ba5e11e3d9caa895f4d94750d9388e1ec3ace243de2c336d5424478c27e62770cf77634b4bc6295ea5f7c7dbfea59fcafd244208f3b885c67b
7
- data.tar.gz: 5bef9e1d356679e0f1c22074318c0144e26f31feb1be818846baa32a99e57ab1eb3e91113da713bf70711da7b813da2fada999d9971c759e837cc34dfe636879
6
+ metadata.gz: 865bca105bcdcc6061cdcc7af867cbd60173814f8668cc32f53776cd01103a1d47003c695423210f829dd811c771cd236a178f485a3c7f1352fa7d9b3b9e595a
7
+ data.tar.gz: 18c29122e833874acd3227d876825357a370e211e582577183ffba57202c6871a5f920504d2c5f6b3a9dfe9862a912a0782079b4cb0a30e329ed55b873370a27
data/README.md CHANGED
@@ -1,4 +1,3 @@
1
- [![Build Status](http://allthebadges.io/dabit/banjo/travis.png)](http://allthebadges.io/dabit/banjo/travis)
2
1
  [![Code Climate](http://allthebadges.io/dabit/banjo/code_climate.png)](http://allthebadges.io/dabit/banjo/code_climate)
3
2
 
4
3
  # Banjo
@@ -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 / 16
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 < 15 ? n += 1 : n = 0
37
+ n < (ticks_per_period - 1) ? n += 1 : n = 0
37
38
  end
38
39
 
39
40
  puts "Banjo Reactor started..."
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Banjo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-17 00:00:00.000000000 Z
11
+ date: 2013-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unimidi