diarize-ruby 0.3.0 → 0.3.1
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.
- checksums.yaml +4 -4
- data/AUTHORS +1 -2
- data/CHANGELOG.md +10 -0
- data/README.md +31 -23
- data/{lib/diarize → bin}/LIUM_SpkDiarization-4.2.jar +0 -0
- data/diarize-ruby.gemspec +2 -0
- data/lib/diarize.rb +2 -1
- data/lib/diarize/audio_player.rb +13 -15
- data/lib/diarize/segment.rb +2 -2
- data/lib/diarize/version.rb +1 -1
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fea2a948f5ae15b922bf1911df35c3bdfb24b5f3
|
4
|
+
data.tar.gz: ff9da8967f4f5b9692669c677833fe449154fa18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42de27a42610a7c04409f04d56d2b124eed8fa0418843516701c1cb18092ed4fe05aa1fee015d2019438443fa7c016b10fc51391bcfb7d99c1bdab28f8cb514d
|
7
|
+
data.tar.gz: cdf8c7a4e935db59c4b3a678c56e0b18e9be41f906583d939e86feb596f62847905b5c6a766575108bf7be973661e1a3b6e56b16ee754a37e69d9073f36d4c83
|
data/AUTHORS
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
## [v0.3.1] - 2016-11-08
|
2
|
+
|
3
|
+
- Fixed README and examples
|
4
|
+
- First round to fix audio playback
|
5
|
+
- Move LIUM jar into bin folder
|
6
|
+
- Use `DIARIZE_RUBY_RJB_LOAD_PATH` env variable for alternative loading
|
7
|
+
|
8
|
+
## [v0.3.0] - 2016-11-08
|
9
|
+
|
10
|
+
- Pushed first version of v0.3.0 to rubygems.org
|
data/README.md
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
# diarize-ruby
|
2
2
|
|
3
|
-
This library provides an easy-to-use toolkit for speaker
|
4
|
-
segmentation (diarization) and identification from audio.
|
3
|
+
This library provides an easy-to-use toolkit for speaker segmentation (diarization) and identification from audio.
|
5
4
|
|
6
|
-
This library
|
7
|
-
archive prototype.
|
5
|
+
This library was adopted from [diarize-jruby](https://github.com/bbc/diarize-jruby), being used within the BBC R&D World Service.
|
8
6
|
|
9
|
-
|
10
|
-
an example.
|
7
|
+
The main reason from deviating from the original library is to have a universal gem that works with either Ruby interpreter. It uses [Ruby Java Bridge](http://rjb.rubyforge.org) instead of [JRuby](http://jruby.org).
|
11
8
|
|
9
|
+
Work to be done:
|
12
10
|
|
13
|
-
|
11
|
+
* Universal gem that works on JRuby and various Ruby implementations (MRI) and versions
|
12
|
+
* Use performant math packages tuned to either Ruby implementation
|
13
|
+
* Add support for alternative diarization tools
|
14
|
+
* Add CI tool
|
15
|
+
|
16
|
+
## Speaker Diarization
|
14
17
|
|
15
18
|
This library gives acccess to the algorithm developed by the LIUM
|
16
19
|
for the ESTER 2 evaluation campaign and described in [Meigner2010].
|
17
20
|
|
18
|
-
It wraps a binary JAR file compiled from
|
19
|
-
http://lium3.univ-lemans.fr/diarization/doku.php/welcome.
|
20
|
-
|
21
|
+
It wraps a binary JAR file compiled from [LIUM](http://lium3.univ-lemans.fr/diarization/doku.php/welcome).
|
21
22
|
|
22
|
-
## Speaker
|
23
|
+
## Speaker Identification
|
23
24
|
|
24
25
|
This library also implements an algorithm for speaker identification
|
25
26
|
based on the comparison of normalised speaker models, which can be
|
@@ -36,14 +37,24 @@ It also includes support for speaker supervectors [Campbell2006], which
|
|
36
37
|
can be used in combination with our ruby-lsh library for fast speaker
|
37
38
|
identification.
|
38
39
|
|
40
|
+
## Install
|
41
|
+
|
42
|
+
$ bundle install
|
43
|
+
|
44
|
+
Note: To make audio playback work with [Audio Playback](https://github.com/arirusso/audio-playback), you should install the following native libraries (homebrew):
|
45
|
+
|
46
|
+
brew install libffi
|
47
|
+
brew install portaudio
|
39
48
|
|
40
|
-
|
49
|
+
If you are using a different version of LIUM than what is bundled in the `bin` folder, you can do so by setting an environment variable.
|
41
50
|
|
42
|
-
$
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
51
|
+
$ export DIARIZE_RUBY_RJB_LOAD_PATH=<path-to-LIUM-jar-file>
|
52
|
+
|
53
|
+
## Examples
|
54
|
+
|
55
|
+
$ irb -I lib
|
56
|
+
> require "diarize"
|
57
|
+
> audio = Diarize::Audio.new URI.join('file:///', File.join(File.expand_path(File.dirname(__FILE__)), "test", "data", "will-and-juergen.wav"))
|
47
58
|
> audio.analyze!
|
48
59
|
> audio.segments
|
49
60
|
> audio.speakers
|
@@ -55,7 +66,7 @@ identification.
|
|
55
66
|
> audio.segments_by_speaker(speakers.first)[0].play
|
56
67
|
> audio.segments_by_speaker(speakers.first)[1].play
|
57
68
|
> ...
|
58
|
-
> speakers
|
69
|
+
> speakers ||= other_speakers
|
59
70
|
> Diarize::Speaker.match(speakers)
|
60
71
|
|
61
72
|
|
@@ -63,7 +74,6 @@ identification.
|
|
63
74
|
|
64
75
|
$ rake
|
65
76
|
|
66
|
-
|
67
77
|
## References
|
68
78
|
|
69
79
|
[Meigner2010] S. Meignier and T. Merlin, "LIUM SpkDiarization:
|
@@ -86,8 +96,7 @@ Proceedings of INTERSPEECH, 2005
|
|
86
96
|
"Support vector machines using GMM supervectors for speaker verification",
|
87
97
|
IEEE Signal Processing Letters, 2006, 13, 308-311
|
88
98
|
|
89
|
-
|
90
|
-
## Licensing terms and authorship
|
99
|
+
## License
|
91
100
|
|
92
101
|
See 'LICENSE' and 'AUTHORS' files.
|
93
102
|
|
@@ -101,9 +110,8 @@ is licensed under the GNU General Public License version 2. See
|
|
101
110
|
http://lium3.univ-lemans.fr/diarization/doku.php/licence for more
|
102
111
|
information.
|
103
112
|
|
104
|
-
|
105
113
|
## Developer Resources
|
106
114
|
|
107
115
|
* [Connecting Ruby to Java and vice versa](http://nofail.de/2010/04/ruby-in-java-java-in-ruby-jruby-or-ruby-java-bridge/)
|
108
116
|
* [LIUM scripts](https://github.com/StevenLOL/LIUM/blob/master/ilp_diarization2.sh)
|
109
|
-
* [Speaker Identification for the whole World Service Archive](http://www.bbc.co.uk/rd/blog/2014-01-speaker-identification-for-the-whole-world-service-archive)
|
117
|
+
* [Speaker Identification for the whole World Service Archive](http://www.bbc.co.uk/rd/blog/2014-01-speaker-identification-for-the-whole-world-service-archive)
|
File without changes
|
data/diarize-ruby.gemspec
CHANGED
@@ -24,8 +24,10 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "test-unit", "~> 3.0"
|
25
25
|
spec.add_development_dependency "mocha", "~> 1.1"
|
26
26
|
spec.add_development_dependency "webmock", "~> 2.1"
|
27
|
+
spec.add_development_dependency "byebug", "~> 9.0"
|
27
28
|
|
28
29
|
spec.add_dependency "rjb", "~> 1.5"
|
29
30
|
spec.add_dependency "to-rdf", "~> 0"
|
30
31
|
spec.add_dependency "jblas-ruby", "~> 1.1"
|
32
|
+
spec.add_dependency "audio-playback"
|
31
33
|
end
|
data/lib/diarize.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require "rjb"
|
2
2
|
|
3
|
-
RJB_LOAD_PATH = [File.join(File.expand_path(File.dirname(__FILE__)), '
|
3
|
+
RJB_LOAD_PATH = [ENV.fetch('DIARIZE_RUBY_RJB_LOAD_PATH', File.join(File.expand_path('..', File.dirname(__FILE__)), 'bin', 'LIUM_SpkDiarization-4.2.jar'))].join(File::PATH_SEPARATOR)
|
4
4
|
RJB_OPTIONS = ['-Xms16m', '-Xmx1024m']
|
5
5
|
|
6
6
|
Rjb::load(RJB_LOAD_PATH, RJB_OPTIONS)
|
7
7
|
|
8
8
|
require "matrix"
|
9
|
+
require "audio-playback"
|
9
10
|
require "diarize/version"
|
10
11
|
require "diarize/lium"
|
11
12
|
require "diarize/audio"
|
data/lib/diarize/audio_player.rb
CHANGED
@@ -2,21 +2,19 @@ module Diarize
|
|
2
2
|
|
3
3
|
class AudioPlayer
|
4
4
|
|
5
|
-
def play(file,
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
clip.close
|
19
|
-
stream.close
|
5
|
+
def play(file, options = {})
|
6
|
+
output = AudioPlayback::Device::Output.by_id(1) rescue nil
|
7
|
+
defaults = {
|
8
|
+
:channels => [0, 1],
|
9
|
+
:latency => 1,
|
10
|
+
:output_device => output,
|
11
|
+
:buffer_size => 4048
|
12
|
+
}
|
13
|
+
options, stream = defaults.merge(options), nil
|
14
|
+
playback = AudioPlayback.play(file.path, options)
|
15
|
+
stream ||= playback.stream
|
16
|
+
stream.start
|
17
|
+
stream.block
|
20
18
|
end
|
21
19
|
|
22
20
|
end
|
data/lib/diarize/segment.rb
CHANGED
@@ -23,9 +23,9 @@ module Diarize
|
|
23
23
|
Speaker.find_or_create(URI("#{@audio.base_uri}##{@speaker_id}"), @speaker_gender)
|
24
24
|
end
|
25
25
|
|
26
|
-
def play
|
26
|
+
def play(options = {})
|
27
27
|
player = AudioPlayer.new
|
28
|
-
player.play(@audio.file, start, duration)
|
28
|
+
player.play(@audio.file, options.merge({:start => start, :duration => duration}))
|
29
29
|
end
|
30
30
|
|
31
31
|
include ToRdf
|
data/lib/diarize/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diarize-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Raimond
|
@@ -53,6 +53,20 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '2.1'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: byebug
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '9.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '9.0'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
71
|
name: rjb
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +109,20 @@ dependencies:
|
|
95
109
|
- - "~>"
|
96
110
|
- !ruby/object:Gem::Version
|
97
111
|
version: '1.1'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: audio-playback
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
98
126
|
description: A library for Ruby wrapping the LIUM Speaker Diarization and including
|
99
127
|
a few extra tools
|
100
128
|
email:
|
@@ -107,13 +135,14 @@ files:
|
|
107
135
|
- ".ruby-gemset"
|
108
136
|
- ".ruby-version"
|
109
137
|
- AUTHORS
|
138
|
+
- CHANGELOG.md
|
110
139
|
- Gemfile
|
111
140
|
- LICENSE
|
112
141
|
- README.md
|
113
142
|
- Rakefile
|
143
|
+
- bin/LIUM_SpkDiarization-4.2.jar
|
114
144
|
- diarize-ruby.gemspec
|
115
145
|
- lib/diarize.rb
|
116
|
-
- lib/diarize/LIUM_SpkDiarization-4.2.jar
|
117
146
|
- lib/diarize/audio.rb
|
118
147
|
- lib/diarize/audio_player.rb
|
119
148
|
- lib/diarize/lium.rb
|