rubygems-sing 1.0.0 → 1.1.0
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.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -0
- data/lib/rubygems/commands/sing_command.rb +24 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -3,12 +3,13 @@ require 'rubygems/version_option'
|
|
3
3
|
require 'rubygems/text'
|
4
4
|
|
5
5
|
require 'midiator'
|
6
|
+
require 'English'
|
6
7
|
|
7
8
|
##
|
8
9
|
# gem command to "sing" the implementation of a gem.
|
9
10
|
|
10
11
|
class Gem::Commands::SingCommand < Gem::Command
|
11
|
-
VERSION = '1.
|
12
|
+
VERSION = '1.1.0'
|
12
13
|
|
13
14
|
include MIDIator::Notes
|
14
15
|
include MIDIator::Drums
|
@@ -56,8 +57,10 @@ class Gem::Commands::SingCommand < Gem::Command
|
|
56
57
|
midi = MIDIator::Interface.new
|
57
58
|
midi.use :dls_synth
|
58
59
|
|
59
|
-
|
60
|
-
|
60
|
+
# blues scale
|
61
|
+
scale = [ C4, Eb4, F4, Fs4, G4, Bb4,
|
62
|
+
C5, Eb5, F5, Fs5, G5, Bb5,
|
63
|
+
C6, Eb6, F6, Fs6, G6, Bb6 ]
|
61
64
|
|
62
65
|
midi.control_change 32, 10, 1 # TR-808 is Program 26 in LSB bank 1
|
63
66
|
midi.program_change 10, 26
|
@@ -67,10 +70,27 @@ class Gem::Commands::SingCommand < Gem::Command
|
|
67
70
|
spec.lib_files.each do |path|
|
68
71
|
full_path = File.join base, path
|
69
72
|
warn path
|
73
|
+
|
74
|
+
line_number_of_last_end = 0
|
70
75
|
File.foreach(full_path) do |line|
|
71
76
|
if line =~ /^(\s+)end$/ then
|
77
|
+
number_of_lines_in_block = $INPUT_LINE_NUMBER - line_number_of_last_end
|
78
|
+
duration = case number_of_lines_in_block
|
79
|
+
when 0 .. 3
|
80
|
+
0.1
|
81
|
+
when 4 .. 10
|
82
|
+
0.25
|
83
|
+
when 11 .. 30
|
84
|
+
0.5
|
85
|
+
else
|
86
|
+
1.0
|
87
|
+
end
|
88
|
+
|
89
|
+
duration *= 0.8 # tweaking for now...
|
90
|
+
|
91
|
+
line_number_of_last_end = $INPUT_LINE_NUMBER
|
72
92
|
num_spaces = $1.size
|
73
|
-
midi.play scale[ num_spaces / 2 ]
|
93
|
+
midi.play scale[ num_spaces / 2 ], duration
|
74
94
|
print line
|
75
95
|
end
|
76
96
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubygems-sing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
FBHgymkyj/AOSqKRIpXPhjC6
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2010-01-
|
33
|
+
date: 2010-01-26 00:00:00 -08:00
|
34
34
|
default_executable:
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|