torchaudio 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 938d840ca33f543f9ae76e911fe9681448703dddaab35a1a9dc05703a19d42c0
4
- data.tar.gz: 5bac1684448eac1c520d2f4e5f17ac0ac7948afc7a2e46bb4bc5cd721a66ef26
3
+ metadata.gz: 1d221dc6cf08b75a5084dcd0142067168c3a03302e5dbd638f0f68ed7882ad31
4
+ data.tar.gz: acc470a5f1ab004ec0a42e9229bbfc5321434328496f165f932a217a3d106220
5
5
  SHA512:
6
- metadata.gz: 01f602344f23934a80470c72a2608f64209fd3649c614d107f6a87757774a6930a14e83fc421cb4f35a629d41f4321b1967849c0f05aa3c6a580b69814bfe637
7
- data.tar.gz: 908bb885c92f1748c6f38609ea02b44fdf187bace3fafffd4764348516d5cf590fdb9aafb3871de5a9feacdcb9bd96cefead9753092b8c5d8711a1a63ae57aef
6
+ metadata.gz: e49dec118b6886295f44aa01452ffc6f3f0dedae8debbb6c094a33dcb8ca388c3336581af53ceb0fbe25e0689ac7ceba1bee0c3b1b172019405fc7a4240a32b0
7
+ data.tar.gz: 0b1fc5854e251137cba56279219d9c307b98811083f127be282f8229c46d80e667145773967d75afedf0b33a4ecf6af39f437c83b9844a11fab435d25b265df3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.4.1 (2025-06-26)
2
+
3
+ - Improved SoX detection for Homebrew
4
+
1
5
  ## 0.4.0 (2024-08-02)
2
6
 
3
7
  - Dropped support for Ruby < 3.1
data/LICENSE.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  BSD 2-Clause License
2
2
 
3
3
  Copyright (c) 2017 Facebook Inc. (Soumith Chintala),
4
- Copyright (c) 2020-2024 Andrew Kane,
4
+ Copyright (c) 2020-2025 Andrew Kane,
5
5
  All rights reserved.
6
6
 
7
7
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -93,7 +93,7 @@ TorchAudio::Datasets::YESNO.new(".", download: true)
93
93
 
94
94
  Supported datasets are:
95
95
 
