hindbaer 0.0.4 → 0.0.5
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/README.markdown +25 -23
- data/lib/hindbaer/audio_pool.rb +26 -9
- data/lib/hindbaer/clip.rb +15 -17
- data/lib/hindbaer/fade.rb +15 -9
- data/lib/hindbaer/file.rb +22 -24
- data/lib/hindbaer/group.rb +28 -13
- data/lib/hindbaer/info.rb +27 -74
- data/lib/hindbaer/marker.rb +20 -9
- data/lib/hindbaer/plugin.rb +5 -5
- data/lib/hindbaer/plugin/base.rb +21 -11
- data/lib/hindbaer/plugin/compressor.rb +11 -9
- data/lib/hindbaer/plugin/equalizer.rb +27 -53
- data/lib/hindbaer/plugin/voice_profiler.rb +31 -55
- data/lib/hindbaer/region.rb +28 -52
- data/lib/hindbaer/session.rb +47 -72
- data/lib/hindbaer/track.rb +41 -16
- data/lib/hindbaer/version.rb +1 -1
- data/spec/audio_pool_spec.rb +4 -2
- data/spec/clip_spec.rb +6 -8
- data/spec/fade_spec.rb +7 -5
- data/spec/file_spec.rb +8 -6
- data/spec/fixtures/{project.nhsx → session.nhsx} +0 -0
- data/spec/group_spec.rb +5 -7
- data/spec/info_spec.rb +6 -4
- data/spec/marker_spec.rb +5 -3
- data/spec/{plugin_base_spec.rb → plugin/base_spec.rb} +6 -4
- data/spec/region_spec.rb +10 -12
- data/spec/session_spec.rb +6 -7
- data/spec/track_spec.rb +5 -6
- metadata +20 -20
data/README.markdown
CHANGED
@@ -24,7 +24,7 @@ Parse a session file:
|
|
24
24
|
session.info.description
|
25
25
|
session.info.author
|
26
26
|
session.info.album
|
27
|
-
session.ínfo.
|
27
|
+
session.ínfo.track
|
28
28
|
session.info.keywords
|
29
29
|
# etc.
|
30
30
|
|
@@ -36,15 +36,13 @@ Render Session object as xml:
|
|
36
36
|
|
37
37
|
Retrieve all tracks:
|
38
38
|
|
39
|
-
|
40
|
-
track = tracks.first
|
39
|
+
track = session.tracks.first
|
41
40
|
track.name
|
42
|
-
track.
|
41
|
+
track.pan
|
43
42
|
|
44
43
|
Retrieve all track plugins:
|
45
44
|
|
46
|
-
|
47
|
-
plugin = plugins.first
|
45
|
+
plugin = track.plugins.first
|
48
46
|
plugin.id
|
49
47
|
plugin.name
|
50
48
|
plugin.uid
|
@@ -53,11 +51,10 @@ There is currently support for the four default plugins and their attributes.
|
|
53
51
|
|
54
52
|
Retrieve all regions for a given track:
|
55
53
|
|
56
|
-
|
57
|
-
region
|
58
|
-
region.reference # audio file reference
|
54
|
+
region = tracks.first.regions.first
|
55
|
+
region.ref # audio file reference
|
59
56
|
region.name
|
60
|
-
region.
|
57
|
+
region.start
|
61
58
|
region.length
|
62
59
|
region.offset
|
63
60
|
region.fade_in
|
@@ -67,30 +64,26 @@ Retrieve all regions for a given track:
|
|
67
64
|
|
68
65
|
Retrieve all fades for a given region:
|
69
66
|
|
70
|
-
|
71
|
-
fade
|
72
|
-
fade.start_time
|
67
|
+
fade = regions.first.fades.first
|
68
|
+
fade.start
|
73
69
|
fade.length
|
74
70
|
fade.gain
|
75
71
|
|
76
72
|
Retrieve all clipboard groups and their clips:
|
77
73
|
|
78
|
-
|
79
|
-
group = group.first
|
74
|
+
group = session.clipboard_groups.first
|
80
75
|
group.caption
|
81
|
-
group.
|
76
|
+
group.used
|
82
77
|
|
83
|
-
|
84
|
-
clip
|
85
|
-
clip.reference
|
78
|
+
clip = group.clips.first
|
79
|
+
clip.ref
|
86
80
|
clip.name
|
87
81
|
clip.length
|
88
82
|
clip.leq # (long-term equivalent level)
|
89
83
|
|
90
84
|
Retrieve all markers:
|
91
85
|
|
92
|
-
|
93
|
-
marker = markers.first
|
86
|
+
marker = session.markers.first
|
94
87
|
marker.id
|
95
88
|
marker.name
|
96
89
|
marker.time
|
@@ -105,11 +98,20 @@ Retrieve all audio file references:
|
|
105
98
|
file.id
|
106
99
|
file.name
|
107
100
|
file.duration
|
108
|
-
file.
|
101
|
+
file.channels
|
109
102
|
file.leq # (long-term equivalent level)
|
110
|
-
file.
|
103
|
+
file.dyn
|
111
104
|
file.original_path # original file path
|
112
105
|
|
106
|
+
Add a new track:
|
107
|
+
|
108
|
+
new_track = Hindbaer::Track.new do |t|
|
109
|
+
t.name = 'Foo'
|
110
|
+
t.pan = '-1'
|
111
|
+
end
|
112
|
+
session.tracks << new_track
|
113
|
+
session.to_xml
|
114
|
+
|
113
115
|
License
|
114
116
|
-------
|
115
117
|
|
data/lib/hindbaer/audio_pool.rb
CHANGED
@@ -1,20 +1,37 @@
|
|
1
1
|
module Hindbaer
|
2
2
|
class AudioPool
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
ATTRIBUTES = %w{
|
5
|
+
path location
|
6
|
+
}
|
7
|
+
|
8
|
+
attr_accessor *ATTRIBUTES
|
9
|
+
attr_accessor :files
|
7
10
|
|
8
|
-
def
|
9
|
-
|
11
|
+
def self.parse(doc)
|
12
|
+
new do
|
13
|
+
ATTRIBUTES.each do |attribute|
|
14
|
+
self.send("#{attribute.to_sym}=", doc[attribute.capitalize])
|
15
|
+
end
|
16
|
+
|
17
|
+
self.files = doc.css('File').map do |f|
|
18
|
+
Hindbaer::File.parse(f)
|
19
|
+
end
|
20
|
+
end
|
10
21
|
end
|
11
22
|
|
12
|
-
def
|
13
|
-
|
23
|
+
def initialize(&block)
|
24
|
+
self.files = []
|
25
|
+
|
26
|
+
block.arity > 0 ? block.call(self) : instance_eval(&block)
|
14
27
|
end
|
15
28
|
|
16
|
-
def
|
17
|
-
|
29
|
+
def to_xml(xml)
|
30
|
+
xml.AudioPool Path: path, Location: location do
|
31
|
+
files.each do |file|
|
32
|
+
file.to_xml(xml)
|
33
|
+
end
|
34
|
+
end
|
18
35
|
end
|
19
36
|
|
20
37
|
end
|
data/lib/hindbaer/clip.rb
CHANGED
@@ -1,29 +1,27 @@
|
|
1
1
|
module Hindbaer
|
2
2
|
class Clip
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
attr_reader :group
|
4
|
+
ATTRIBUTES = %w{
|
5
|
+
ref name length leq
|
6
|
+
}
|
7
|
+
|
8
|
+
attr_accessor *ATTRIBUTES
|
10
9
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
10
|
+
def self.parse(doc)
|
11
|
+
new do
|
12
|
+
ATTRIBUTES.each do |attribute|
|
13
|
+
self.send("#{attribute.to_sym}=", doc[attribute.capitalize])
|
14
|
+
end
|
15
|
+
end
|
14
16
|
end
|
15
17
|
|
16
|
-
def
|
17
|
-
|
18
|
+
def initialize(&block)
|
19
|
+
block.arity > 0 ? block.call(self) : instance_eval(&block)
|
18
20
|
end
|
19
21
|
|
20
|
-
def
|
21
|
-
|
22
|
+
def to_xml(xml)
|
23
|
+
xml.Clip Ref: ref, Name: name, Length: length, Leq: leq
|
22
24
|
end
|
23
25
|
|
24
|
-
def leq
|
25
|
-
return '-' if @doc['Leq'] == '-'
|
26
|
-
@doc['Leq'].to_f
|
27
|
-
end
|
28
26
|
end
|
29
27
|
end
|
data/lib/hindbaer/fade.rb
CHANGED
@@ -1,20 +1,26 @@
|
|
1
1
|
module Hindbaer
|
2
2
|
class Fade
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
ATTRIBUTES = %w{
|
5
|
+
start length gain
|
6
|
+
}
|
7
|
+
|
8
|
+
attr_accessor *ATTRIBUTES
|
7
9
|
|
8
|
-
def
|
9
|
-
|
10
|
+
def self.parse(doc)
|
11
|
+
new do
|
12
|
+
ATTRIBUTES.each do |attribute|
|
13
|
+
self.send("#{attribute.to_sym}=", doc[attribute.capitalize])
|
14
|
+
end
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
|
-
def
|
13
|
-
|
18
|
+
def initialize(&block)
|
19
|
+
block.arity > 0 ? block.call(self) : instance_eval(&block)
|
14
20
|
end
|
15
21
|
|
16
|
-
def
|
17
|
-
|
22
|
+
def to_xml(xml)
|
23
|
+
xml.Fade Start: start, Length: length, Gain: gain
|
18
24
|
end
|
19
25
|
|
20
26
|
end
|
data/lib/hindbaer/file.rb
CHANGED
@@ -1,36 +1,34 @@
|
|
1
1
|
module Hindbaer
|
2
2
|
class File
|
3
|
-
def initialize(fragment)
|
4
|
-
@doc = fragment
|
5
|
-
end
|
6
|
-
|
7
|
-
def id
|
8
|
-
@doc['Id'].to_i
|
9
|
-
end
|
10
3
|
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
ATTRIBUTES = %w{
|
5
|
+
id name duration
|
6
|
+
channels leq dyn
|
7
|
+
}
|
8
|
+
|
9
|
+
attr_accessor *ATTRIBUTES
|
10
|
+
attr_accessor :original_path
|
14
11
|
|
15
|
-
def
|
16
|
-
|
12
|
+
def self.parse(doc)
|
13
|
+
new do
|
14
|
+
ATTRIBUTES.each do |attribute|
|
15
|
+
self.send("#{attribute.to_sym}=", doc[attribute.capitalize])
|
16
|
+
end
|
17
|
+
|
18
|
+
self.original_path = doc.at_css('MetaData')['OriginalPath'] if
|
19
|
+
doc.at_css('MetaData')
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
|
-
def
|
20
|
-
|
23
|
+
def initialize(&block)
|
24
|
+
block.arity > 0 ? block.call(self) : instance_eval(&block)
|
21
25
|
end
|
22
26
|
|
23
|
-
def
|
24
|
-
|
27
|
+
def to_xml(xml)
|
28
|
+
xml.File Id: id, Name: name, Duration: duration, Channels: channels, Leq: leq do
|
29
|
+
xml.MetaData OriginalPath: original_path
|
30
|
+
end
|
25
31
|
end
|
26
32
|
|
27
|
-
def dynamics
|
28
|
-
@doc['Dyn'].to_f || 0
|
29
|
-
end
|
30
|
-
|
31
|
-
def original_path
|
32
|
-
return unless md = @doc.at_css('MetaData')
|
33
|
-
md['OriginalPath']
|
34
|
-
end
|
35
33
|
end
|
36
34
|
end
|
data/lib/hindbaer/group.rb
CHANGED
@@ -1,23 +1,38 @@
|
|
1
1
|
module Hindbaer
|
2
2
|
class Group
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
ATTRIBUTES = %w{
|
5
|
+
caption used
|
6
|
+
}
|
7
|
+
|
8
|
+
attr_accessor *ATTRIBUTES
|
9
|
+
attr_accessor :clips
|
10
|
+
|
11
|
+
def self.parse(fragment)
|
12
|
+
new do
|
13
|
+
ATTRIBUTES.each do |attribute|
|
14
|
+
self.send(
|
15
|
+
"#{attribute.to_sym}=",
|
16
|
+
fragment[attribute.split('_').map(&:capitalize).join]
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
self.clips = fragment.css('Clip').map { |c| Hindbaer::Clip.parse(c) }
|
21
|
+
end
|
7
22
|
end
|
8
23
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def num_clips_used
|
16
|
-
@doc['Used'].to_i
|
24
|
+
def initialize(&block)
|
25
|
+
self.clips = []
|
26
|
+
|
27
|
+
block.arity > 0 ? block.call(self) : instance_eval(&block)
|
17
28
|
end
|
18
29
|
|
19
|
-
def
|
20
|
-
|
30
|
+
def to_xml(xml)
|
31
|
+
xml.Group Caption: caption, Used: used do
|
32
|
+
clips.each do |clip|
|
33
|
+
clip.to_xml(xml)
|
34
|
+
end
|
35
|
+
end
|
21
36
|
end
|
22
37
|
|
23
38
|
end
|
data/lib/hindbaer/info.rb
CHANGED
@@ -1,80 +1,33 @@
|
|
1
1
|
module Hindbaer
|
2
2
|
class Info
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
def description
|
33
|
-
@doc['Description']
|
34
|
-
end
|
35
|
-
|
36
|
-
def album
|
37
|
-
@doc['Album']
|
38
|
-
end
|
39
|
-
|
40
|
-
def album_track
|
41
|
-
@doc['Track']
|
42
|
-
end
|
43
|
-
|
44
|
-
def artist
|
45
|
-
@doc['Artist']
|
46
|
-
end
|
47
|
-
|
48
|
-
def composer
|
49
|
-
@doc['Composer']
|
50
|
-
end
|
51
|
-
|
52
|
-
def date
|
53
|
-
@doc['Date']
|
54
|
-
end
|
55
|
-
|
56
|
-
def genre
|
57
|
-
@doc['Genre']
|
58
|
-
end
|
59
|
-
|
60
|
-
def copyright
|
61
|
-
@doc['Copyright']
|
62
|
-
end
|
63
|
-
|
64
|
-
def explicit?
|
65
|
-
@doc['Explicit'] == 'Yes'
|
66
|
-
end
|
67
|
-
|
68
|
-
def keywords
|
69
|
-
@doc['Keywords'].split(',').map { |k| k.strip }
|
70
|
-
end
|
71
|
-
|
72
|
-
def identifier
|
73
|
-
@doc['Identifier']
|
74
|
-
end
|
75
|
-
|
76
|
-
def reference
|
77
|
-
@doc['Reference']
|
4
|
+
ATTRIBUTES = %w{
|
5
|
+
name title subtitle author link email
|
6
|
+
description album track artist composer
|
7
|
+
date genre copyright explicit keywords
|
8
|
+
identifier reference
|
9
|
+
}
|
10
|
+
|
11
|
+
attr_accessor *ATTRIBUTES
|
12
|
+
|
13
|
+
def self.parse(fragment)
|
14
|
+
new do
|
15
|
+
ATTRIBUTES.each do |attribute|
|
16
|
+
self.send("#{attribute.to_sym}=", fragment[attribute.capitalize])
|
17
|
+
end
|
18
|
+
|
19
|
+
self.keywords = keywords.split(',').map &:strip
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(&block)
|
24
|
+
self.keywords = []
|
25
|
+
|
26
|
+
block.arity > 0 ? block.call(self) : instance_eval(&block)
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_xml(xml)
|
30
|
+
xml.Info Subtitle: subtitle, Album: album, Composer: composer, Track: track, Genre: genre, Author: author, Link: link, Email: email, Description: description, Artist: artist, Date: date, Title: title, Explicit: explicit, Copyright: copyright, Identifier: identifier, Keywords: keywords.join(', '), Reference: reference
|
78
31
|
end
|
79
32
|
|
80
33
|
end
|