diffsptk 2.1.0__tar.gz → 2.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.
Files changed (126) hide show
  1. {diffsptk-2.1.0 → diffsptk-2.3.0}/PKG-INFO +103 -17
  2. {diffsptk-2.1.0 → diffsptk-2.3.0}/README.md +92 -7
  3. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/functional.py +372 -24
  4. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/misc/signals.py +5 -2
  5. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/misc/utils.py +96 -12
  6. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/__init__.py +32 -4
  7. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/acorr.py +1 -1
  8. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/acr2csm.py +6 -0
  9. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/ap.py +11 -5
  10. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/b2mc.py +6 -0
  11. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/c2ndps.py +5 -0
  12. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/cdist.py +10 -11
  13. diffsptk-2.3.0/diffsptk/modules/chroma.py +132 -0
  14. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/cqt.py +7 -0
  15. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/csm2acr.py +5 -0
  16. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/dct.py +33 -8
  17. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/decimate.py +0 -3
  18. diffsptk-2.3.0/diffsptk/modules/dht.py +95 -0
  19. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/drc.py +1 -1
  20. diffsptk-2.3.0/diffsptk/modules/dst.py +107 -0
  21. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/excite.py +91 -19
  22. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/fbank.py +3 -2
  23. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/fftcep.py +5 -0
  24. diffsptk-2.3.0/diffsptk/modules/flux.py +106 -0
  25. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/freqt.py +5 -0
  26. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/freqt2.py +6 -0
  27. diffsptk-2.3.0/diffsptk/modules/gammatone.py +225 -0
  28. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/gmm.py +207 -84
  29. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/gnorm.py +8 -2
  30. diffsptk-2.3.0/diffsptk/modules/hilbert.py +96 -0
  31. diffsptk-2.3.0/diffsptk/modules/hilbert2.py +105 -0
  32. diffsptk-2.3.0/diffsptk/modules/ica.py +180 -0
  33. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/icqt.py +8 -0
  34. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/idct.py +13 -6
  35. diffsptk-2.3.0/diffsptk/modules/idht.py +88 -0
  36. diffsptk-2.3.0/diffsptk/modules/idst.py +88 -0
  37. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/ifreqt2.py +6 -0
  38. diffsptk-2.3.0/diffsptk/modules/igammatone.py +203 -0
  39. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/ignorm.py +6 -0
  40. diffsptk-2.3.0/diffsptk/modules/imdct.py +160 -0
  41. diffsptk-2.3.0/diffsptk/modules/imdst.py +73 -0
  42. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/imglsadf.py +0 -8
  43. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/imsvq.py +5 -0
  44. diffsptk-2.3.0/diffsptk/modules/ipnorm.py +71 -0
  45. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/ipqmf.py +10 -1
  46. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/istft.py +1 -1
  47. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/ivq.py +5 -0
  48. diffsptk-2.3.0/diffsptk/modules/lbg.py +327 -0
  49. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/levdur.py +18 -5
  50. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/linear_intpl.py +1 -1
  51. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/lpc.py +9 -6
  52. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/lpc2lsp.py +6 -0
  53. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/lsp2sp.py +8 -0
  54. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/lspcheck.py +4 -4
  55. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/magic_intpl.py +1 -1
  56. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mc2b.py +6 -0
  57. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mcpf.py +9 -3
  58. diffsptk-2.3.0/diffsptk/modules/mdct.py +163 -0
  59. diffsptk-2.3.0/diffsptk/modules/mdst.py +70 -0
  60. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mgc2mgc.py +5 -0
  61. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mglsadf.py +11 -5
  62. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mlsacheck.py +7 -1
  63. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/msvq.py +6 -5
  64. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/ndps2c.py +5 -0
  65. diffsptk-2.3.0/diffsptk/modules/nmf.py +245 -0
  66. diffsptk-2.3.0/diffsptk/modules/pca.py +211 -0
  67. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/phase.py +1 -1
  68. diffsptk-2.3.0/diffsptk/modules/pnorm.py +87 -0
  69. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/poledf.py +1 -1
  70. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/pqmf.py +10 -1
  71. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/rmse.py +7 -11
  72. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/smcep.py +6 -0
  73. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/snr.py +2 -2
  74. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/spec.py +1 -1
  75. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/stft.py +1 -2
  76. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/vq.py +6 -5
  77. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/window.py +11 -1
  78. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/zcross.py +1 -1
  79. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/zerodf.py +1 -1
  80. diffsptk-2.3.0/diffsptk/version.py +1 -0
  81. {diffsptk-2.1.0 → diffsptk-2.3.0}/pyproject.toml +12 -10
  82. diffsptk-2.1.0/diffsptk/modules/lbg.py +0 -195
  83. diffsptk-2.1.0/diffsptk/modules/pca.py +0 -130
  84. diffsptk-2.1.0/diffsptk/version.py +0 -1
  85. {diffsptk-2.1.0 → diffsptk-2.3.0}/.gitignore +0 -0
  86. {diffsptk-2.1.0 → diffsptk-2.3.0}/CITATION.cff +0 -0
  87. {diffsptk-2.1.0 → diffsptk-2.3.0}/LICENSE +0 -0
  88. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/__init__.py +0 -0
  89. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/misc/__init__.py +0 -0
  90. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/alaw.py +0 -0
  91. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/c2acr.py +0 -0
  92. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/c2mpir.py +0 -0
  93. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/delay.py +0 -0
  94. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/delta.py +0 -0
  95. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/dequantize.py +0 -0
  96. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/df2.py +0 -0
  97. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/dfs.py +0 -0
  98. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/entropy.py +0 -0
  99. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/frame.py +0 -0
  100. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/grpdelay.py +0 -0
  101. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/histogram.py +0 -0
  102. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/ialaw.py +0 -0
  103. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/interpolate.py +0 -0
  104. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/iulaw.py +0 -0
  105. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/lar2par.py +0 -0
  106. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/lpc2par.py +0 -0
  107. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/lpccheck.py +0 -0
  108. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/lsp2lpc.py +0 -0
  109. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mcep.py +0 -0
  110. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mfcc.py +0 -0
  111. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mgc2sp.py +0 -0
  112. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mgcep.py +0 -0
  113. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mlpg.py +0 -0
  114. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/mpir2c.py +0 -0
  115. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/norm0.py +0 -0
  116. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/par2lar.py +0 -0
  117. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/par2lpc.py +0 -0
  118. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/pitch.py +0 -0
  119. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/plp.py +0 -0
  120. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/pol_root.py +0 -0
  121. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/quantize.py +0 -0
  122. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/rlevdur.py +0 -0
  123. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/root_pol.py +0 -0
  124. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/ulaw.py +0 -0
  125. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/unframe.py +0 -0
  126. {diffsptk-2.1.0 → diffsptk-2.3.0}/diffsptk/modules/yingram.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffsptk
