banjo 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +60 -0
- data/Rakefile +10 -0
- data/banjo.gemspec +27 -0
- data/lib/banjo.rb +42 -0
- data/lib/banjo/channel.rb +42 -0
- data/lib/banjo/version.rb +3 -0
- data/test/cases/banjo/channel_test.rb +37 -0
- data/test/cases/banjo_test.rb +8 -0
- data/test/channels/load_test.rb +1 -0
- data/test/test_helper.rb +4 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e8a496a15be632461ce3eb7e036ef0dc70866d17
|
4
|
+
data.tar.gz: 0e7813d096fdda17439fb761fad7e989dbe0c2f0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a970378bc6b670ba5e11e3d9caa895f4d94750d9388e1ec3ace243de2c336d5424478c27e62770cf77634b4bc6295ea5f7c7dbfea59fcafd244208f3b885c67b
|
7
|
+
data.tar.gz: 5bef9e1d356679e0f1c22074318c0144e26f31feb1be818846baa32a99e57ab1eb3e91113da713bf70711da7b813da2fada999d9971c759e837cc34dfe636879
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 David Padilla
|
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,60 @@
|
|
1
|
+
[](http://allthebadges.io/dabit/banjo/travis)
|
2
|
+
[](http://allthebadges.io/dabit/banjo/code_climate)
|
3
|
+
|
4
|
+
# Banjo
|
5
|
+
|
6
|
+
MIDI Looper designed for Live performances
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Install it:
|
11
|
+
|
12
|
+
$ gem install banjo
|
13
|
+
|
14
|
+
## Requirements
|
15
|
+
|
16
|
+
### Mac OS X
|
17
|
+
|
18
|
+
You need to create virtual MIDI IAC inputs. You can learn how to do so by
|
19
|
+
watching [this video][1].
|
20
|
+
|
21
|
+
Each one of these inputs will work as a Channel for Banjo.
|
22
|
+
|
23
|
+
To make sure you have IAC inputs set up properly you can run the following
|
24
|
+
command:
|
25
|
+
|
26
|
+
$ unimidi list
|
27
|
+
|
28
|
+
input:
|
29
|
+
0) Apple Inc. IAC Driver
|
30
|
+
output:
|
31
|
+
1) Apple Inc. IAC Driver
|
32
|
+
|
33
|
+
The `unimidi list` command will show you a list of the available IAC drivers
|
34
|
+
that can be used with Banjo.
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
Promise to come back to write a proper guide, for now take a look at the included
|
39
|
+
sample.
|
40
|
+
|
41
|
+
After you create the IAC driver open Garage Band.
|
42
|
+
|
43
|
+
Go to the `sample/basic` folder and run:
|
44
|
+
|
45
|
+
$ ruby song.rb
|
46
|
+
|
47
|
+
You should be able to listen some of the tones created by Banjo.
|
48
|
+
|
49
|
+
Edit `channels/main_channel.rb` on the `sample/basic` folder while the Banjo
|
50
|
+
reactor is running and you will notice the changes in realtime.
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
1. Fork it
|
55
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
56
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
57
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
58
|
+
5. Create new Pull Request
|
59
|
+
|
60
|
+
[1]:[http://www.youtube.com/watch?v=hgFA_fdup7g]
|
data/Rakefile
ADDED
data/banjo.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'banjo/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "banjo"
|
8
|
+
spec.version = Banjo::VERSION
|
9
|
+
spec.authors = ["David Padilla"]
|
10
|
+
spec.email = ["david@crowdint.com"]
|
11
|
+
spec.description = %q{MIDI looper designed for live performances}
|
12
|
+
spec.summary = %q{MIDI looper designed for live performances}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/) - Dir['sample/**/**'].to_a
|
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 = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "unimidi", "~> 0.3.3"
|
22
|
+
spec.add_dependency "eventmachine", "~> 1.0.3"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rr"
|
27
|
+
end
|
data/lib/banjo.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'banjo/version'
|
2
|
+
|
3
|
+
require 'eventmachine'
|
4
|
+
require 'unimidi'
|
5
|
+
|
6
|
+
require 'banjo/channel'
|
7
|
+
|
8
|
+
$: << '.'
|
9
|
+
|
10
|
+
module Banjo
|
11
|
+
class << self
|
12
|
+
attr_accessor :tempo
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.load_channels
|
16
|
+
Dir['./channels/*.rb'].each do |file|
|
17
|
+
load file
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.play
|
22
|
+
tempo_in_ms = 60.0 / Banjo.tempo / 16
|
23
|
+
|
24
|
+
EventMachine.run do
|
25
|
+
n = 0
|
26
|
+
EM.add_periodic_timer(tempo_in_ms) do
|
27
|
+
begin
|
28
|
+
Banjo.load_channels
|
29
|
+
end
|
30
|
+
|
31
|
+
Banjo::Channel.channels.each do |klass|
|
32
|
+
channel = klass.new(n)
|
33
|
+
channel.perform
|
34
|
+
end
|
35
|
+
|
36
|
+
n < 15 ? n += 1 : n = 0
|
37
|
+
end
|
38
|
+
|
39
|
+
puts "Banjo Reactor started..."
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Banjo
|
2
|
+
class Channel
|
3
|
+
attr_accessor :output, :tick
|
4
|
+
|
5
|
+
def channel
|
6
|
+
0
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.channels
|
10
|
+
@channels ||= []
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.inherited(child)
|
14
|
+
channels << child
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(tick)
|
18
|
+
@output = UniMIDI::Output.all[channel]
|
19
|
+
@tick = tick
|
20
|
+
end
|
21
|
+
|
22
|
+
def tick_note(tick, note, velocity = 50, duration = 0.5)
|
23
|
+
play_note(note, velocity, duration) if tick == self.tick
|
24
|
+
end
|
25
|
+
|
26
|
+
def mod_note(mod, note, offset = 0, velocity = 50)
|
27
|
+
play_note(note, velocity, 0.5) if ((tick + offset) % mod == 0)
|
28
|
+
end
|
29
|
+
|
30
|
+
def play_note(note, velocity = 50, duration = 0.5)
|
31
|
+
Thread.new { play_note!(note, velocity, duration) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def play_note!(note, velocity = 50, duration = 0.5)
|
35
|
+
output.open do |o|
|
36
|
+
o.puts(0x80, note, velocity)
|
37
|
+
sleep(duration)
|
38
|
+
o.puts(0x90, note, velocity)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ChannelTest < Test::Unit::TestCase
|
4
|
+
def subject
|
5
|
+
@subject ||= Banjo::Channel.new(0)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_channel
|
9
|
+
assert_equal 0, subject.channel
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_tick_note_plays
|
13
|
+
mock(subject).play_note(15, 50, 0.5)
|
14
|
+
subject.tick_note(0, 15)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_tick_note_does_not_play
|
18
|
+
mock(subject).play_note(15, 50, 0.5).never
|
19
|
+
subject.tick_note(3, 15)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_mod_note_when_note_plays
|
23
|
+
[0, 4, 8, 12].each do |tick|
|
24
|
+
subject.tick = tick
|
25
|
+
mock(subject).play_note(15, 50, 0.5)
|
26
|
+
subject.mod_note(4, 15)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_mod_note_when_note_does_not_play
|
31
|
+
((0..15).to_a - [0, 4, 8, 12]).each do |tick|
|
32
|
+
subject.tick = tick
|
33
|
+
mock(subject).play_note(15, 50, 0.5).never
|
34
|
+
subject.mod_note(4, 15)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
@@loaded = true
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: banjo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Padilla
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: unimidi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.3.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.3.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: eventmachine
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: MIDI looper designed for live performances
|
84
|
+
email:
|
85
|
+
- david@crowdint.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .travis.yml
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- banjo.gemspec
|
97
|
+
- lib/banjo.rb
|
98
|
+
- lib/banjo/channel.rb
|
99
|
+
- lib/banjo/version.rb
|
100
|
+
- test/cases/banjo/channel_test.rb
|
101
|
+
- test/cases/banjo_test.rb
|
102
|
+
- test/channels/load_test.rb
|
103
|
+
- test/test_helper.rb
|
104
|
+
homepage: ''
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.0.3
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: MIDI looper designed for live performances
|
128
|
+
test_files:
|
129
|
+
- test/cases/banjo/channel_test.rb
|
130
|
+
- test/cases/banjo_test.rb
|
131
|
+
- test/channels/load_test.rb
|
132
|
+
- test/test_helper.rb
|