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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b395ce300252d4d65274f0ddb9d387de1dd836721a8a4f81804c5a888fb5433
4
- data.tar.gz: 9e98ca9a0e8e945e069957990671bf143edb1240f313f65bf87e97bba4e05106
3
+ metadata.gz: 9488128781f307b653965c253dcacbe246ebaf27bf4e6359b030d9a93bafc1b2
4
+ data.tar.gz: 5dc18368bdef8945ecaeb1ad2d60771df98bfdd8c356ad2fcdd2b343b8c02b51
5
5
  SHA512:
6
- metadata.gz: ab922eef545e50e302f7a72f992f2d6040fb9cd1856c37ff532baed0092783442d649f8c3bc91a4cf92684729d7ce7294cd9a943a8c8a483734bb858e885845f
7
- data.tar.gz: 414ea85a03b53cf21caef57289551fa88747ad2a5e0c60f0e92cb57a017cd04903b359d8d71ac37cecba50492678bc5d4327a9f340aba8f6006339d9379fed26
6
+ metadata.gz: ddabdfa32632e9d2af024a0f7b67f2add1b694a9a7ef9036f2a1c2f9338106069e6ec1afaea50a0c6f68a8aaa695e57c492d981fb7b3d704fd28ef420c3e2519
7
+ data.tar.gz: 83131487d0566bb957bab2388e888843ca9b108ec95644811fb702c57bfad628bb41a1ea2b9d1b728090230b48767175bc53af7f0601e8acf8c4d299b5a6de33
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.0 (2021-05-23)
2
+
3
+ - Updated to Rice 4
4
+ - Dropped support for Ruby < 2.6
5
+
1
6
  ## 0.1.2 (2021-02-06)
2
7
 
3
8
  - Added `amplitude_to_DB` and `DB_to_amplitude` methods
@@ -1,75 +1,33 @@
1
1
  #include <torchaudio/csrc/sox.h>
2
2
 
3
- #include <rice/Constructor.hpp>
4
- #include <rice/Module.hpp>
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
- Module rb_mTorchAudio = define_module("TorchAudio");
9
+ auto rb_mTorchAudio = Rice::define_module("TorchAudio");
52
10
 
53
- Module rb_mExt = define_module_under(rb_mTorchAudio, "Ext")
54
- .define_singleton_method(
11
+ auto rb_mExt = Rice::define_module_under(rb_mTorchAudio, "Ext")
12
+ .define_singleton_function(
55
13
  "read_audio_file",
56
- *[](const std::string& file_name, at::Tensor output, bool ch_first, int64_t nframes, int64_t offset, SignalInfo si, EncodingInfo ei, const char* ft) {
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
- .define_singleton_method(
17
+ .define_singleton_function(
60
18
  "write_audio_file",
61
- *[](const std::string& file_name, const at::Tensor& tensor, SignalInfo si, EncodingInfo ei, const char* file_type) {
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
- Class rb_cSignalInfo = define_class_under<sox_signalinfo_t>(rb_mExt, "SignalInfo")
66
- .define_constructor(Constructor<sox_signalinfo_t>())
67
- .define_method("rate", *[](sox_signalinfo_t& self) { return self.rate; })
68
- .define_method("channels", *[](sox_signalinfo_t& self) { return self.channels; })
69
- .define_method("precision", *[](sox_signalinfo_t& self) { return self.precision; })
70
- .define_method("length", *[](sox_signalinfo_t& self) { return self.length; })
71
- .define_method("rate=", *[](sox_signalinfo_t& self, sox_rate_t rate) { self.rate = rate; })
72
- .define_method("channels=", *[](sox_signalinfo_t& self, unsigned channels) { self.channels = channels; })
73
- .define_method("precision=", *[](sox_signalinfo_t& self, unsigned precision) { self.precision = precision; })
74
- .define_method("length=", *[](sox_signalinfo_t& self, sox_uint64_t length) { self.length = 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
  }
@@ -1,8 +1,6 @@
1
1
  require "mkmf-rice"
2
2
 
3
- abort "Missing stdc++" unless have_library("stdc++")
4
-
5
- $CXXFLAGS += " -std=c++14"
3
+ $CXXFLAGS += " -std=c++17 $(optflags)"
6
4
 
7
5
  abort "SoX not found" unless have_library("sox")
8
6
 
@@ -1,3 +1,3 @@
1
1
  module TorchAudio
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.2
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-02-06 00:00:00.000000000 Z
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.3.4
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.3.4
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: '2.2'
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: '2.2'
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.5'
85
+ version: '2.6'
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="