diffsptk 3.1.0__tar.gz → 3.3.0__tar.gz
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.
- {diffsptk-3.1.0 → diffsptk-3.3.0}/.gitignore +4 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/PKG-INFO +56 -30
- {diffsptk-3.1.0 → diffsptk-3.3.0}/README.md +55 -29
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/functional.py +197 -6
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/__init__.py +4 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/acorr.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/acr2csm.py +20 -6
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/alaw.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ap.py +34 -12
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/b2mc.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/c2acr.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/c2mpir.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/c2ndps.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/cdist.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/chroma.py +12 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/cqt.py +17 -7
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/csm2acr.py +16 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/dct.py +20 -8
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/decimate.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/delay.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/delta.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/dequantize.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/df2.py +15 -3
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/dfs.py +17 -6
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/dht.py +19 -7
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/drc.py +14 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/dst.py +19 -7
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/entropy.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/excite.py +3 -3
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/fbank.py +119 -38
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/fftcep.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/fftr.py +16 -6
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/frame.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/freqt.py +18 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/freqt2.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/gammatone.py +16 -10
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/gmm.py +17 -8
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/gnorm.py +2 -2
- diffsptk-3.3.0/diffsptk/modules/griffin.py +288 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/grpdelay.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/hilbert.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/hilbert2.py +15 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/histogram.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ialaw.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ica.py +13 -3
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/icqt.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/idct.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/idht.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/idst.py +17 -5
- diffsptk-3.3.0/diffsptk/modules/ifbank.py +193 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ifftr.py +24 -8
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ifreqt2.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/igammatone.py +20 -7
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ignorm.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/imdct.py +33 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/imdst.py +10 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/interpolate.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ipnorm.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ipqmf.py +10 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/is2par.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/istft.py +28 -8
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/iulaw.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lar2par.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lbg.py +6 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/levdur.py +22 -8
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/linear_intpl.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lpc.py +23 -8
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lpc2lsp.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lpc2par.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lpccheck.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lsp2lpc.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lsp2sp.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/lspcheck.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/magic_intpl.py +5 -3
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mc2b.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mcep.py +36 -10
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mcpf.py +27 -7
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mdct.py +37 -11
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mdst.py +10 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mfcc.py +42 -6
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mgc2mgc.py +38 -11
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mgc2sp.py +16 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mgcep.py +64 -21
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mglsadf.py +42 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mlpg.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mlsacheck.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/mpir2c.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/msvq.py +13 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ndps2c.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/nmf.py +13 -3
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/norm0.py +2 -2
- diffsptk-3.3.0/diffsptk/modules/oband.py +187 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/par2is.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/par2lar.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/par2lpc.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/pca.py +12 -3
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/phase.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/pitch.py +30 -11
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/pitch_spec.py +63 -23
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/plp.py +56 -17
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/pnorm.py +21 -6
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/pol_root.py +11 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/poledf.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/pqmf.py +10 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/quantize.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/rlevdur.py +16 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/rmse.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/root_pol.py +11 -3
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/smcep.py +24 -8
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/snr.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/spec.py +3 -3
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/stft.py +21 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ulaw.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/unframe.py +16 -7
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/vq.py +12 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/wht.py +18 -7
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/window.py +17 -5
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/world_synth.py +17 -7
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/yingram.py +12 -4
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/zcross.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/zerodf.py +2 -2
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/utils/private.py +95 -40
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/utils/public.py +20 -5
- diffsptk-3.3.0/diffsptk/version.py +1 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/pyproject.toml +3 -0
- diffsptk-3.1.0/diffsptk/version.py +0 -1
- {diffsptk-3.1.0 → diffsptk-3.3.0}/CITATION.cff +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/LICENSE +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/__init__.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/base.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/flux.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/imglsadf.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/imsvq.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/modules/ivq.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/signals.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/librosa/LICENSE +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/librosa/__init__.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/librosa/constantq.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/librosa/filters.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/librosa/typing.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/librosa/util.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/world/LICENSE +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/world/__init__.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/third_party/world/common.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/typing.py +0 -0
- {diffsptk-3.1.0 → diffsptk-3.3.0}/diffsptk/utils/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diffsptk
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.0
|
|
4
4
|
Summary: Speech signal processing modules for machine learning
|
|
5
5
|
Project-URL: Homepage, https://sp-tk.sourceforge.net/
|
|
6
6
|
Project-URL: Documentation, https://sp-nitech.github.io/diffsptk/latest/
|
|
@@ -47,11 +47,11 @@ Description-Content-Type: text/markdown
|
|
|
47
47
|
|
|
48
48
|
*diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
|
|
49
49
|
|
|
50
|
-
[](https://sp-nitech.github.io/diffsptk/3.
|
|
50
|
+
[](https://sp-nitech.github.io/diffsptk/3.3.0/)
|
|
51
51
|
[](https://pepy.tech/project/diffsptk)
|
|
52
52
|
[](https://clickpy.clickhouse.com/dashboard/diffsptk)
|
|
53
53
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
54
|
-
[](https://pypi.python.org/pypi/diffsptk)
|
|
55
55
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
56
56
|
[](https://app.codecov.io/gh/sp-nitech/diffsptk)
|
|
57
57
|
[](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
|
|
@@ -65,7 +65,7 @@ Description-Content-Type: text/markdown
|
|
|
65
65
|
|
|
66
66
|
## Documentation
|
|
67
67
|
|
|
68
|
-
- See [this page](https://sp-nitech.github.io/diffsptk/3.
|
|
68
|
+
- See [this page](https://sp-nitech.github.io/diffsptk/3.3.0/) for the reference manual.
|
|
69
69
|
- Our [paper](https://www.isca-speech.org/archive/ssw_2023/yoshimura23_ssw.html) is available on the ISCA Archive.
|
|
70
70
|
|
|
71
71
|
## Installation
|
|
@@ -95,13 +95,12 @@ stft_params = {"frame_length": 400, "frame_period": 80, "fft_length": 512}
|
|
|
95
95
|
x, sr = diffsptk.read("assets/data.wav", device="cuda")
|
|
96
96
|
|
|
97
97
|
# Compute spectrogram using a nn.Module class.
|
|
98
|
-
X1 = diffsptk.STFT(**stft_params
|
|
98
|
+
X1 = diffsptk.STFT(**stft_params, device="cuda")(x)
|
|
99
99
|
|
|
100
100
|
# Compute spectrogram using a functional method.
|
|
101
101
|
X2 = diffsptk.functional.stft(x, **stft_params)
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
assert X1.allclose(X2)
|
|
103
|
+
print(X1.allclose(X2))
|
|
105
104
|
```
|
|
106
105
|
|
|
107
106
|
### Mel-cepstral analysis and synthesis
|
|
@@ -174,7 +173,6 @@ import diffsptk
|
|
|
174
173
|
|
|
175
174
|
fp = 80 # Frame period.
|
|
176
175
|
n_fft = 1024 # FFT length.
|
|
177
|
-
M = 24 # Mel-cepstrum dimensions.
|
|
178
176
|
|
|
179
177
|
# Read waveform.
|
|
180
178
|
x, sr = diffsptk.read("assets/data.wav")
|
|
@@ -220,6 +218,10 @@ x_hat = world_synth(f0, A, S)
|
|
|
220
218
|
|
|
221
219
|
# Write reconstructed waveform.
|
|
222
220
|
diffsptk.write("reconst.wav", x_hat, sr)
|
|
221
|
+
|
|
222
|
+
# Compute error.
|
|
223
|
+
error = (x_hat - x).abs().sum()
|
|
224
|
+
print(error)
|
|
223
225
|
```
|
|
224
226
|
|
|
225
227
|
### LPC analysis and synthesis
|
|
@@ -237,7 +239,7 @@ x, sr = diffsptk.read("assets/data.wav")
|
|
|
237
239
|
# Estimate LPC of x.
|
|
238
240
|
frame = diffsptk.Frame(frame_length=fl, frame_period=fp)
|
|
239
241
|
window = diffsptk.Window(in_length=fl)
|
|
240
|
-
lpc = diffsptk.LPC(frame_length=fl, lpc_order=M, eps=1e-
|
|
242
|
+
lpc = diffsptk.LPC(frame_length=fl, lpc_order=M, eps=1e-5)
|
|
241
243
|
a = lpc(window(frame(x)))
|
|
242
244
|
|
|
243
245
|
# Convert to inverse filter coefficients.
|
|
@@ -257,16 +259,15 @@ error = (x_hat - x).abs().sum()
|
|
|
257
259
|
print(error)
|
|
258
260
|
```
|
|
259
261
|
|
|
260
|
-
### Mel-spectrogram
|
|
262
|
+
### Mel-spectrogram analysis and synthesis
|
|
261
263
|
|
|
262
264
|
```python
|
|
263
265
|
import diffsptk
|
|
264
266
|
|
|
265
|
-
fl = 400
|
|
266
|
-
fp = 80
|
|
267
|
-
n_fft = 512
|
|
268
|
-
n_channel =
|
|
269
|
-
M = 12 # MFCC/PLP dimensions
|
|
267
|
+
fl = 400 # Frame length.
|
|
268
|
+
fp = 80 # Frame period.
|
|
269
|
+
n_fft = 512 # FFT length.
|
|
270
|
+
n_channel = 128 # Number of channels.
|
|
270
271
|
|
|
271
272
|
# Read waveform.
|
|
272
273
|
x, sr = diffsptk.read("assets/data.wav")
|
|
@@ -276,33 +277,35 @@ stft = diffsptk.STFT(frame_length=fl, frame_period=fp, fft_length=n_fft)
|
|
|
276
277
|
X = stft(x)
|
|
277
278
|
|
|
278
279
|
# Extract log mel-spectrogram.
|
|
279
|
-
fbank = diffsptk.
|
|
280
|
+
fbank = diffsptk.FBANK(
|
|
280
281
|
fft_length=n_fft,
|
|
281
282
|
n_channel=n_channel,
|
|
282
283
|
sample_rate=sr,
|
|
283
284
|
)
|
|
284
285
|
Y = fbank(X)
|
|
285
|
-
print(Y.shape)
|
|
286
286
|
|
|
287
|
-
#
|
|
288
|
-
|
|
289
|
-
fft_length=n_fft,
|
|
290
|
-
mfcc_order=M,
|
|
287
|
+
# Reconstruct linear spectrogram.
|
|
288
|
+
ifbank = diffsptk.IFBANK(
|
|
291
289
|
n_channel=n_channel,
|
|
290
|
+
fft_length=n_fft,
|
|
292
291
|
sample_rate=sr,
|
|
293
292
|
)
|
|
294
|
-
|
|
295
|
-
print(Y.shape)
|
|
293
|
+
X_hat = ifbank(Y)
|
|
296
294
|
|
|
297
|
-
#
|
|
298
|
-
|
|
295
|
+
# Reconstruct x.
|
|
296
|
+
griffin = diffsptk.GriffinLim(
|
|
297
|
+
frame_length=fl,
|
|
298
|
+
frame_period=fp,
|
|
299
299
|
fft_length=n_fft,
|
|
300
|
-
plp_order=M,
|
|
301
|
-
n_channel=n_channel,
|
|
302
|
-
sample_rate=sr,
|
|
303
300
|
)
|
|
304
|
-
|
|
305
|
-
|
|
301
|
+
x_hat = griffin(X_hat, out_length=x.size(0))
|
|
302
|
+
|
|
303
|
+
# Write reconstructed waveform.
|
|
304
|
+
diffsptk.write("reconst.wav", x_hat, sr)
|
|
305
|
+
|
|
306
|
+
# Compute error.
|
|
307
|
+
error = (x_hat - x).abs().sum()
|
|
308
|
+
print(error)
|
|
306
309
|
```
|
|
307
310
|
|
|
308
311
|
### Subband decomposition
|
|
@@ -358,6 +361,29 @@ error = (x_hat - x).abs().sum()
|
|
|
358
361
|
print(error)
|
|
359
362
|
```
|
|
360
363
|
|
|
364
|
+
### Fractional octave band analysis and synthesis
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
import diffsptk
|
|
368
|
+
|
|
369
|
+
# Read waveform.
|
|
370
|
+
x, sr = diffsptk.read("assets/data.wav")
|
|
371
|
+
|
|
372
|
+
# Decompose x.
|
|
373
|
+
oband = diffsptk.FractionalOctaveBandAnalysis(sr)
|
|
374
|
+
y = oband(x)
|
|
375
|
+
|
|
376
|
+
# Reconstruct x.
|
|
377
|
+
x_hat = y.sum(1).reshape(-1)
|
|
378
|
+
|
|
379
|
+
# Write reconstructed waveform.
|
|
380
|
+
diffsptk.write("reconst.wav", x_hat, sr)
|
|
381
|
+
|
|
382
|
+
# Compute error.
|
|
383
|
+
error = (x_hat - x).abs().sum()
|
|
384
|
+
print(error)
|
|
385
|
+
```
|
|
386
|
+
|
|
361
387
|
### Constant-Q transform
|
|
362
388
|
|
|
363
389
|
```python
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
*diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
|
|
4
4
|
|
|
5
|
-
[](https://sp-nitech.github.io/diffsptk/3.
|
|
5
|
+
[](https://sp-nitech.github.io/diffsptk/3.3.0/)
|
|
6
6
|
[](https://pepy.tech/project/diffsptk)
|
|
7
7
|
[](https://clickpy.clickhouse.com/dashboard/diffsptk)
|
|
8
8
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
9
|
-
[](https://pypi.python.org/pypi/diffsptk)
|
|
10
10
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
11
11
|
[](https://app.codecov.io/gh/sp-nitech/diffsptk)
|
|
12
12
|
[](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
## Documentation
|
|
22
22
|
|
|
23
|
-
- See [this page](https://sp-nitech.github.io/diffsptk/3.
|
|
23
|
+
- See [this page](https://sp-nitech.github.io/diffsptk/3.3.0/) for the reference manual.
|
|
24
24
|
- Our [paper](https://www.isca-speech.org/archive/ssw_2023/yoshimura23_ssw.html) is available on the ISCA Archive.
|
|
25
25
|
|
|
26
26
|
## Installation
|
|
@@ -50,13 +50,12 @@ stft_params = {"frame_length": 400, "frame_period": 80, "fft_length": 512}
|
|
|
50
50
|
x, sr = diffsptk.read("assets/data.wav", device="cuda")
|
|
51
51
|
|
|
52
52
|
# Compute spectrogram using a nn.Module class.
|
|
53
|
-
X1 = diffsptk.STFT(**stft_params
|
|
53
|
+
X1 = diffsptk.STFT(**stft_params, device="cuda")(x)
|
|
54
54
|
|
|
55
55
|
# Compute spectrogram using a functional method.
|
|
56
56
|
X2 = diffsptk.functional.stft(x, **stft_params)
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
assert X1.allclose(X2)
|
|
58
|
+
print(X1.allclose(X2))
|
|
60
59
|
```
|
|
61
60
|
|
|
62
61
|
### Mel-cepstral analysis and synthesis
|
|
@@ -129,7 +128,6 @@ import diffsptk
|
|
|
129
128
|
|
|
130
129
|
fp = 80 # Frame period.
|
|
131
130
|
n_fft = 1024 # FFT length.
|
|
132
|
-
M = 24 # Mel-cepstrum dimensions.
|
|
133
131
|
|
|
134
132
|
# Read waveform.
|
|
135
133
|
x, sr = diffsptk.read("assets/data.wav")
|
|
@@ -175,6 +173,10 @@ x_hat = world_synth(f0, A, S)
|
|
|
175
173
|
|
|
176
174
|
# Write reconstructed waveform.
|
|
177
175
|
diffsptk.write("reconst.wav", x_hat, sr)
|
|
176
|
+
|
|
177
|
+
# Compute error.
|
|
178
|
+
error = (x_hat - x).abs().sum()
|
|
179
|
+
print(error)
|
|
178
180
|
```
|
|
179
181
|
|
|
180
182
|
### LPC analysis and synthesis
|
|
@@ -192,7 +194,7 @@ x, sr = diffsptk.read("assets/data.wav")
|
|
|
192
194
|
# Estimate LPC of x.
|
|
193
195
|
frame = diffsptk.Frame(frame_length=fl, frame_period=fp)
|
|
194
196
|
window = diffsptk.Window(in_length=fl)
|
|
195
|
-
lpc = diffsptk.LPC(frame_length=fl, lpc_order=M, eps=1e-
|
|
197
|
+
lpc = diffsptk.LPC(frame_length=fl, lpc_order=M, eps=1e-5)
|
|
196
198
|
a = lpc(window(frame(x)))
|
|
197
199
|
|
|
198
200
|
# Convert to inverse filter coefficients.
|
|
@@ -212,16 +214,15 @@ error = (x_hat - x).abs().sum()
|
|
|
212
214
|
print(error)
|
|
213
215
|
```
|
|
214
216
|
|
|
215
|
-
### Mel-spectrogram
|
|
217
|
+
### Mel-spectrogram analysis and synthesis
|
|
216
218
|
|
|
217
219
|
```python
|
|
218
220
|
import diffsptk
|
|
219
221
|
|
|
220
|
-
fl = 400
|
|
221
|
-
fp = 80
|
|
222
|
-
n_fft = 512
|
|
223
|
-
n_channel =
|
|
224
|
-
M = 12 # MFCC/PLP dimensions
|
|
222
|
+
fl = 400 # Frame length.
|
|
223
|
+
fp = 80 # Frame period.
|
|
224
|
+
n_fft = 512 # FFT length.
|
|
225
|
+
n_channel = 128 # Number of channels.
|
|
225
226
|
|
|
226
227
|
# Read waveform.
|
|
227
228
|
x, sr = diffsptk.read("assets/data.wav")
|
|
@@ -231,33 +232,35 @@ stft = diffsptk.STFT(frame_length=fl, frame_period=fp, fft_length=n_fft)
|
|
|
231
232
|
X = stft(x)
|
|
232
233
|
|
|
233
234
|
# Extract log mel-spectrogram.
|
|
234
|
-
fbank = diffsptk.
|
|
235
|
+
fbank = diffsptk.FBANK(
|
|
235
236
|
fft_length=n_fft,
|
|
236
237
|
n_channel=n_channel,
|
|
237
238
|
sample_rate=sr,
|
|
238
239
|
)
|
|
239
240
|
Y = fbank(X)
|
|
240
|
-
print(Y.shape)
|
|
241
241
|
|
|
242
|
-
#
|
|
243
|
-
|
|
244
|
-
fft_length=n_fft,
|
|
245
|
-
mfcc_order=M,
|
|
242
|
+
# Reconstruct linear spectrogram.
|
|
243
|
+
ifbank = diffsptk.IFBANK(
|
|
246
244
|
n_channel=n_channel,
|
|
245
|
+
fft_length=n_fft,
|
|
247
246
|
sample_rate=sr,
|
|
248
247
|
)
|
|
249
|
-
|
|
250
|
-
print(Y.shape)
|
|
248
|
+
X_hat = ifbank(Y)
|
|
251
249
|
|
|
252
|
-
#
|
|
253
|
-
|
|
250
|
+
# Reconstruct x.
|
|
251
|
+
griffin = diffsptk.GriffinLim(
|
|
252
|
+
frame_length=fl,
|
|
253
|
+
frame_period=fp,
|
|
254
254
|
fft_length=n_fft,
|
|
255
|
-
plp_order=M,
|
|
256
|
-
n_channel=n_channel,
|
|
257
|
-
sample_rate=sr,
|
|
258
255
|
)
|
|
259
|
-
|
|
260
|
-
|
|
256
|
+
x_hat = griffin(X_hat, out_length=x.size(0))
|
|
257
|
+
|
|
258
|
+
# Write reconstructed waveform.
|
|
259
|
+
diffsptk.write("reconst.wav", x_hat, sr)
|
|
260
|
+
|
|
261
|
+
# Compute error.
|
|
262
|
+
error = (x_hat - x).abs().sum()
|
|
263
|
+
print(error)
|
|
261
264
|
```
|
|
262
265
|
|
|
263
266
|
### Subband decomposition
|
|
@@ -313,6 +316,29 @@ error = (x_hat - x).abs().sum()
|
|
|
313
316
|
print(error)
|
|
314
317
|
```
|
|
315
318
|
|
|
319
|
+
### Fractional octave band analysis and synthesis
|
|
320
|
+
|
|
321
|
+
```python
|
|
322
|
+
import diffsptk
|
|
323
|
+
|
|
324
|
+
# Read waveform.
|
|
325
|
+
x, sr = diffsptk.read("assets/data.wav")
|
|
326
|
+
|
|
327
|
+
# Decompose x.
|
|
328
|
+
oband = diffsptk.FractionalOctaveBandAnalysis(sr)
|
|
329
|
+
y = oband(x)
|
|
330
|
+
|
|
331
|
+
# Reconstruct x.
|
|
332
|
+
x_hat = y.sum(1).reshape(-1)
|
|
333
|
+
|
|
334
|
+
# Write reconstructed waveform.
|
|
335
|
+
diffsptk.write("reconst.wav", x_hat, sr)
|
|
336
|
+
|
|
337
|
+
# Compute error.
|
|
338
|
+
error = (x_hat - x).abs().sum()
|
|
339
|
+
print(error)
|
|
340
|
+
```
|
|
341
|
+
|
|
316
342
|
### Constant-Q transform
|
|
317
343
|
|
|
318
344
|
```python
|
|
@@ -594,6 +594,8 @@ def fbank(
|
|
|
594
594
|
f_max: float | None = None,
|
|
595
595
|
floor: float = 1e-5,
|
|
596
596
|
gamma: float = 0,
|
|
597
|
+
scale: str = "htk",
|
|
598
|
+
erb_factor: float | None = None,
|
|
597
599
|
use_power: bool = False,
|
|
598
600
|
out_format: str = "y",
|
|
599
601
|
) -> tuple[Tensor, Tensor] | Tensor:
|
|
@@ -622,6 +624,13 @@ def fbank(
|
|
|
622
624
|
gamma : float in [-1, 1]
|
|
623
625
|
The parameter of the generalized logarithmic function.
|
|
624
626
|
|
|
627
|
+
scale : ['htk', 'mel', 'inverted-mel', 'bark', 'linear']
|
|
628
|
+
The type of auditory scale used to construct the filter bank.
|
|
629
|
+
|
|
630
|
+
erb_factor : float > 0 or None
|
|
631
|
+
The scale factor for the ERB scale, referred to as the E-factor. If not None,
|
|
632
|
+
the filter bandwidths are adjusted according to the scaled ERB scale.
|
|
633
|
+
|
|
625
634
|
use_power : bool
|
|
626
635
|
If True, use the power spectrum instead of the amplitude spectrum.
|
|
627
636
|
|
|
@@ -646,6 +655,8 @@ def fbank(
|
|
|
646
655
|
f_max=f_max,
|
|
647
656
|
floor=floor,
|
|
648
657
|
gamma=gamma,
|
|
658
|
+
scale=scale,
|
|
659
|
+
erb_factor=erb_factor,
|
|
649
660
|
use_power=use_power,
|
|
650
661
|
out_format=out_format,
|
|
651
662
|
)
|
|
@@ -864,6 +875,101 @@ def gnorm(x: Tensor, gamma: float = 0, c: int | None = None) -> Tensor:
|
|
|
864
875
|
return nn.GeneralizedCepstrumGainNormalization._func(x, gamma=gamma, c=c)
|
|
865
876
|
|
|
866
877
|
|
|
878
|
+
def griffin(
|
|
879
|
+
y: Tensor,
|
|
880
|
+
*,
|
|
881
|
+
out_length: int | None = None,
|
|
882
|
+
frame_length: int = 400,
|
|
883
|
+
frame_period: int = 80,
|
|
884
|
+
fft_length: int = 512,
|
|
885
|
+
center: bool = True,
|
|
886
|
+
mode: str = "constant",
|
|
887
|
+
window: str = "blackman",
|
|
888
|
+
norm: str = "power",
|
|
889
|
+
symmetric: bool = True,
|
|
890
|
+
n_iter: int = 100,
|
|
891
|
+
alpha: float = 0.99,
|
|
892
|
+
beta: float = 0.99,
|
|
893
|
+
gamma: float = 1.1,
|
|
894
|
+
init_phase: str = "random",
|
|
895
|
+
verbose: bool = False,
|
|
896
|
+
) -> Tensor:
|
|
897
|
+
"""Reconstruct a waveform from the spectrum using the Griffin-Lim algorithm.
|
|
898
|
+
|
|
899
|
+
Parameters
|
|
900
|
+
----------
|
|
901
|
+
y : Tensor [shape=(..., T/P, N/2+1)]
|
|
902
|
+
The power spectrum.
|
|
903
|
+
|
|
904
|
+
out_length : int > 0 or None
|
|
905
|
+
The length of the output waveform.
|
|
906
|
+
|
|
907
|
+
frame_length : int >= 1
|
|
908
|
+
The frame length in samples, :math:`L`.
|
|
909
|
+
|
|
910
|
+
frame_period : int >= 1
|
|
911
|
+
The frame period in samples, :math:`P`.
|
|
912
|
+
|
|
913
|
+
fft_length : int >= L
|
|
914
|
+
The number of FFT bins, :math:`N`.
|
|
915
|
+
|
|
916
|
+
center : bool
|
|
917
|
+
If True, pad the input on both sides so that the frame is centered.
|
|
918
|
+
|
|
919
|
+
window : ['blackman', 'hamming', 'hanning', 'bartlett', 'trapezoidal', \
|
|
920
|
+
'rectangular', 'nuttall']
|
|
921
|
+
The window type.
|
|
922
|
+
|
|
923
|
+
norm : ['none', 'power', 'magnitude']
|
|
924
|
+
The normalization type of the window.
|
|
925
|
+
|
|
926
|
+
symmetric : bool
|
|
927
|
+
If True, the window is symmetric, otherwise periodic.
|
|
928
|
+
|
|
929
|
+
n_iter : int >= 1
|
|
930
|
+
The number of iterations for phase reconstruction.
|
|
931
|
+
|
|
932
|
+
alpha : float >= 0
|
|
933
|
+
The momentum factor, :math:`\\alpha`.
|
|
934
|
+
|
|
935
|
+
beta : float >= 0
|
|
936
|
+
The momentum factor, :math:`\\beta`.
|
|
937
|
+
|
|
938
|
+
gamma : float >= 0
|
|
939
|
+
The smoothing factor, :math:`\\gamma`.
|
|
940
|
+
|
|
941
|
+
init_phase : ['zeros', 'random']
|
|
942
|
+
The initial phase for the reconstruction.
|
|
943
|
+
|
|
944
|
+
verbose : bool
|
|
945
|
+
If True, print the SNR at each iteration.
|
|
946
|
+
|
|
947
|
+
Returns
|
|
948
|
+
-------
|
|
949
|
+
out : Tensor [shape=(..., T)]
|
|
950
|
+
The reconstructed waveform.
|
|
951
|
+
|
|
952
|
+
"""
|
|
953
|
+
return nn.GriffinLim._func(
|
|
954
|
+
y,
|
|
955
|
+
out_length=out_length,
|
|
956
|
+
frame_length=frame_length,
|
|
957
|
+
frame_period=frame_period,
|
|
958
|
+
fft_length=fft_length,
|
|
959
|
+
center=center,
|
|
960
|
+
mode=mode,
|
|
961
|
+
window=window,
|
|
962
|
+
norm=norm,
|
|
963
|
+
symmetric=symmetric,
|
|
964
|
+
n_iter=n_iter,
|
|
965
|
+
alpha=alpha,
|
|
966
|
+
beta=beta,
|
|
967
|
+
gamma=gamma,
|
|
968
|
+
init_phase=init_phase,
|
|
969
|
+
verbose=verbose,
|
|
970
|
+
)
|
|
971
|
+
|
|
972
|
+
|
|
867
973
|
def grpdelay(
|
|
868
974
|
b: Tensor | None = None,
|
|
869
975
|
a: Tensor | None = None,
|
|
@@ -1083,6 +1189,69 @@ def idst(y: Tensor, dst_type: int = 2) -> Tensor:
|
|
|
1083
1189
|
return nn.InverseDiscreteSineTransform._func(y, dst_type=dst_type)
|
|
1084
1190
|
|
|
1085
1191
|
|
|
1192
|
+
def ifbank(
|
|
1193
|
+
y: Tensor,
|
|
1194
|
+
fft_length: int,
|
|
1195
|
+
sample_rate: int,
|
|
1196
|
+
f_min: float = 0,
|
|
1197
|
+
f_max: float | None = None,
|
|
1198
|
+
gamma: float = 0,
|
|
1199
|
+
scale: str = "htk",
|
|
1200
|
+
erb_factor: float | None = None,
|
|
1201
|
+
use_power: bool = False,
|
|
1202
|
+
) -> Tensor:
|
|
1203
|
+
"""Reconstruct the power spectrum from the mel filter bank output.
|
|
1204
|
+
|
|
1205
|
+
Parameters
|
|
1206
|
+
----------
|
|
1207
|
+
y : Tensor [shape=(..., C)]
|
|
1208
|
+
The mel filter bank output.
|
|
1209
|
+
|
|
1210
|
+
fft_length : int >= 2
|
|
1211
|
+
The number of FFT bins, :math:`L`.
|
|
1212
|
+
|
|
1213
|
+
sample_rate : int >= 1
|
|
1214
|
+
The sample rate in Hz.
|
|
1215
|
+
|
|
1216
|
+
f_min : float >= 0
|
|
1217
|
+
The minimum frequency in Hz.
|
|
1218
|
+
|
|
1219
|
+
f_max : float <= sample_rate // 2
|
|
1220
|
+
The maximum frequency in Hz.
|
|
1221
|
+
|
|
1222
|
+
gamma : float in [-1, 1]
|
|
1223
|
+
The parameter of the generalized logarithmic function.
|
|
1224
|
+
|
|
1225
|
+
scale : ['htk', 'mel', 'inverted-mel', 'bark', 'linear']
|
|
1226
|
+
The type of auditory scale used to construct the filter bank.
|
|
1227
|
+
|
|
1228
|
+
erb_factor : float > 0 or None
|
|
1229
|
+
The scale factor for the ERB scale, referred to as the E-factor. If not None,
|
|
1230
|
+
the filter bandwidths are adjusted according to the scaled ERB scale.
|
|
1231
|
+
|
|
1232
|
+
use_power : bool
|
|
1233
|
+
Set to True if the mel filter bank output is extracted from the power spectrum
|
|
1234
|
+
instead of the amplitude spectrum.
|
|
1235
|
+
|
|
1236
|
+
Returns
|
|
1237
|
+
-------
|
|
1238
|
+
out : Tensor [shape=(..., L/2+1)]
|
|
1239
|
+
The reconstructed power spectrum.
|
|
1240
|
+
|
|
1241
|
+
"""
|
|
1242
|
+
return nn.InverseMelFilterBankAnalysis._func(
|
|
1243
|
+
y,
|
|
1244
|
+
fft_length=fft_length,
|
|
1245
|
+
sample_rate=sample_rate,
|
|
1246
|
+
f_min=f_min,
|
|
1247
|
+
f_max=f_max,
|
|
1248
|
+
gamma=gamma,
|
|
1249
|
+
scale=scale,
|
|
1250
|
+
erb_factor=erb_factor,
|
|
1251
|
+
use_power=use_power,
|
|
1252
|
+
)
|
|
1253
|
+
|
|
1254
|
+
|
|
1086
1255
|
def ifftr(y: Tensor, out_length: int | None = None) -> Tensor:
|
|
1087
1256
|
"""Compute inverse FFT of a complex spectrum.
|
|
1088
1257
|
|
|
@@ -1408,7 +1577,7 @@ def lar2par(g: Tensor) -> Tensor:
|
|
|
1408
1577
|
return nn.LogAreaRatioToParcorCoefficients._func(g)
|
|
1409
1578
|
|
|
1410
1579
|
|
|
1411
|
-
def levdur(r: Tensor, eps: float =
|
|
1580
|
+
def levdur(r: Tensor, eps: float | None = None) -> Tensor:
|
|
1412
1581
|
"""Solve a Yule-Walker linear system.
|
|
1413
1582
|
|
|
1414
1583
|
Parameters
|
|
@@ -1416,7 +1585,7 @@ def levdur(r: Tensor, eps: float = 0) -> Tensor:
|
|
|
1416
1585
|
r : Tensor [shape=(..., M+1)]
|
|
1417
1586
|
The autocorrelation.
|
|
1418
1587
|
|
|
1419
|
-
eps : float >= 0
|
|
1588
|
+
eps : float >= 0 or None
|
|
1420
1589
|
A small value to improve numerical stability.
|
|
1421
1590
|
|
|
1422
1591
|
Returns
|
|
@@ -1448,7 +1617,7 @@ def linear_intpl(x: Tensor, upsampling_factor: int = 80) -> Tensor:
|
|
|
1448
1617
|
return nn.LinearInterpolation._func(x, upsampling_factor=upsampling_factor)
|
|
1449
1618
|
|
|
1450
1619
|
|
|
1451
|
-
def lpc(x: Tensor, lpc_order: int, eps: float =
|
|
1620
|
+
def lpc(x: Tensor, lpc_order: int, eps: float | None = None) -> Tensor:
|
|
1452
1621
|
"""Perform LPC analysis.
|
|
1453
1622
|
|
|
1454
1623
|
Parameters
|
|
@@ -1459,7 +1628,7 @@ def lpc(x: Tensor, lpc_order: int, eps: float = 1e-6) -> Tensor:
|
|
|
1459
1628
|
lpc_order : int >= 0
|
|
1460
1629
|
The order of the LPC coefficients, :math:`M`.
|
|
1461
1630
|
|
|
1462
|
-
eps : float >= 0
|
|
1631
|
+
eps : float >= 0 or None
|
|
1463
1632
|
A small value to improve numerical stability.
|
|
1464
1633
|
|
|
1465
1634
|
Returns
|
|
@@ -1671,7 +1840,7 @@ def magic_intpl(x: Tensor, magic_number: float = 0) -> Tensor:
|
|
|
1671
1840
|
x : Tensor [shape=(B, N, D) or (N, D) or (N,)]
|
|
1672
1841
|
The data containing magic number.
|
|
1673
1842
|
|
|
1674
|
-
magic_number : float
|
|
1843
|
+
magic_number : float
|
|
1675
1844
|
The magic number to be interpolated.
|
|
1676
1845
|
|
|
1677
1846
|
Returns
|
|
@@ -1824,6 +1993,8 @@ def mfcc(
|
|
|
1824
1993
|
f_max: float | None = None,
|
|
1825
1994
|
floor: float = 1e-5,
|
|
1826
1995
|
gamma: float = 0,
|
|
1996
|
+
scale: str = "htk",
|
|
1997
|
+
erb_factor: float | None = None,
|
|
1827
1998
|
out_format: str = "y",
|
|
1828
1999
|
) -> Tensor:
|
|
1829
2000
|
"""Compute the MFCC from the power spectrum.
|
|
@@ -1857,6 +2028,13 @@ def mfcc(
|
|
|
1857
2028
|
gamma : float in [-1, 1]
|
|
1858
2029
|
The parameter of the generalized logarithmic function.
|
|
1859
2030
|
|
|
2031
|
+
scale : ['htk', 'mel', 'inverted-mel', 'bark', 'linear']
|
|
2032
|
+
The type of auditory scale used to construct the filter bank.
|
|
2033
|
+
|
|
2034
|
+
erb_factor : float > 0 or None
|
|
2035
|
+
The scale factor for the ERB scale, referred to as the E-factor. If not None,
|
|
2036
|
+
the filter bandwidths are adjusted according to the scaled ERB scale.
|
|
2037
|
+
|
|
1860
2038
|
out_format : ['y', 'yE', 'yc', 'ycE']
|
|
1861
2039
|
`y` is MFCC, `c` is C0, and `E` is energy.
|
|
1862
2040
|
|
|
@@ -1882,6 +2060,8 @@ def mfcc(
|
|
|
1882
2060
|
f_max=f_max,
|
|
1883
2061
|
floor=floor,
|
|
1884
2062
|
gamma=gamma,
|
|
2063
|
+
scale=scale,
|
|
2064
|
+
erb_factor=erb_factor,
|
|
1885
2065
|
out_format=out_format,
|
|
1886
2066
|
)
|
|
1887
2067
|
|
|
@@ -2265,6 +2445,8 @@ def plp(
|
|
|
2265
2445
|
f_max: float | None = None,
|
|
2266
2446
|
floor: float = 1e-5,
|
|
2267
2447
|
gamma: float = 0,
|
|
2448
|
+
scale: str = "htk",
|
|
2449
|
+
erb_factor: float | None = None,
|
|
2268
2450
|
n_fft: int = 512,
|
|
2269
2451
|
out_format: str = "y",
|
|
2270
2452
|
) -> Tensor:
|
|
@@ -2302,6 +2484,13 @@ def plp(
|
|
|
2302
2484
|
gamma : float in [-1, 1]
|
|
2303
2485
|
The parameter of the generalized logarithmic function.
|
|
2304
2486
|
|
|
2487
|
+
scale : ['htk', 'mel', 'inverted-mel', 'bark', 'linear']
|
|
2488
|
+
The type of auditory scale used to construct the filter bank.
|
|
2489
|
+
|
|
2490
|
+
erb_factor : float > 0 or None
|
|
2491
|
+
The scale factor for the ERB scale, referred to as the E-factor. If not None,
|
|
2492
|
+
the filter bandwidths are adjusted according to the scaled ERB scale.
|
|
2493
|
+
|
|
2305
2494
|
n_fft : int >> M
|
|
2306
2495
|
The number of FFT bins for the conversion from LPC to cepstrum.
|
|
2307
2496
|
|
|
@@ -2331,6 +2520,8 @@ def plp(
|
|
|
2331
2520
|
f_max=f_max,
|
|
2332
2521
|
floor=floor,
|
|
2333
2522
|
gamma=gamma,
|
|
2523
|
+
scale=scale,
|
|
2524
|
+
erb_factor=erb_factor,
|
|
2334
2525
|
n_fft=n_fft,
|
|
2335
2526
|
out_format=out_format,
|
|
2336
2527
|
)
|
|
@@ -2848,7 +3039,7 @@ def window(
|
|
|
2848
3039
|
If None, :math:`L_2 = L_1`.
|
|
2849
3040
|
|
|
2850
3041
|
window : ['blackman', 'hamming', 'hanning', 'bartlett', 'trapezoidal', \
|
|
2851
|
-
'rectangular', 'nuttall']
|
|
3042
|
+
'rectangular', 'nuttall', 'povey']
|
|
2852
3043
|
The window type.
|
|
2853
3044
|
|
|
2854
3045
|
norm : ['none', 'power', 'magnitude']
|
|
@@ -56,6 +56,7 @@ from .gammatone import GammatoneFilterBankAnalysis
|
|
|
56
56
|
from .gmm import GaussianMixtureModeling
|
|
57
57
|
from .gmm import GaussianMixtureModeling as GMM
|
|
58
58
|
from .gnorm import GeneralizedCepstrumGainNormalization
|
|
59
|
+
from .griffin import GriffinLim
|
|
59
60
|
from .grpdelay import GroupDelay
|
|
60
61
|
from .hilbert import HilbertTransform
|
|
61
62
|
from .hilbert2 import TwoDimensionalHilbertTransform
|
|
@@ -71,6 +72,8 @@ from .idht import InverseDiscreteHartleyTransform
|
|
|
71
72
|
from .idht import InverseDiscreteHartleyTransform as IDHT
|
|
72
73
|
from .idst import InverseDiscreteSineTransform
|
|
73
74
|
from .idst import InverseDiscreteSineTransform as IDST
|
|
75
|
+
from .ifbank import InverseMelFilterBankAnalysis
|
|
76
|
+
from .ifbank import InverseMelFilterBankAnalysis as IFBANK
|
|
74
77
|
from .ifftr import RealValuedInverseFastFourierTransform
|
|
75
78
|
from .ifreqt2 import SecondOrderAllPassInverseFrequencyTransform
|
|
76
79
|
from .igammatone import GammatoneFilterBankSynthesis
|
|
@@ -128,6 +131,7 @@ from .ndps2c import NegativeDerivativeOfPhaseSpectrumToCepstrum
|
|
|
128
131
|
from .nmf import NonnegativeMatrixFactorization
|
|
129
132
|
from .nmf import NonnegativeMatrixFactorization as NMF
|
|
130
133
|
from .norm0 import AllPoleToAllZeroDigitalFilterCoefficients
|
|
134
|
+
from .oband import FractionalOctaveBandAnalysis
|
|
131
135
|
from .par2is import ParcorCoefficientsToInverseSine
|
|
132
136
|
from .par2lar import ParcorCoefficientsToLogAreaRatio
|
|
133
137
|
from .par2lpc import ParcorCoefficientsToLinearPredictiveCoefficients
|