torchaudio 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/torchaudio/ext.cpp +18 -60
- data/ext/torchaudio/extconf.rb +1 -3
- data/lib/torchaudio/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9488128781f307b653965c253dcacbe246ebaf27bf4e6359b030d9a93bafc1b2
|
4
|
+
data.tar.gz: 5dc18368bdef8945ecaeb1ad2d60771df98bfdd8c356ad2fcdd2b343b8c02b51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddabdfa32632e9d2af024a0f7b67f2add1b694a9a7ef9036f2a1c2f9338106069e6ec1afaea50a0c6f68a8aaa695e57c492d981fb7b3d704fd28ef420c3e2519
|
7
|
+
data.tar.gz: 83131487d0566bb957bab2388e888843ca9b108ec95644811fb702c57bfad628bb41a1ea2b9d1b728090230b48767175bc53af7f0601e8acf8c4d299b5a6de33
|
data/CHANGELOG.md
CHANGED
data/ext/torchaudio/ext.cpp
CHANGED
@@ -1,75 +1,33 @@
|
|
1
1
|
#include <torchaudio/csrc/sox.h>
|
2
2
|
|
3
|
-
#include <rice/
|
4
|
-
#include <rice/
|
5
|
-
|
6
|
-
using namespace Rice;
|
7
|
-
|
8
|
-
class SignalInfo {
|
9
|
-
sox_signalinfo_t* value = nullptr;
|
10
|
-
public:
|
11
|
-
SignalInfo(Object o) {
|
12
|
-
if (!o.is_nil()) {
|
13
|
-
value = from_ruby<sox_signalinfo_t*>(o);
|
14
|
-
}
|
15
|
-
}
|
16
|
-
operator sox_signalinfo_t*() {
|
17
|
-
return value;
|
18
|
-
}
|
19
|
-
};
|
20
|
-
|
21
|
-
template<>
|
22
|
-
inline
|
23
|
-
SignalInfo from_ruby<SignalInfo>(Object x)
|
24
|
-
{
|
25
|
-
return SignalInfo(x);
|
26
|
-
}
|
27
|
-
|
28
|
-
class EncodingInfo {
|
29
|
-
sox_encodinginfo_t* value = nullptr;
|
30
|
-
public:
|
31
|
-
EncodingInfo(Object o) {
|
32
|
-
if (!o.is_nil()) {
|
33
|
-
value = from_ruby<sox_encodinginfo_t*>(o);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
operator sox_encodinginfo_t*() {
|
37
|
-
return value;
|
38
|
-
}
|
39
|
-
};
|
40
|
-
|
41
|
-
template<>
|
42
|
-
inline
|
43
|
-
EncodingInfo from_ruby<EncodingInfo>(Object x)
|
44
|
-
{
|
45
|
-
return EncodingInfo(x);
|
46
|
-
}
|
3
|
+
#include <rice/rice.hpp>
|
4
|
+
#include <rice/stl.hpp>
|
47
5
|
|
48
6
|
extern "C"
|
49
7
|
void Init_ext()
|
50
8
|
{
|
51
|
-
|
9
|
+
auto rb_mTorchAudio = Rice::define_module("TorchAudio");
|
52
10
|
|
53
|
-
|
54
|
-
.
|
11
|
+
auto rb_mExt = Rice::define_module_under(rb_mTorchAudio, "Ext")
|
12
|
+
.define_singleton_function(
|
55
13
|
"read_audio_file",
|
56
|
-
|
14
|
+
[](const std::string& file_name, at::Tensor output, bool ch_first, int64_t nframes, int64_t offset, sox_signalinfo_t* si, sox_encodinginfo_t* ei, const char* ft) {
|
57
15
|
return torch::audio::read_audio_file(file_name, output, ch_first, nframes, offset, si, ei, ft);
|
58
16
|
})
|
59
|
-
.
|
17
|
+
.define_singleton_function(
|
60
18
|
"write_audio_file",
|
61
|
-
|
19
|
+
[](const std::string& file_name, const at::Tensor& tensor, sox_signalinfo_t* si, sox_encodinginfo_t* ei, const char* file_type) {
|
62
20
|
return torch::audio::write_audio_file(file_name, tensor, si, ei, file_type);
|
63
21
|
});
|
64
22
|
|
65
|
-
|
66
|
-
.define_constructor(Constructor<sox_signalinfo_t>())
|
67
|
-
.define_method("rate",
|
68
|
-
.define_method("channels",
|
69
|
-
.define_method("precision",
|
70
|
-
.define_method("length",
|
71
|
-
.define_method("rate=",
|
72
|
-
.define_method("channels=",
|
73
|
-
.define_method("precision=",
|
74
|
-
.define_method("length=",
|
23
|
+
auto rb_cSignalInfo = Rice::define_class_under<sox_signalinfo_t>(rb_mExt, "SignalInfo")
|
24
|
+
.define_constructor(Rice::Constructor<sox_signalinfo_t>())
|
25
|
+
.define_method("rate", [](sox_signalinfo_t& self) { return self.rate; })
|
26
|
+
.define_method("channels", [](sox_signalinfo_t& self) { return self.channels; })
|
27
|
+
.define_method("precision", [](sox_signalinfo_t& self) { return self.precision; })
|
28
|
+
.define_method("length", [](sox_signalinfo_t& self) { return self.length; })
|
29
|
+
.define_method("rate=", [](sox_signalinfo_t& self, sox_rate_t rate) { self.rate = rate; })
|
30
|
+
.define_method("channels=", [](sox_signalinfo_t& self, unsigned channels) { self.channels = channels; })
|
31
|
+
.define_method("precision=", [](sox_signalinfo_t& self, unsigned precision) { self.precision = precision; })
|
32
|
+
.define_method("length=", [](sox_signalinfo_t& self, sox_uint64_t length) { self.length = length; });
|
75
33
|
}
|
data/ext/torchaudio/extconf.rb
CHANGED
data/lib/torchaudio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torchaudio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: torch-rb
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.7.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.7.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rice
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.0.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.0.2
|
41
41
|
description:
|
42
42
|
email: andrew@ankane.org
|
43
43
|
executables: []
|
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '2.
|
85
|
+
version: '2.6'
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - ">="
|