96
- - [YESNO](http://www.openslr.org/1/)
96
+ - [YESNO](https://www.openslr.org/1/)
97
97
 
98
98
  ## Disclaimer
99
99
 
@@ -44,7 +44,7 @@ void validate_input_file(const SoxFormat& sf) {
44
44
  throw std::runtime_error("Error loading audio file: unknown encoding.");
45
45
  }
46
46
  if (sf->signal.length == 0) {
47
- throw std::runtime_error("Error reading audio file: unkown length.");
47
+ throw std::runtime_error("Error reading audio file: unknown length.");
48
48
  }
49
49
  }
50
50
 
@@ -84,7 +84,7 @@ caffe2::TypeMeta get_dtype(
84
84
  }
85
85
  default:
86
86
  // default to float32 for the other formats, including
87
- // 32-bit flaoting-point WAV,
87
+ // 32-bit floating-point WAV,
88
88
  // MP3,
89
89
  // FLAC,
90
90
  // VORBIS etc...
@@ -1,11 +1,12 @@
1
+ #include <string>
2
+
1
3
  #include <torchaudio/csrc/sox.h>
2
4
 
3
5
  #include <rice/rice.hpp>
4
6
  #include <rice/stl.hpp>
5
7
 
6
8
  extern "C"
7
- void Init_ext()
8
- {
9
+ void Init_ext() {
9
10
  auto rb_mTorchAudio = Rice::define_module("TorchAudio");
10
11
 
11
12
  auto rb_mExt = Rice::define_module_under(rb_mTorchAudio, "Ext")
@@ -73,6 +73,12 @@ if with_cuda
73
73
  $LDFLAGS += " -Wl,--no-as-needed,#{lib}/libtorch.so"
74
74
  end
75
75
 
76
+ sox_inc, sox_lib = dir_config("sox")
77
+ sox_inc ||= paths.map { |v| "#{v}/include" }.find { |v| File.exist?("#{v}/sox.h") }
78
+ sox_lib ||= paths.map { |v| "#{v}/lib" }.find { |v| Dir["#{v}/*libsox*"].any? }
79
+
80
+ $INCFLAGS += " -I#{sox_inc}" if sox_inc
81
+ $LDFLAGS += " -L#{sox_lib}" if sox_lib
76
82
  abort "SoX not found" unless have_library("sox")
77
83
 
78
84
  # create makefile
@@ -4,11 +4,19 @@ module TorchAudio
4
4
  attr_reader :n_mels
5
5
 
6
6
  def initialize(
7
- sample_rate: 16000, n_fft: 400, win_length: nil, hop_length: nil, f_min: 0.0,
8
- f_max: nil, pad: 0, n_mels: 128, window_fn: Torch.method(:hann_window),
9
- power: 2.0, normalized: false, wkwargs: nil
7
+ sample_rate: 16000,
8
+ n_fft: 400,
9
+ win_length: nil,
10
+ hop_length: nil,
11
+ f_min: 0.0,
12
+ f_max: nil,
13
+ pad: 0,
14
+ n_mels: 128,
15
+ window_fn: Torch.method(:hann_window),
16
+ power: 2.0,
17
+ normalized: false,
18
+ wkwargs: nil
10
19
  )
11
-
12
20
  super()
13
21
  @sample_rate = sample_rate
14
22
  @n_fft = n_fft
@@ -2,11 +2,18 @@ module TorchAudio
2
2
  module Transforms
3
3
  class Spectrogram < Torch::NN::Module
4
4
  def initialize(
5
- n_fft: 400, win_length: nil, hop_length: nil, pad: 0,
6
- window_fn: Torch.method(:hann_window), power: 2.0, normalized: false, wkwargs: nil,
7
- center: true, pad_mode: "reflect", onesided: true
5
+ n_fft: 400,
6
+ win_length: nil,
7
+ hop_length: nil,
8
+ pad: 0,
9
+ window_fn: Torch.method(:hann_window),
10
+ power: 2.0,
11
+ normalized: false,
12
+ wkwargs: nil,
13
+ center: true,
14
+ pad_mode: "reflect",
15
+ onesided: true
8
16
  )
9
-
10
17
  super()
11
18
  @n_fft = n_fft
12
19
  # number of FFT bins. the returned STFT result will have n_fft // 2 + 1
@@ -1,3 +1,3 @@
1
1
  module TorchAudio
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/torchaudio.rb CHANGED
@@ -32,10 +32,17 @@ module TorchAudio
32
32
  class << self
33
33
  # TODO remove filetype in 0.4.0
34
34
  def load(
35
- filepath, out: nil, normalization: true, channels_first: true, num_frames: 0,
36
- offset: 0, signalinfo: nil, encodinginfo: nil, filetype: nil, format: nil
35
+ filepath,
36
+ out: nil,
37
+ normalization: true,
38
+ channels_first: true,
39
+ num_frames: 0,
40
+ offset: 0,
41
+ signalinfo: nil,
42
+ encodinginfo: nil,
43
+ filetype: nil,
44
+ format: nil
37
45
  )
38
-
39
46
  filepath = filepath.to_s
40
47
 
41
48
  # check if valid file
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torchaudio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-03 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: torch-rb
@@ -30,15 +29,14 @@ dependencies:
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: '4.3'
32
+ version: 4.3.3
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: '4.3'
41
- description:
39
+ version: 4.3.3
42
40
  email: andrew@ankane.org
43
41
  executables: []
44
42
  extensions:
@@ -78,7 +76,6 @@ homepage: https://github.com/ankane/torchaudio-ruby
78
76
  licenses:
79
77
  - BSD-2-Clause
80
78
  metadata: {}
81
- post_install_message:
82
79
  rdoc_options: []
83
80
  require_paths:
84
81
  - lib
@@ -93,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
90
  - !ruby/object:Gem::Version
94
91
  version: '0'
95
92
  requirements: []
96
- rubygems_version: 3.5.11
97
- signing_key:
93
+ rubygems_version: 3.6.7
98
94
  specification_version: 4
99
95
  summary: Data manipulation and transformation for audio signal processing
100
96
  test_files: []