midilib 2.0.2 → 2.0.4
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/Credits +5 -0
- data/README.rdoc +35 -30
- data/examples/reader2text.rb +1 -0
- data/html/IO.html +259 -0
- data/html/MIDI.html +665 -0
- data/html/MIDI/ActiveSense.html +295 -0
- data/html/MIDI/ChannelEvent.html +319 -0
- data/html/MIDI/ChannelPressure.html +350 -0
- data/html/MIDI/Clock.html +295 -0
- data/html/MIDI/Continue.html +295 -0
- data/html/MIDI/Controller.html +365 -0
- data/html/MIDI/Event.html +573 -0
- data/html/MIDI/IO.html +207 -0
- data/html/MIDI/IO/MIDIFile.html +1996 -0
- data/html/MIDI/IO/SeqReader.html +946 -0
- data/html/MIDI/IO/SeqWriter.html +648 -0
- data/html/MIDI/KeySig.html +435 -0
- data/html/MIDI/MIDI.html +204 -0
- data/html/MIDI/MIDI/MIDI.html +204 -0
- data/html/MIDI/MIDI/MIDI/Array.html +353 -0
- data/html/MIDI/Marker.html +257 -0
- data/html/MIDI/Measure.html +423 -0
- data/html/MIDI/Measures.html +375 -0
- data/html/MIDI/MetaEvent.html +534 -0
- data/html/MIDI/NoteEvent.html +417 -0
- data/html/MIDI/NoteOff.html +316 -0
- data/html/MIDI/NoteOn.html +316 -0
- data/html/MIDI/PitchBend.html +351 -0
- data/html/MIDI/PolyPressure.html +360 -0
- data/html/MIDI/ProgramChange.html +350 -0
- data/html/MIDI/Realtime.html +328 -0
- data/html/MIDI/Sequence.html +961 -0
- data/html/MIDI/SongPointer.html +351 -0
- data/html/MIDI/SongSelect.html +350 -0
- data/html/MIDI/Start.html +295 -0
- data/html/MIDI/Stop.html +295 -0
- data/html/MIDI/SystemCommon.html +257 -0
- data/html/MIDI/SystemExclusive.html +353 -0
- data/html/MIDI/SystemReset.html +295 -0
- data/html/MIDI/Tempo.html +474 -0
- data/html/MIDI/TimeSig.html +467 -0
- data/html/MIDI/Track.html +769 -0
- data/html/MIDI/TuneRequest.html +328 -0
- data/html/MIDI/Utils.html +320 -0
- data/html/README_rdoc.html +751 -0
- data/html/TODO_rdoc.html +200 -0
- data/html/created.rid +14 -0
- data/html/images/add.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +750 -0
- data/html/js/darkfish.js +153 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +94 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +543 -0
- data/html/table_of_contents.html +652 -0
- data/lib/midilib/info.rb +1 -1
- data/lib/midilib/io/seqreader.rb +1 -1
- data/lib/midilib/sequence.rb +7 -0
- data/test/test_sequence.rb +11 -0
- metadata +80 -3
data/lib/midilib/info.rb
CHANGED
data/lib/midilib/io/seqreader.rb
CHANGED
data/lib/midilib/sequence.rb
CHANGED
@@ -75,6 +75,13 @@ class Sequence
|
|
75
75
|
alias_method :bpm, :beats_per_minute
|
76
76
|
alias_method :tempo, :beats_per_minute
|
77
77
|
|
78
|
+
# Pulses (also called ticks) are the units of delta times and event
|
79
|
+
# time_from_start values. This method converts a number of pulses to a
|
80
|
+
# float value that is a time in seconds.
|
81
|
+
def pulses_to_seconds(pulses)
|
82
|
+
(pulses.to_f / @ppqn.to_f / beats_per_minute()) * 60.0
|
83
|
+
end
|
84
|
+
|
78
85
|
# Given a note length name like "whole", "dotted quarter", or "8th
|
79
86
|
# triplet", return the length of that note in quarter notes as a delta
|
80
87
|
# time.
|
data/test/test_sequence.rb
CHANGED
@@ -23,6 +23,17 @@ class SequenceTester < Test::Unit::TestCase
|
|
23
23
|
assert_equal(MIDI::Sequence::DEFAULT_TEMPO, @seq.bpm)
|
24
24
|
end
|
25
25
|
|
26
|
+
def test_pulses_to_seconds
|
27
|
+
# At a tempo of 120 BPM 480 pulses (one quarter note) should take 0.5 seconds
|
28
|
+
assert_in_delta 0.5, @seq.pulses_to_seconds(480), 0.00001
|
29
|
+
|
30
|
+
# A half note should take one second
|
31
|
+
assert_in_delta 1.0, @seq.pulses_to_seconds(480*2), 0.00001
|
32
|
+
|
33
|
+
# An eight note should take 0.25 seconds
|
34
|
+
assert_in_delta 0.25, @seq.pulses_to_seconds(480/2), 0.00001
|
35
|
+
end
|
36
|
+
|
26
37
|
def test_length_to_delta
|
27
38
|
assert_equal(480, @seq.ppqn)
|
28
39
|
assert_equal(480, @seq.length_to_delta(1))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: midilib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'midilib is a pure Ruby MIDI library useful for reading and
|
15
15
|
|
@@ -38,6 +38,83 @@ files:
|
|
38
38
|
- examples/split.rb
|
39
39
|
- examples/strings.rb
|
40
40
|
- examples/transpose.rb
|
41
|
+
- html/created.rid
|
42
|
+
- html/images/add.png
|
43
|
+
- html/images/brick.png
|
44
|
+
- html/images/brick_link.png
|
45
|
+
- html/images/bug.png
|
46
|
+
- html/images/bullet_black.png
|
47
|
+
- html/images/bullet_toggle_minus.png
|
48
|
+
- html/images/bullet_toggle_plus.png
|
49
|
+
- html/images/date.png
|
50
|
+
- html/images/delete.png
|
51
|
+
- html/images/find.png
|
52
|
+
- html/images/loadingAnimation.gif
|
53
|
+
- html/images/macFFBgHack.png
|
54
|
+
- html/images/package.png
|
55
|
+
- html/images/page_green.png
|
56
|
+
- html/images/page_white_text.png
|
57
|
+
- html/images/page_white_width.png
|
58
|
+
- html/images/plugin.png
|
59
|
+
- html/images/ruby.png
|
60
|
+
- html/images/tag_blue.png
|
61
|
+
- html/images/tag_green.png
|
62
|
+
- html/images/transparent.png
|
63
|
+
- html/images/wrench.png
|
64
|
+
- html/images/wrench_orange.png
|
65
|
+
- html/images/zoom.png
|
66
|
+
- html/index.html
|
67
|
+
- html/IO.html
|
68
|
+
- html/js/darkfish.js
|
69
|
+
- html/js/jquery.js
|
70
|
+
- html/js/navigation.js
|
71
|
+
- html/js/search.js
|
72
|
+
- html/js/search_index.js
|
73
|
+
- html/js/searcher.js
|
74
|
+
- html/MIDI/ActiveSense.html
|
75
|
+
- html/MIDI/ChannelEvent.html
|
76
|
+
- html/MIDI/ChannelPressure.html
|
77
|
+
- html/MIDI/Clock.html
|
78
|
+
- html/MIDI/Continue.html
|
79
|
+
- html/MIDI/Controller.html
|
80
|
+
- html/MIDI/Event.html
|
81
|
+
- html/MIDI/IO/MIDIFile.html
|
82
|
+
- html/MIDI/IO/SeqReader.html
|
83
|
+
- html/MIDI/IO/SeqWriter.html
|
84
|
+
- html/MIDI/IO.html
|
85
|
+
- html/MIDI/KeySig.html
|
86
|
+
- html/MIDI/Marker.html
|
87
|
+
- html/MIDI/Measure.html
|
88
|
+
- html/MIDI/Measures.html
|
89
|
+
- html/MIDI/MetaEvent.html
|
90
|
+
- html/MIDI/MIDI/MIDI/Array.html
|
91
|
+
- html/MIDI/MIDI/MIDI.html
|
92
|
+
- html/MIDI/MIDI.html
|
93
|
+
- html/MIDI/NoteEvent.html
|
94
|
+
- html/MIDI/NoteOff.html
|
95
|
+
- html/MIDI/NoteOn.html
|
96
|
+
- html/MIDI/PitchBend.html
|
97
|
+
- html/MIDI/PolyPressure.html
|
98
|
+
- html/MIDI/ProgramChange.html
|
99
|
+
- html/MIDI/Realtime.html
|
100
|
+
- html/MIDI/Sequence.html
|
101
|
+
- html/MIDI/SongPointer.html
|
102
|
+
- html/MIDI/SongSelect.html
|
103
|
+
- html/MIDI/Start.html
|
104
|
+
- html/MIDI/Stop.html
|
105
|
+
- html/MIDI/SystemCommon.html
|
106
|
+
- html/MIDI/SystemExclusive.html
|
107
|
+
- html/MIDI/SystemReset.html
|
108
|
+
- html/MIDI/Tempo.html
|
109
|
+
- html/MIDI/TimeSig.html
|
110
|
+
- html/MIDI/Track.html
|
111
|
+
- html/MIDI/TuneRequest.html
|
112
|
+
- html/MIDI/Utils.html
|
113
|
+
- html/MIDI.html
|
114
|
+
- html/rdoc.css
|
115
|
+
- html/README_rdoc.html
|
116
|
+
- html/table_of_contents.html
|
117
|
+
- html/TODO_rdoc.html
|
41
118
|
- install.rb
|
42
119
|
- lib/midilib/consts.rb
|
43
120
|
- lib/midilib/event.rb
|
@@ -81,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
158
|
requirements:
|
82
159
|
- none
|
83
160
|
rubyforge_project: midilib
|
84
|
-
rubygems_version: 1.8.
|
161
|
+
rubygems_version: 1.8.12
|
85
162
|
signing_key:
|
86
163
|
specification_version: 3
|
87
164
|
summary: MIDI file and event manipulation library
|