3
- Version: 2.1.0
3
+ Version: 2.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/
@@ -13,24 +13,25 @@ Keywords: dsp,pytorch,signal processing,sptk
13
13
  Classifier: License :: OSI Approved :: Apache Software License
14
14
  Classifier: Programming Language :: Python
15
15
  Classifier: Programming Language :: Python :: 3 :: Only
16
- Classifier: Programming Language :: Python :: 3.8
17
16
  Classifier: Programming Language :: Python :: 3.9
18
17
  Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
21
- Requires-Python: >=3.8
20
+ Requires-Python: >=3.9
22
21
  Requires-Dist: librosa>=0.10.1
23
- Requires-Dist: numpy<2.0.0
24
- Requires-Dist: scipy<1.14.0
22
+ Requires-Dist: numpy<2.0.0,>=1.20.3
23
+ Requires-Dist: scipy<1.14.0,>=1.5.4
25
24
  Requires-Dist: soundfile>=0.10.2
26
- Requires-Dist: torch>=1.11.0
27
- Requires-Dist: torchaudio>=0.11.0
28
- Requires-Dist: torchcomp>=0.1.1
29
- Requires-Dist: torchcrepe>=0.0.21
25
+ Requires-Dist: torch>=2.0.0
26
+ Requires-Dist: torchaudio>=2.0.1
27
+ Requires-Dist: torchcomp>=0.1.0
28
+ Requires-Dist: torchcrepe>=0.0.22
30
29
  Requires-Dist: torchlpc>=0.2.0
