plant-sirens 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -24
- data/VERSION +1 -1
- data/ext/sirens/sirens.cpp +22 -2
- data/sirens.gemspec +2 -2
- metadata +2 -2
data/README.markdown
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# sirens-ruby
|
2
|
-
sirens-ruby is a ruby extension for [Sirens](http://github.com/plant/sirens), a library for segmentation, indexing, and retrieval of environmental and natural sounds. Sirens is currently under development and only
|
2
|
+
sirens-ruby is a ruby extension for [Sirens](http://github.com/plant/sirens), a library for segmentation, indexing, and retrieval of environmental and natural sounds. Sirens is currently under development and is only ready to use for feature extraction and segmentation. Please check back for updates on retrieval and indexing.
|
3
3
|
|
4
4
|
## Requirements
|
5
5
|
To install sirens-ruby, it is necessary to have these two libraries:
|
@@ -46,28 +46,7 @@ After installing Rice from source, if you have not installed it as a gem, you ma
|
|
46
46
|
If you have any problems with this process, please [submit an issue](http://github.com/plant/sirens-ruby/issues) and I'll try to help as soon as possible.
|
47
47
|
|
48
48
|
## Usage
|
49
|
-
|
50
|
-
|
51
|
-
Here is a basic example to extract loudness (dB) from a sound file:
|
52
|
-
|
53
|
-
require 'sirens'
|
54
|
-
include Sirens
|
55
|
-
|
56
|
-
s = Sound.new
|
57
|
-
s.frameLength = 0.04
|
58
|
-
s.hopLength = 0.02
|
59
|
-
|
60
|
-
s.open('sound.wav')
|
61
|
-
|
62
|
-
loudness = Loudness.new
|
63
|
-
loudness.historySize = s.frames
|
64
|
-
|
65
|
-
s.sampleFeatures = [loudness]
|
66
|
-
s.extractFeatures
|
67
|
-
|
68
|
-
puts loudness.history
|
69
|
-
|
70
|
-
More examples can be found in the /examples folder. Detailed documentation is on the [Wiki](http://wiki.github.com/plant/sirens-ruby). Expect RDoc documentation soon.
|
49
|
+
RDoc documentation and a full tutorial is to come, but for now, you can check out some example code in the examples/ directory to get an idea of how the extension works.
|
71
50
|
|
72
51
|
# Copyright
|
73
|
-
Copyright
|
52
|
+
Copyright 2009 Brandon Mechtley. Sirens-ruby is licensed under the [MIT License](http://creativecommons.org/licenses/MIT/). See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/ext/sirens/sirens.cpp
CHANGED
@@ -100,6 +100,26 @@ vector<Feature*> from_ruby<vector<Feature*> >(Object x) {
|
|
100
100
|
return y;
|
101
101
|
}
|
102
102
|
|
103
|
+
// 1D int vector
|
104
|
+
template <>
|
105
|
+
Object to_ruby<vector<int> >(vector<int> const & x) {
|
106
|
+
return Array(x.begin(), x.end());
|
107
|
+
}
|
108
|
+
|
109
|
+
template <>
|
110
|
+
vector<int> from_ruby<vector<int> >(Object x) {
|
111
|
+
vector<int> values;
|
112
|
+
|
113
|
+
Array ruby_vector(x);
|
114
|
+
|
115
|
+
for (unsigned int i = 0; i < ruby_vector.size(); i++) {
|
116
|
+
double* value = (double*)(ruby_vector[i].value());
|
117
|
+
values.push_back((int)(*value));
|
118
|
+
}
|
119
|
+
|
120
|
+
return values;
|
121
|
+
}
|
122
|
+
|
103
123
|
// 2D double vector
|
104
124
|
template <>
|
105
125
|
Object to_ruby<vector<double> >(vector<double> const & x) {
|
@@ -204,8 +224,8 @@ extern "C" void Init_sirens() {
|
|
204
224
|
.define_method("pNew=", &Segmenter::setPNew)
|
205
225
|
.define_method("pOff", &Segmenter::getPOff)
|
206
226
|
.define_method("pOff=", &Segmenter::setPOff)
|
207
|
-
.define_method("
|
208
|
-
.define_method("
|
227
|
+
.define_method("segments", &Segmenter::getSegments)
|
228
|
+
.define_method("modes", &Segmenter::getModes)
|
209
229
|
.define_method("segment", &Segmenter::getSegments);
|
210
230
|
|
211
231
|
/*
|
data/sirens.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{sirens}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.3.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Brandon Mechtley"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-25}
|
10
10
|
s.description = %q{Ruby gem that implements Sirens, a library for segmentation, indexing, and retrieval of environmental and natural sounds.}
|
11
11
|
s.email = %q{bmechtley+github@gmail.com}
|
12
12
|
s.extensions = ["ext/sirens/extconf.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plant-sirens
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mechtley
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-25 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|