zgomot 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/LICENSE +22 -0
- data/README.rdoc +7 -0
- data/Rakefile +24 -0
- data/VERSION +1 -0
- data/bin/zgomot +2 -0
- data/examples/arp_chords.rb +15 -0
- data/examples/full_scale_notes.rb +15 -0
- data/examples/inv_chords.rb +15 -0
- data/examples/modes_notes.rb +16 -0
- data/examples/notes.rb +18 -0
- data/examples/percs.rb +20 -0
- data/examples/percs_multi.rb +18 -0
- data/examples/phase_notes.rb +20 -0
- data/examples/prog_chords.rb +15 -0
- data/examples/prog_chords_multi_vel_length.rb +15 -0
- data/examples/prog_chords_rest.rb +15 -0
- data/examples/prog_notes.rb +15 -0
- data/examples/prog_notes_multi_vel_length.rb +15 -0
- data/examples/prog_notes_rest.rb +15 -0
- data/examples/progressive_modes.rb +51 -0
- data/examples/reverse_chords.rb +15 -0
- data/examples/scale_chords.rb +15 -0
- data/examples/scale_notes.rb +15 -0
- data/examples/scales_notes.rb +19 -0
- data/examples/simple_chords.rb +15 -0
- data/examples/simple_markov.rb +24 -0
- data/examples/simple_notes.rb +15 -0
- data/examples/simple_notes_length.rb +17 -0
- data/examples/simple_notes_velocity.rb +17 -0
- data/examples/zgomot.yml +3 -0
- data/lib/zgomot/boot.rb +56 -0
- data/lib/zgomot/comp/chord.rb +171 -0
- data/lib/zgomot/comp/markov.rb +60 -0
- data/lib/zgomot/comp/mode.rb +66 -0
- data/lib/zgomot/comp/note.rb +29 -0
- data/lib/zgomot/comp/pattern.rb +63 -0
- data/lib/zgomot/comp/perc.rb +94 -0
- data/lib/zgomot/comp/permutation.rb +17 -0
- data/lib/zgomot/comp/pitch_class.rb +63 -0
- data/lib/zgomot/comp/progression.rb +132 -0
- data/lib/zgomot/comp/scale.rb +32 -0
- data/lib/zgomot/comp.rb +11 -0
- data/lib/zgomot/config.rb +51 -0
- data/lib/zgomot/main.rb +51 -0
- data/lib/zgomot/midi/channel.rb +92 -0
- data/lib/zgomot/midi/clock.rb +101 -0
- data/lib/zgomot/midi/dispatcher.rb +92 -0
- data/lib/zgomot/midi/interface.rb +29 -0
- data/lib/zgomot/midi/note.rb +104 -0
- data/lib/zgomot/midi/stream.rb +76 -0
- data/lib/zgomot/midi.rb +6 -0
- data/lib/zgomot/patches/object.rb +11 -0
- data/lib/zgomot/patches/time.rb +10 -0
- data/lib/zgomot/patches.rb +2 -0
- data/lib/zgomot.rb +14 -0
- data/lib/zlive.rb +7 -0
- metadata +178 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2009 troystribling
|
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.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
$:.unshift('lib')
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
#####-------------------------------------------------------------------------------------------------------
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
#####-------------------------------------------------------------------------------------------------------
|
9
|
+
begin
|
10
|
+
require 'jeweler'
|
11
|
+
Jeweler::Tasks.new do |gem|
|
12
|
+
gem.name = "zgomot"
|
13
|
+
gem.summary = %Q{zgomot is a simple DSL for writting MIDI music.}
|
14
|
+
gem.email = "troy.stribling@gmail.com"
|
15
|
+
gem.homepage = "http://github.com/troystribling/zgomot"
|
16
|
+
gem.authors = ["Troy Stribling"]
|
17
|
+
gem.files.include %w(lib/jeweler/templates/.gitignore VERSION)
|
18
|
+
gem.add_dependency('rake', '>= 0.8.3')
|
19
|
+
gem.add_dependency('midiator', '>= 0.3.3')
|
20
|
+
end
|
21
|
+
rescue LoadError
|
22
|
+
abort "jeweler is not available. In order to run test, you must: sudo gem install technicalpickles-jeweler --source=http://gems.github.com"
|
23
|
+
end
|
24
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/zgomot
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'arp', cp([:B,3],:ionian,:l=>4)[1,4,5,5].arp!(16), :lim=>1 do |pattern|
|
11
|
+
ch << pattern
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'full_scale', np(nil,5,4), :lim=>6 do |pattern|
|
11
|
+
ch << pattern.tonic!(:A, count)
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'inversion', cp([:C,3],:ionian,:l=>4).inv!(2), :lim=>1 do |pattern|
|
11
|
+
ch << pattern
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'modes', [np([:A,4],nil,:l=>4), np([:A,4],nil,:l=>4).reverse!.shift, n(:R)], :lim=>6 do |pattern|
|
11
|
+
Zgomot.logger.info "TONIC: [A,4], MODE: #{count-1}"
|
12
|
+
ch << pattern.mode!(count)
|
13
|
+
end
|
14
|
+
|
15
|
+
#.........................................................................................................
|
16
|
+
play
|
data/examples/notes.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
score = [n([:C,5]), n(:B), n(:R), n(:G), n(:C,:l=>2), n([:E,5],:l=>2)]
|
11
|
+
|
12
|
+
#.........................................................................................................
|
13
|
+
str 'notes', score, :lim=>3 do |pattern|
|
14
|
+
ch << pattern
|
15
|
+
end
|
16
|
+
|
17
|
+
#.........................................................................................................
|
18
|
+
play
|
data/examples/percs.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
score = [pr(:acoustic_bass_drum), pr(:bass_drum_1), pr(:acoustic_snare), pr(:electric_snare),
|
11
|
+
pr(:open_hi_hat), pr(:closed_hi_hat), pr(:high_tom), pr(:low_mid_tom),
|
12
|
+
pr(:low_tom), pr(:hand_clap), pr(:ride_cymbal_1), pr(:cowbell)]
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
str 'percussion', score, :lim=>:inf do |pattern|
|
16
|
+
ch(2) << pattern
|
17
|
+
end
|
18
|
+
|
19
|
+
#.........................................................................................................
|
20
|
+
play
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
score = [pr([:acoustic_bass_drum, :cowbell]), pr(:R), pr([:acoustic_snare, :hand_clap]), pr(:R)]
|
11
|
+
|
12
|
+
#.........................................................................................................
|
13
|
+
str 'percussion', score, :lim=>:inf do |pattern|
|
14
|
+
ch(2) << pattern
|
15
|
+
end
|
16
|
+
|
17
|
+
#.........................................................................................................
|
18
|
+
play
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'melody-1', np([:B,3],nil,:l=>4)[1,4,5,5], :lim=>:inf do |pattern|
|
11
|
+
ch(0) << pattern.mode!((count/4) % 7 + 1)
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
str 'melody-2', np([:B,3],:ionian,:l=>4)[1,4,5,5].bpm!(16.0/15.0), :lim=>:inf do |pattern|
|
16
|
+
ch(1) << pattern
|
17
|
+
end
|
18
|
+
|
19
|
+
#.........................................................................................................
|
20
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'prog', cp([:B,3],:ionian,:l=>4)[1,4,5,5], :lim=>1 do |pattern|
|
11
|
+
ch << pattern
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'prog', cp([:A,4],nil,:l=>[4,4,8,8,4], :v=>[0.6, 0.4, 0.7, 0.6, 0.4])[7,5,3,3,1], :lim=>6 do |pattern|
|
11
|
+
ch << pattern.mode!(count)
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'prog', cp([:B,3],:ionian,:l=>4)[1,4,:R,5], :lim=>1 do |pattern|
|
11
|
+
ch << pattern
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'prog', np([:A,4],nil,:l=>4)[7,5,3,1], :lim=>6 do |pattern|
|
11
|
+
ch << pattern.mode!(count)
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'prog', np([:A,4],nil,:l=>[4,4,8,8,4], :v=>[0.6, 0.4, 0.7, 0.6, 0.4])[7,5,3,3,1], :lim=>6 do |pattern|
|
11
|
+
ch << pattern.mode!(count)
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'prog', np([:A,4],nil,:l=>4)[7,:R,3,1], :lim=>6 do |pattern|
|
11
|
+
ch << pattern.mode!(count)
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
major_modes = [:ionian, :lydian, :mixolydian]
|
11
|
+
minor_modes = [:dorian, :phrygian, :aeolian]
|
12
|
+
|
13
|
+
#.........................................................................................................
|
14
|
+
m_slow = mark
|
15
|
+
m_slow.add([0.6, 0.4]) do |count|
|
16
|
+
np([:A,4],major_modes[count % 3],:l=>4)[7,5,3,1]
|
17
|
+
end
|
18
|
+
m_slow.add([0.4, 0.6]) do |count|
|
19
|
+
np([:A,4],minor_modes[count % 3],:l=>4)[7,5,3,1]
|
20
|
+
end
|
21
|
+
|
22
|
+
#.........................................................................................................
|
23
|
+
str :slow do
|
24
|
+
ch(0) << m_slow.next(count)
|
25
|
+
end
|
26
|
+
|
27
|
+
#.........................................................................................................
|
28
|
+
m_fast = mark
|
29
|
+
m_fast.add([0.6, 0.4]) do |count|
|
30
|
+
np([:G,4],major_modes[count % 3],:l=>4)[7,5,3,1].bpm!(16.0/15.0)
|
31
|
+
end
|
32
|
+
m_fast.add([0.4, 0.6]) do |count|
|
33
|
+
np([:G,4],minor_modes[count % 3],:l=>4)[7,5,3,1].bpm!(16.0/15.0)
|
34
|
+
end
|
35
|
+
|
36
|
+
#.........................................................................................................
|
37
|
+
str :fast do
|
38
|
+
ch(1) << m_fast.next(count)
|
39
|
+
end
|
40
|
+
|
41
|
+
#.........................................................................................................
|
42
|
+
str :perc do
|
43
|
+
ch(2) << if (count % 2).eql?(0)
|
44
|
+
[pr(:R, :l=>2), pr(:hand_clap), pr(:hand_clap)]
|
45
|
+
else
|
46
|
+
pr(:R,:l=>1)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
#.........................................................................................................
|
51
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'chords', [c(:C,:min).arp!(4), c(:C,:min).arp!(4).rev!, c(:E,:min).arp!(4), c(:E,:min).arp!(4).rev!], :lim=>3 do |pattern|
|
11
|
+
ch << pattern
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'scale', cp([:C,4],:ionian,:l=>4), :lim=>1 do |pattern|
|
11
|
+
ch << pattern
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'scale', [np([:C,4],:dorian,:l=>4), np([:C,4],:dorian,:l=>4).reverse!.shift, n(:R)], :lim=>3 do |pattern|
|
11
|
+
ch << pattern
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
pclass = [:C, :Cs, :D, :Ds, :E, :F, :Fs, :G, :Gs, :A, :As, :B]
|
11
|
+
|
12
|
+
#.........................................................................................................
|
13
|
+
str 'scale', [np(nil,:dorian,:l=>4), np(nil,:dorian,:l=>4).reverse!.shift, n(:R)], :lim=>pclass.length do |pattern|
|
14
|
+
Zgomot.logger.info "TONIC: [#{pclass[count-1]},4], MODE: dorian"
|
15
|
+
ch << pattern.tonic!([pclass[count-1], 4])
|
16
|
+
end
|
17
|
+
|
18
|
+
#.........................................................................................................
|
19
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'chords', [ c(:C), c(:E,:min), c(:D,:min), c(:B,:dim), c(:G,:maj)], :lim=>3 do |pattern|
|
11
|
+
ch << pattern
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
m = mark
|
11
|
+
m.add([0.6, 0.4]) do
|
12
|
+
np([:A,4],:dorian,:l=>4)[7,5,3,1,]
|
13
|
+
end
|
14
|
+
m.add([0.4, 0.6]) do
|
15
|
+
np([:A,4],:ionian,:l=>4)[7,5,3,1]
|
16
|
+
end
|
17
|
+
|
18
|
+
#.........................................................................................................
|
19
|
+
str 'markov' do
|
20
|
+
ch << m.next
|
21
|
+
end
|
22
|
+
|
23
|
+
#.........................................................................................................
|
24
|
+
play
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'notes' do
|
11
|
+
ch << [n([:C,5]), n(:B), n(:R), n(:G), n(:C,:l=>2), n([:E,5],:l=>2)]
|
12
|
+
end
|
13
|
+
|
14
|
+
#.........................................................................................................
|
15
|
+
play
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'notes' do
|
11
|
+
(ch << [n([:C,5]), n(:B), n(:G), n(:C,:l=>2), n([:E,5],:l=>1)]).each do |note|
|
12
|
+
note.length = 2**(note.time.beat + 2)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
#.........................................................................................................
|
17
|
+
play
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "#{File.dirname(__FILE__)}/../lib/zgomot"
|
3
|
+
|
4
|
+
#.........................................................................................................
|
5
|
+
before_start do
|
6
|
+
Zgomot.logger.level = Logger::DEBUG
|
7
|
+
end
|
8
|
+
|
9
|
+
#.........................................................................................................
|
10
|
+
str 'notes' do
|
11
|
+
(ch << [n([:C,5]), n(:B), n(:R), n(:G), n(:C,:l=>2), n([:E,5],:l=>2)]).each do |note|
|
12
|
+
note.velocity = 0.2*note.time.beat + 0.2
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
#.........................................................................................................
|
17
|
+
play
|
data/examples/zgomot.yml
ADDED
data/lib/zgomot/boot.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
##############################################################################################################
|
2
|
+
module Zgomot
|
3
|
+
|
4
|
+
#####-------------------------------------------------------------------------------------------------------
|
5
|
+
class Boot
|
6
|
+
|
7
|
+
####......................................................................................................
|
8
|
+
class << self
|
9
|
+
|
10
|
+
#.......................................................................................................
|
11
|
+
def boot
|
12
|
+
|
13
|
+
####..............
|
14
|
+
Zgomot.logger = Logger.new(STDOUT)
|
15
|
+
Zgomot.logger.level = Logger::WARN
|
16
|
+
|
17
|
+
####..............
|
18
|
+
call_if_implemented(:call_before_start)
|
19
|
+
|
20
|
+
####..............
|
21
|
+
Zgomot.logger.info "ZGOMOT BEGINNING"
|
22
|
+
Zgomot.logger.info "APPLICATION PATH: #{Zgomot.app_path}"
|
23
|
+
Zgomot.logger.info "CONFIGURATION FILE: #{Zgomot.config_file}"
|
24
|
+
Zgomot.logger.info "CONFIGURATION: #{Zgomot.config.inspect}"
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
####....................................................................................................
|
29
|
+
# application deligate methods
|
30
|
+
#.......................................................................................................
|
31
|
+
def call_if_implemented(method, *args)
|
32
|
+
send(method, *args) if respond_to?(method)
|
33
|
+
end
|
34
|
+
|
35
|
+
#.........................................................................................................
|
36
|
+
def callbacks(*args)
|
37
|
+
args.each do |meth|
|
38
|
+
instance_eval <<-do_eval
|
39
|
+
def #{meth}(&blk)
|
40
|
+
define_meta_class_method(:call_#{meth}, &blk)
|
41
|
+
end
|
42
|
+
do_eval
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
#### self
|
47
|
+
end
|
48
|
+
|
49
|
+
#.........................................................................................................
|
50
|
+
callbacks(:before_start)
|
51
|
+
|
52
|
+
#### Boot
|
53
|
+
end
|
54
|
+
|
55
|
+
#### Zgomot
|
56
|
+
end
|