31
- Requires-Dist: vector-quantize-pytorch<=1.12.12,>=0.8.0
30
+ Requires-Dist: tqdm>=4.15.0
31
+ Requires-Dist: vector-quantize-pytorch>=1.14.9
32
32
  Provides-Extra: dev
33
33
  Requires-Dist: build; extra == 'dev'
34
+ Requires-Dist: docstrfmt; extra == 'dev'
34
35
  Requires-Dist: isort; extra == 'dev'
35
36
  Requires-Dist: mdformat; extra == 'dev'
36
37
  Requires-Dist: numpydoc; extra == 'dev'
@@ -47,10 +48,10 @@ Description-Content-Type: text/markdown
47
48
  *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
48
49
 
49
50
  [![Latest Manual](https://img.shields.io/badge/docs-latest-blue.svg)](https://sp-nitech.github.io/diffsptk/latest/)
50
- [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.1.0/)
51
+ [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.3.0/)
51
52
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
52
53
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
53
- [![PyTorch Version](https://img.shields.io/badge/pytorch-1.12.0%20%7C%202.3.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
54
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-2.0.0%20%7C%202.5.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
54
55
  [![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
55
56
  [![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
56
57
  [![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
@@ -59,8 +60,8 @@ Description-Content-Type: text/markdown
59
60
 
60
61
  ## Requirements
61
62
 
62
- - Python 3.8+
63
- - PyTorch 1.12.0+
63
+ - Python 3.9+
64
+ - PyTorch 2.0.0+
64
65
 
65
66
  ## Documentation
66
67
 
@@ -106,7 +107,7 @@ mcep = diffsptk.MelCepstralAnalysis(cep_order=M, fft_length=n_fft, alpha=alpha,
106
107
  mc = mcep(X)
107
108
 
108
109
  # Reconstruct x.
109
- mlsa = diffsptk.MLSA(filter_order=M, frame_period=fp, alpha=alpha, taylor_order=30)
110
+ mlsa = diffsptk.MLSA(filter_order=M, frame_period=fp, alpha=alpha, taylor_order=20)
110
111
  x_hat = mlsa(mlsa(x, -mc), mc)
111
112
 
112
113
  # Write reconstructed waveform.
@@ -134,6 +135,41 @@ diffsptk.write("voiced.wav", x_voiced, sr)
134
135
  diffsptk.write("unvoiced.wav", x_unvoiced, sr)
135
136
  ```
136
137
 
138
+ ### LPC analysis and synthesis
139
+
140
+ ```python
141
+ import diffsptk
142
+
143
+ fl = 400 # Frame length.
144
+ fp = 80 # Frame period.
145
+ M = 24 # LPC dimensions.
146
+
147
+ # Read waveform.
148
+ x, sr = diffsptk.read("assets/data.wav")
149
+
150
+ # Estimate LPC of x.
151
+ frame = diffsptk.Frame(frame_length=fl, frame_period=fp)
152
+ window = diffsptk.Window(in_length=fl)
153
+ lpc = diffsptk.LPC(frame_length=fl, lpc_order=M, eps=1e-6)
154
+ a = lpc(window(frame(x)))
155
+
156
+ # Convert to inverse filter coefficients.
157
+ norm0 = diffsptk.AllPoleToAllZeroDigitalFilterCoefficients(filter_order=M)
158
+ b = norm0(a)
159
+
160
+ # Reconstruct x.
161
+ zerodf = diffsptk.AllZeroDigitalFilter(filter_order=M, frame_period=fp)
162
+ poledf = diffsptk.AllPoleDigitalFilter(filter_order=M, frame_period=fp)
163
+ x_hat = poledf(zerodf(x, b), a)
164
+
165
+ # Write reconstructed waveform.
166
+ diffsptk.write("reconst.wav", x_hat, sr)
167
+
168
+ # Compute error.
169
+ error = (x_hat - x).abs().sum()
170
+ print(error)
171
+ ```
172
+
137
173
  ### Mel-spectrogram, MFCC, and PLP extraction
138
174
 
139
175
  ```python
@@ -152,8 +188,8 @@ x, sr = diffsptk.read("assets/data.wav")
152
188
  stft = diffsptk.STFT(frame_length=fl, frame_period=fp, fft_length=n_fft)
153
189
  X = stft(x)
154
190
 
155
- # Extract mel-spectrogram.
156
- fbank = diffsptk.FBANK(
191
+ # Extract log mel-spectrogram.
192
+ fbank = diffsptk.MelFilterBankAnalysis(
157
193
  n_channel=n_channel,
158
194
  fft_length=n_fft,
159
195
  sample_rate=sr,
@@ -211,6 +247,30 @@ error = (x_hat - x).abs().sum()
211
247
  print(error)
212
248
  ```
213
249
 
250
+ ### Gammatone filter bank analysis and synthesis
251
+
252
+ ```python
253
+ import diffsptk
254
+
255
+ # Read waveform.
256
+ x, sr = diffsptk.read("assets/data.wav")
257
+
258
+ # Decompose x.
259
+ gammatone = diffsptk.GammatoneFilterBankAnalysis(sr)
260
+ y = gammatone(x)
261
+
262
+ # Reconstruct x.
263
+ igammatone = diffsptk.GammatoneFilterBankSynthesis(sr)
264
+ x_hat = igammatone(y).reshape(-1)
265
+
266
+ # Write reconstructed waveform.
267
+ diffsptk.write("reconst.wav", x_hat, sr)
268
+
269
+ # Compute error.
270
+ error = (x_hat - x).abs().sum()
271
+ print(error)
272
+ ```
273
+
214
274
  ### Constant-Q transform
215
275
 
216
276
  ```python
@@ -240,6 +300,32 @@ error = (x_hat - x).abs().sum()
240
300
  print(error)
241
301
  ```
242
302
 
303
+ ### Modified discrete cosine transform
304
+
305
+ ```python
306
+ import diffsptk
307
+
308
+ fl = 512 # Frame length.
309
+
310
+ # Read waveform.
311
+ x, sr = diffsptk.read("assets/data.wav")
312
+
313
+ # Transform x.
314
+ mdct = diffsptk.MDCT(fl)
315
+ c = mdct(x)
316
+
317
+ # Reconstruct x.
318
+ imdct = diffpstk.IMDCT(fl)
319
+ x_hat = imdct(c, out_length=x.size(0))
320
+
321
+ # Write reconstructed waveform.
322
+ diffsptk.write("reconst.wav", x_hat, sr)
323
+
324
+ # Compute error.
325
+ error = (x_hat - x).abs().sum()
326
+ print(error)
327
+ ```
328
+
243
329
  ### Vector quantization
244
330
 
245
331
  ```python
@@ -3,10 +3,10 @@
3
3
  *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
4
4
 
5
5
  [![Latest Manual](https://img.shields.io/badge/docs-latest-blue.svg)](https://sp-nitech.github.io/diffsptk/latest/)
6
- [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.1.0/)
6
+ [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.3.0/)
7
7
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
8
8
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
9
- [![PyTorch Version](https://img.shields.io/badge/pytorch-1.12.0%20%7C%202.3.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
9
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-2.0.0%20%7C%202.5.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
10
10
  [![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
11
11
  [![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
12
12
  [![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
@@ -15,8 +15,8 @@
15
15
 
16
16
  ## Requirements
17
17
 
18
- - Python 3.8+
19
- - PyTorch 1.12.0+
18
+ - Python 3.9+
19
+ - PyTorch 2.0.0+
20
20
 
21
21
  ## Documentation
22
22
 
@@ -62,7 +62,7 @@ mcep = diffsptk.MelCepstralAnalysis(cep_order=M, fft_length=n_fft, alpha=alpha,
62
62
  mc = mcep(X)
63
63
 
64
64
  # Reconstruct x.
65
- mlsa = diffsptk.MLSA(filter_order=M, frame_period=fp, alpha=alpha, taylor_order=30)
65
+ mlsa = diffsptk.MLSA(filter_order=M, frame_period=fp, alpha=alpha, taylor_order=20)
66
66
  x_hat = mlsa(mlsa(x, -mc), mc)
67
67
 
68
68
  # Write reconstructed waveform.
@@ -90,6 +90,41 @@ diffsptk.write("voiced.wav", x_voiced, sr)
90
90
  diffsptk.write("unvoiced.wav", x_unvoiced, sr)
91
91
  ```
92
92
 
93
+ ### LPC analysis and synthesis
94
+
95
+ ```python
96
+ import diffsptk
97
+
98
+ fl = 400 # Frame length.
99
+ fp = 80 # Frame period.
100
+ M = 24 # LPC dimensions.
101
+
102
+ # Read waveform.
103
+ x, sr = diffsptk.read("assets/data.wav")
104
+
105
+ # Estimate LPC of x.
106
+ frame = diffsptk.Frame(frame_length=fl, frame_period=fp)
107
+ window = diffsptk.Window(in_length=fl)
108
+ lpc = diffsptk.LPC(frame_length=fl, lpc_order=M, eps=1e-6)
109
+ a = lpc(window(frame(x)))
110
+
111
+ # Convert to inverse filter coefficients.
112
+ norm0 = diffsptk.AllPoleToAllZeroDigitalFilterCoefficients(filter_order=M)
113
+ b = norm0(a)
114
+
115
+ # Reconstruct x.
116
+ zerodf = diffsptk.AllZeroDigitalFilter(filter_order=M, frame_period=fp)
117
+ poledf = diffsptk.AllPoleDigitalFilter(filter_order=M, frame_period=fp)
118
+ x_hat = poledf(zerodf(x, b), a)
119
+
120
+ # Write reconstructed waveform.
121
+ diffsptk.write("reconst.wav", x_hat, sr)
122
+
123
+ # Compute error.
124
+ error = (x_hat - x).abs().sum()
125
+ print(error)
126
+ ```
127
+
93
128
  ### Mel-spectrogram, MFCC, and PLP extraction
94
129
 
95
130
  ```python
@@ -108,8 +143,8 @@ x, sr = diffsptk.read("assets/data.wav")
108
143
  stft = diffsptk.STFT(frame_length=fl, frame_period=fp, fft_length=n_fft)
109
144
  X = stft(x)
110
145
 
111
- # Extract mel-spectrogram.
112
- fbank = diffsptk.FBANK(
146
+ # Extract log mel-spectrogram.
147
+ fbank = diffsptk.MelFilterBankAnalysis(
113
148
  n_channel=n_channel,
114
149
  fft_length=n_fft,
115
150
  sample_rate=sr,
@@ -167,6 +202,30 @@ error = (x_hat - x).abs().sum()
167
202
  print(error)
168
203
  ```
169
204
 
205
+ ### Gammatone filter bank analysis and synthesis
206
+
207
+ ```python
208
+ import diffsptk
209
+
210
+ # Read waveform.
211
+ x, sr = diffsptk.read("assets/data.wav")
212
+
213
+ # Decompose x.
214
+ gammatone = diffsptk.GammatoneFilterBankAnalysis(sr)
215
+ y = gammatone(x)
216
+
217
+ # Reconstruct x.
218
+ igammatone = diffsptk.GammatoneFilterBankSynthesis(sr)
219
+ x_hat = igammatone(y).reshape(-1)
220
+
221
+ # Write reconstructed waveform.
222
+ diffsptk.write("reconst.wav", x_hat, sr)
223
+
224
+ # Compute error.
225
+ error = (x_hat - x).abs().sum()
226
+ print(error)
227
+ ```
228
+
170
229
  ### Constant-Q transform
171
230
 
172
231
  ```python
@@ -196,6 +255,32 @@ error = (x_hat - x).abs().sum()
196
255
  print(error)
197
256
  ```
198
257
 
258
+ ### Modified discrete cosine transform
259
+
260
+ ```python
261
+ import diffsptk
262
+
263
+ fl = 512 # Frame length.
264
+
265
+ # Read waveform.
266
+ x, sr = diffsptk.read("assets/data.wav")
267
+
268
+ # Transform x.
269
+ mdct = diffsptk.MDCT(fl)
270
+ c = mdct(x)
271
+
272
+ # Reconstruct x.
273
+ imdct = diffpstk.IMDCT(fl)
274
+ x_hat = imdct(c, out_length=x.size(0))
275
+
276
+ # Write reconstructed waveform.
277
+ diffsptk.write("reconst.wav", x_hat, sr)
278
+
279
+ # Compute error.
280
+ error = (x_hat - x).abs().sum()
281
+ print(error)
282
+ ```
283
+
199
284
  ### Vector quantization
200
285
 
201
286
  ```python