midilib 0.8.5 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +10 -0
- data/Credits +5 -0
- data/README +13 -5
- data/examples/split.rb +52 -0
- data/lib/midilib/event.rb +1 -1
- data/lib/midilib/info.rb +2 -2
- metadata +51 -44
data/ChangeLog
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
2006-08-20 Jim Menard <jimm@io.com>
|
2
|
+
|
3
|
+
* lib/midilib/event.rb (PolyPressure::initialize): Fixed the
|
4
|
+
misspelled POLY_PRESSURE cosntant, thanks to Mario Pehle
|
5
|
+
<rubyforge.org@errorinitus.de>.
|
6
|
+
|
7
|
+
2006-05-15 Jim Menard <jimm@localhost.localdomain>
|
8
|
+
|
9
|
+
* test/test.mid: created (copied examples/from_scratch.mid).
|
10
|
+
|
1
11
|
2005-03-21 Jim Menard <jimm@io.com>
|
2
12
|
|
3
13
|
* Version 0.8.4 released.
|
data/Credits
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
midilib is developed by Jim Menard, jimm@io.com. Additional bug fixes and
|
2
2
|
suggestions have come from:
|
3
3
|
|
4
|
+
Mario Pehle <rubyforge.org@errorinitus.de>
|
5
|
+
|
6
|
+
Noticed that the PolyPressure class used the misspelled constant
|
7
|
+
POLY_PRESSSURE.
|
8
|
+
|
4
9
|
Mike Hall <m3ha11@rcn.com>
|
5
10
|
|
6
11
|
Found errors in example scripts' $LOAD_PATH and a bug in sequence reading
|
data/README
CHANGED
@@ -12,6 +12,14 @@ version of midilib may be downloaded. midilib is also available as a RubyGem.
|
|
12
12
|
|
13
13
|
=== Recent Changes
|
14
14
|
|
15
|
+
==== Changes for 0.8.7:
|
16
|
+
|
17
|
+
* Fixed the misspelled POLY_PRESSURE constant, thanks to Mario Pehle.
|
18
|
+
|
19
|
+
==== Changes for 0.8.6:
|
20
|
+
|
21
|
+
* Added missing test/test.mid.
|
22
|
+
|
15
23
|
==== Changes for 0.8.5:
|
16
24
|
|
17
25
|
* Fixed bugs in MIDI::PitchBend reading and writing, thanks to Emanuel
|
@@ -320,11 +328,11 @@ introduction to Ruby, the Ruby Application Archive (RAA) at
|
|
320
328
|
http://raa.ruby-lang.org, and pointers to more information.
|
321
329
|
|
322
330
|
|
323
|
-
<
|
324
|
-
and Andrew Hunt, is a well-written and practical introduction to Ruby.
|
325
|
-
page at http://www.rubycentral.com/book also contains a wealth of Ruby
|
326
|
-
information. Though the book is available online, I encourage
|
327
|
-
a copy.
|
331
|
+
<cite>Programming Ruby, The Pragmatic Programmer's Guide</cite>, by David
|
332
|
+
Thomas and Andrew Hunt, is a well-written and practical introduction to Ruby.
|
333
|
+
Its Web page at http://www.rubycentral.com/book also contains a wealth of Ruby
|
334
|
+
information. Though the first edition book is available online, I encourage
|
335
|
+
you to purchase a copy of the latest edition.
|
328
336
|
|
329
337
|
A description of the MIDI file format can be found in a few places such as
|
330
338
|
http://www.borg.com/~jglatt/tech/midifile.htm.
|
data/examples/split.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# usage: split.rb [-x] [midi_file]
|
4
|
+
#
|
5
|
+
# This script splits a MIDI file into muliple files, one for each track. The
|
6
|
+
# output files are named with the track's names. Each file contains a copy of
|
7
|
+
# the 0th track, which contains tempo information.
|
8
|
+
#
|
9
|
+
# If -x is specified, the 0th temp track is not included in each file.
|
10
|
+
# Instead, it is output in a separate file named 'tempo_track.mid'.
|
11
|
+
|
12
|
+
# Start looking for MIDI module classes in the directory above this one.
|
13
|
+
# This forces us to use the local copy, even if there is a previously
|
14
|
+
# installed version out there somewhere.
|
15
|
+
$LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
16
|
+
|
17
|
+
require 'midilib/sequence'
|
18
|
+
|
19
|
+
DEFAULT_MIDI_TEST_FILE = 'NoFences.mid'
|
20
|
+
|
21
|
+
# Command line argument processing
|
22
|
+
filename = ARGV[0]
|
23
|
+
include_tempo_track = true
|
24
|
+
if filename == '-x'
|
25
|
+
include_tempo_track = false
|
26
|
+
filename = ARGV[1]
|
27
|
+
end
|
28
|
+
|
29
|
+
# Read from MIDI file
|
30
|
+
seq = MIDI::Sequence.new()
|
31
|
+
|
32
|
+
File.open(filename || DEFAULT_MIDI_TEST_FILE, 'rb') { | file |
|
33
|
+
# The block we pass in to Sequence.read is called at the end of every
|
34
|
+
# track read. It is optional, but is useful for progress reports.
|
35
|
+
seq.read(file) { | track, num_tracks, i |
|
36
|
+
puts "read track #{track ? track.name : ''} (#{i} of #{num_tracks})"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
t0 = seq.tracks[0]
|
41
|
+
unless include_tempo_track
|
42
|
+
s = MIDI::Sequence.new
|
43
|
+
s.tracks << t0
|
44
|
+
File.open("tempo_track.mid", 'wb') { | file | s.write(file) }
|
45
|
+
end
|
46
|
+
seq.each_with_index { | track, i |
|
47
|
+
next unless i > 0
|
48
|
+
s = MIDI::Sequence.new
|
49
|
+
s.tracks << t0 if include_tempo_track
|
50
|
+
s.tracks << track
|
51
|
+
File.open("#{track.name}.mid", 'wb') { | file | s.write(file) }
|
52
|
+
}
|
data/lib/midilib/event.rb
CHANGED
@@ -192,7 +192,7 @@ end
|
|
192
192
|
|
193
193
|
class PolyPressure < NoteEvent
|
194
194
|
def initialize(channel = 0, note = 64, value = 0, delta_time = 0)
|
195
|
-
super(
|
195
|
+
super(POLY_PRESSURE, channel, note, value, delta_time)
|
196
196
|
end
|
197
197
|
|
198
198
|
def pressure
|
data/lib/midilib/info.rb
CHANGED
@@ -2,8 +2,8 @@ module MIDI
|
|
2
2
|
|
3
3
|
VERSION_MAJOR = 0
|
4
4
|
VERSION_MINOR = 8
|
5
|
-
VERSION_TWEAK =
|
5
|
+
VERSION_TWEAK = 7
|
6
6
|
Version = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_TWEAK}"
|
7
|
-
Copyright = 'Copyright (c) 2003-
|
7
|
+
Copyright = 'Copyright (c) 2003-2006 by Jim Menard <jimm@io.com>'
|
8
8
|
|
9
9
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.1
|
3
3
|
specification_version: 1
|
4
4
|
name: midilib
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.8.
|
7
|
-
date:
|
6
|
+
version: 0.8.7
|
7
|
+
date: 2007-02-18 00:00:00 -05:00
|
8
8
|
summary: MIDI file and event manipulation library
|
9
9
|
require_paths:
|
10
|
-
|
10
|
+
- lib
|
11
11
|
email: jimm@io.com
|
12
12
|
homepage: http://midilib.rubyforge.org
|
13
13
|
rubyforge_project: midilib
|
@@ -18,53 +18,60 @@ bindir: bin
|
|
18
18
|
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
version: 0.0.0
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
25
24
|
version:
|
26
25
|
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
27
29
|
authors:
|
28
|
-
|
30
|
+
- Jim Menard
|
29
31
|
files:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
32
|
+
- ChangeLog
|
33
|
+
- Credits
|
34
|
+
- README
|
35
|
+
- Rakefile
|
36
|
+
- TODO
|
37
|
+
- examples/from_scratch.mid
|
38
|
+
- examples/from_scratch.rb
|
39
|
+
- examples/NoFences.mid
|
40
|
+
- examples/reader2text.rb
|
41
|
+
- examples/seq2text.rb
|
42
|
+
- examples/split.rb
|
43
|
+
- examples/strings.rb
|
44
|
+
- examples/transpose.rb
|
45
|
+
- install.rb
|
46
|
+
- lib/midilib.rb
|
47
|
+
- lib/midilib/consts.rb
|
48
|
+
- lib/midilib/event.rb
|
49
|
+
- lib/midilib/info.rb
|
50
|
+
- lib/midilib/sequence.rb
|
51
|
+
- lib/midilib/track.rb
|
52
|
+
- lib/midilib/utils.rb
|
53
|
+
- lib/midilib/io/midifile.rb
|
54
|
+
- lib/midilib/io/seqreader.rb
|
55
|
+
- lib/midilib/io/seqwriter.rb
|
56
|
+
- test/event_equality.rb
|
57
|
+
- test/test_event.rb
|
58
|
+
- test/test_io.rb
|
59
|
+
- test/test_sequence.rb
|
60
|
+
- test/test_track.rb
|
61
|
+
- test/test_varlen.rb
|
59
62
|
test_files: []
|
63
|
+
|
60
64
|
rdoc_options:
|
61
|
-
|
62
|
-
|
65
|
+
- --main
|
66
|
+
- README
|
63
67
|
extra_rdoc_files:
|
64
|
-
|
65
|
-
|
68
|
+
- README
|
69
|
+
- TODO
|
66
70
|
executables: []
|
71
|
+
|
67
72
|
extensions: []
|
73
|
+
|
68
74
|
requirements:
|
69
|
-
|
70
|
-
dependencies: []
|
75
|
+
- none
|
76
|
+
dependencies: []
|
77
|
+
|