diffsptk 2.5.0__tar.gz → 3.0.1__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 (163) hide show
  1. {diffsptk-2.5.0 → diffsptk-3.0.1}/.gitignore +1 -1
  2. {diffsptk-2.5.0 → diffsptk-3.0.1}/LICENSE +1 -1
  3. {diffsptk-2.5.0 → diffsptk-3.0.1}/PKG-INFO +33 -11
  4. {diffsptk-2.5.0 → diffsptk-3.0.1}/README.md +31 -9
  5. diffsptk-3.0.1/diffsptk/__init__.py +24 -0
  6. diffsptk-3.0.1/diffsptk/functional.py +2883 -0
  7. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/__init__.py +19 -1
  8. diffsptk-3.0.1/diffsptk/modules/acorr.py +120 -0
  9. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/acr2csm.py +63 -43
  10. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/alaw.py +41 -27
  11. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ap.py +128 -49
  12. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/b2mc.py +43 -25
  13. diffsptk-3.0.1/diffsptk/modules/base.py +59 -0
  14. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/c2acr.py +40 -21
  15. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/c2mpir.py +43 -23
  16. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/c2ndps.py +48 -30
  17. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/cdist.py +41 -23
  18. diffsptk-3.0.1/diffsptk/modules/chroma.py +141 -0
  19. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/cqt.py +60 -43
  20. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/csm2acr.py +47 -30
  21. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/dct.py +52 -35
  22. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/decimate.py +41 -23
  23. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/delay.py +53 -35
  24. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/delta.py +69 -41
  25. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/dequantize.py +47 -27
  26. diffsptk-3.0.1/diffsptk/modules/df2.py +143 -0
  27. diffsptk-3.0.1/diffsptk/modules/dfs.py +157 -0
  28. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/dht.py +46 -30
  29. diffsptk-3.0.1/diffsptk/modules/drc.py +198 -0
  30. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/dst.py +50 -33
  31. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/entropy.py +33 -20
  32. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/excite.py +59 -51
  33. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/fbank.py +111 -87
  34. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/fftcep.py +55 -28
  35. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/flux.py +44 -21
  36. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/frame.py +63 -27
  37. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/freqt.py +50 -36
  38. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/freqt2.py +64 -41
  39. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/gammatone.py +39 -34
  40. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/gmm.py +91 -88
  41. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/gnorm.py +41 -28
  42. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/grpdelay.py +64 -48
  43. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/hilbert.py +49 -30
  44. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/hilbert2.py +60 -41
  45. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/histogram.py +68 -38
  46. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ialaw.py +39 -27
  47. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ica.py +36 -32
  48. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/icqt.py +57 -39
  49. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/idct.py +38 -25
  50. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/idht.py +38 -25
  51. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/idst.py +38 -25
  52. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ifreqt2.py +57 -39
  53. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/igammatone.py +41 -37
  54. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ignorm.py +36 -27
  55. diffsptk-3.0.1/diffsptk/modules/imdct.py +213 -0
  56. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/imdst.py +34 -13
  57. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/imglsadf.py +9 -8
  58. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/imsvq.py +8 -7
  59. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/interpolate.py +42 -26
  60. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ipnorm.py +36 -14
  61. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ipqmf.py +25 -19
  62. diffsptk-3.0.1/diffsptk/modules/is2par.py +91 -0
  63. diffsptk-3.0.1/diffsptk/modules/istft.py +153 -0
  64. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/iulaw.py +38 -26
  65. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ivq.py +7 -6
  66. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/lar2par.py +36 -16
  67. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/lbg.py +65 -48
  68. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/levdur.py +44 -26
  69. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/linear_intpl.py +41 -23
  70. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/lpc.py +63 -17
  71. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/lpc2lsp.py +90 -62
  72. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/lpc2par.py +45 -27
  73. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/lpccheck.py +42 -27
  74. diffsptk-3.0.1/diffsptk/modules/lsp2lpc.py +180 -0
  75. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/lsp2sp.py +98 -85
  76. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/lspcheck.py +53 -32
  77. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/magic_intpl.py +38 -23
  78. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/mc2b.py +45 -28
  79. diffsptk-3.0.1/diffsptk/modules/mcep.py +271 -0
  80. diffsptk-3.0.1/diffsptk/modules/mcpf.py +184 -0
  81. diffsptk-3.0.1/diffsptk/modules/mdct.py +226 -0
  82. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/mdst.py +33 -12
  83. diffsptk-3.0.1/diffsptk/modules/mfcc.py +212 -0
  84. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/mgc2mgc.py +220 -206
  85. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/mgc2sp.py +90 -64
  86. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/mgcep.py +110 -85
  87. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/mglsadf.py +88 -100
  88. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/mlpg.py +54 -33
  89. diffsptk-3.0.1/diffsptk/modules/mlsacheck.py +216 -0
  90. diffsptk-3.0.1/diffsptk/modules/mpir2c.py +104 -0
  91. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/msvq.py +26 -18
  92. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ndps2c.py +51 -33
  93. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/nmf.py +62 -39
  94. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/norm0.py +34 -14
  95. diffsptk-3.0.1/diffsptk/modules/par2is.py +94 -0
  96. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/par2lar.py +38 -16
  97. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/par2lpc.py +41 -27
  98. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/pca.py +44 -38
  99. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/phase.py +40 -18
  100. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/pitch.py +75 -65
  101. diffsptk-3.0.1/diffsptk/modules/pitch_spec.py +528 -0
  102. diffsptk-3.0.1/diffsptk/modules/plp.py +279 -0
  103. diffsptk-3.0.1/diffsptk/modules/pnorm.py +127 -0
  104. diffsptk-3.0.1/diffsptk/modules/pol_root.py +123 -0
  105. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/poledf.py +46 -22
  106. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/pqmf.py +57 -45
  107. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/quantize.py +50 -27
  108. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/rlevdur.py +42 -27
  109. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/rmse.py +34 -16
  110. diffsptk-3.0.1/diffsptk/modules/root_pol.py +138 -0
  111. diffsptk-3.0.1/diffsptk/modules/smcep.py +298 -0
  112. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/snr.py +54 -29
  113. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/spec.py +74 -48
  114. diffsptk-3.0.1/diffsptk/modules/stft.py +189 -0
  115. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/ulaw.py +39 -25
  116. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/unframe.py +75 -51
  117. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/vq.py +22 -15
  118. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/wht.py +48 -33
  119. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/window.py +73 -45
  120. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/yingram.py +91 -81
  121. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/zcross.py +38 -19
  122. {diffsptk-2.5.0 → diffsptk-3.0.1}/diffsptk/modules/zerodf.py +47 -22
  123. {diffsptk-2.5.0/diffsptk/misc → diffsptk-3.0.1/diffsptk}/signals.py +49 -35
  124. diffsptk-3.0.1/diffsptk/third_party/world/LICENSE +39 -0
  125. diffsptk-3.0.1/diffsptk/third_party/world/__init__.py +1 -0
  126. diffsptk-2.5.0/diffsptk/misc/world.py → diffsptk-3.0.1/diffsptk/third_party/world/common.py +40 -3
  127. diffsptk-3.0.1/diffsptk/typing.py +34 -0
  128. diffsptk-3.0.1/diffsptk/utils/__init__.py +19 -0
  129. diffsptk-2.5.0/diffsptk/misc/utils.py → diffsptk-3.0.1/diffsptk/utils/private.py +86 -211
  130. diffsptk-3.0.1/diffsptk/utils/public.py +179 -0
  131. diffsptk-3.0.1/diffsptk/version.py +1 -0
  132. {diffsptk-2.5.0 → diffsptk-3.0.1}/pyproject.toml +4 -6
  133. diffsptk-2.5.0/diffsptk/__init__.py +0 -6
  134. diffsptk-2.5.0/diffsptk/functional.py +0 -2427
  135. diffsptk-2.5.0/diffsptk/misc/__init__.py +0 -5
  136. diffsptk-2.5.0/diffsptk/modules/acorr.py +0 -110
  137. diffsptk-2.5.0/diffsptk/modules/chroma.py +0 -131
  138. diffsptk-2.5.0/diffsptk/modules/df2.py +0 -103
  139. diffsptk-2.5.0/diffsptk/modules/dfs.py +0 -112
  140. diffsptk-2.5.0/diffsptk/modules/drc.py +0 -183
  141. diffsptk-2.5.0/diffsptk/modules/imdct.py +0 -160
  142. diffsptk-2.5.0/diffsptk/modules/istft.py +0 -117
  143. diffsptk-2.5.0/diffsptk/modules/lsp2lpc.py +0 -120
  144. diffsptk-2.5.0/diffsptk/modules/mcep.py +0 -138
  145. diffsptk-2.5.0/diffsptk/modules/mcpf.py +0 -109
  146. diffsptk-2.5.0/diffsptk/modules/mdct.py +0 -163
  147. diffsptk-2.5.0/diffsptk/modules/mfcc.py +0 -139
  148. diffsptk-2.5.0/diffsptk/modules/mlsacheck.py +0 -206
  149. diffsptk-2.5.0/diffsptk/modules/mpir2c.py +0 -84
  150. diffsptk-2.5.0/diffsptk/modules/pitch_spec.py +0 -185
  151. diffsptk-2.5.0/diffsptk/modules/plp.py +0 -172
  152. diffsptk-2.5.0/diffsptk/modules/pnorm.py +0 -87
  153. diffsptk-2.5.0/diffsptk/modules/pol_root.py +0 -78
  154. diffsptk-2.5.0/diffsptk/modules/root_pol.py +0 -104
  155. diffsptk-2.5.0/diffsptk/modules/smcep.py +0 -182
  156. diffsptk-2.5.0/diffsptk/modules/stft.py +0 -144
  157. diffsptk-2.5.0/diffsptk/version.py +0 -1
  158. {diffsptk-2.5.0 → diffsptk-3.0.1}/CITATION.cff +0 -0
  159. {diffsptk-2.5.0/diffsptk/misc → diffsptk-3.0.1/diffsptk/third_party}/librosa/LICENSE +0 -0
  160. {diffsptk-2.5.0/diffsptk/misc → diffsptk-3.0.1/diffsptk/third_party}/librosa/__init__.py +0 -0
  161. {diffsptk-2.5.0/diffsptk/misc → diffsptk-3.0.1/diffsptk/third_party}/librosa/constantq.py +0 -0
  162. {diffsptk-2.5.0/diffsptk/misc → diffsptk-3.0.1/diffsptk/third_party}/librosa/filters.py +0 -0
  163. {diffsptk-2.5.0/diffsptk/misc → diffsptk-3.0.1/diffsptk/third_party}/librosa/util.py +0 -0
@@ -7,7 +7,7 @@ dist/
7
7
  coverage.xml
8
8
 
9
9
  # docs
10
- _build/
10
+ build/
11
11
 
12
12
  # tools
13
13
  tools/**/
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright [yyyy] [name of copyright owner]
190
+ Copyright 2022 SPTK Working Group
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffsptk
3
- Version: 2.5.0
3
+ Version: 3.0.1
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/
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.13
20
20
  Requires-Python: >=3.10
21
21
  Requires-Dist: numpy>=1.23.0
22
22
  Requires-Dist: penn>=0.0.1
23
+ Requires-Dist: pylstraight>=0.1.0
23
24
  Requires-Dist: scipy>=1.12.0
24
25
  Requires-Dist: soundfile>=0.10.2
25
26
  Requires-Dist: torch>=2.3.1
@@ -31,7 +32,6 @@ Requires-Dist: vector-quantize-pytorch>=1.14.9
31
32
  Provides-Extra: dev
32
33
  Requires-Dist: build; extra == 'dev'
33
34
  Requires-Dist: codespell; extra == 'dev'
34
- Requires-Dist: docstrfmt; extra == 'dev'
35
35
  Requires-Dist: mdformat; extra == 'dev'
36
36
  Requires-Dist: numpydoc; extra == 'dev'
37
37
  Requires-Dist: pkginfo; extra == 'dev'
@@ -47,9 +47,9 @@ 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
- [![Latest Manual](https://img.shields.io/badge/docs-latest-blue.svg)](https://sp-nitech.github.io/diffsptk/latest/)
51
- [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.5.0/)
50
+ [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/3.0.1/)
52
51
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
52
+ [![ClickPy](https://img.shields.io/badge/downloads-clickpy-yellow.svg)](https://clickpy.clickhouse.com/dashboard/diffsptk)
53
53
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
54
54
  [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.6.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
55
55
  [![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
@@ -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/latest/) for the reference manual.
68
+ - See [this page](https://sp-nitech.github.io/diffsptk/3.0.1/) 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
@@ -84,6 +84,26 @@ pip install git+https://github.com/sp-nitech/diffsptk.git@master
84
84
 
85
85
  ## Examples
86
86
 
87
+ ### Running on a GPU
88
+
89
+ ```python
90
+ import diffsptk
91
+
92
+ stft_params = {"frame_length": 400, "frame_period": 80, "fft_length": 512}
93
+
94
+ # Read waveform.
95
+ x, sr = diffsptk.read("assets/data.wav", device="cuda")
96
+
97
+ # Compute spectrogram using a nn.Module class.
98
+ X1 = diffsptk.STFT(**stft_params).to("cuda")(x)
99
+
100
+ # Compute spectrogram using a functional method.
101
+ X2 = diffsptk.functional.stft(x, **stft_params)
102
+
103
+ assert X1.device == X2.device
104
+ assert X1.allclose(X2)
105
+ ```
106
+
87
107
  ### Mel-cepstral analysis and synthesis
88
108
 
89
109
  ```python
@@ -104,8 +124,8 @@ X = stft(x)
104
124
  # Estimate mel-cepstrum of x.
105
125
  alpha = diffsptk.get_alpha(sr)
106
126
  mcep = diffsptk.MelCepstralAnalysis(
107
- cep_order=M,
108
127
  fft_length=n_fft,
128
+ cep_order=M,
109
129
  alpha=alpha,
110
130
  n_iter=10,
111
131
  )
@@ -185,12 +205,14 @@ pitch_spec = diffsptk.PitchAdaptiveSpectralAnalysis(
185
205
  frame_period=fp,
186
206
  sample_rate=sr,
187
207
  fft_length=n_fft,
208
+ algorithm="cheap-trick",
209
+ out_format="power",
188
210
  )
189
211
  H = pitch_spec(x, f0)
190
212
 
191
213
  # Estimate mel-cepstrum of x.
192
214
  alpha = diffsptk.get_alpha(sr)
193
- mcep = diffsptk.MelCepstralAnalysis(cep_order=M, fft_length=n_fft, alpha=alpha)
215
+ mcep = diffsptk.MelCepstralAnalysis(fft_length=n_fft, cep_order=M, alpha=alpha)
194
216
  mc_a = mcep(A)
195
217
  mc_h = mcep(H)
196
218
 
@@ -266,8 +288,8 @@ X = stft(x)
266
288
 
267
289
  # Extract log mel-spectrogram.
268
290
  fbank = diffsptk.MelFilterBankAnalysis(
269
- n_channel=n_channel,
270
291
  fft_length=n_fft,
292
+ n_channel=n_channel,
271
293
  sample_rate=sr,
272
294
  )
273
295
  Y = fbank(X)
@@ -275,9 +297,9 @@ print(Y.shape)
275
297
 
276
298
  # Extract MFCC.
277
299
  mfcc = diffsptk.MFCC(
300
+ fft_length=n_fft,
278
301
  mfcc_order=M,
279
302
  n_channel=n_channel,
280
- fft_length=n_fft,
281
303
  sample_rate=sr,
282
304
  )
283
305
  Y = mfcc(X)
@@ -285,9 +307,9 @@ print(Y.shape)
285
307
 
286
308
  # Extract PLP.
287
309
  plp = diffsptk.PLP(
310
+ fft_length=n_fft,
288
311
  plp_order=M,
289
312
  n_channel=n_channel,
290
- fft_length=n_fft,
291
313
  sample_rate=sr,
292
314
  )
293
315
  Y = plp(X)
@@ -391,7 +413,7 @@ mdct = diffsptk.MDCT(fl)
391
413
  c = mdct(x)
392
414
 
393
415
  # Reconstruct x.
394
- imdct = diffpstk.IMDCT(fl)
416
+ imdct = diffsptk.IMDCT(fl)
395
417
  x_hat = imdct(c, out_length=x.size(0))
396
418
 
397
419
  # Write reconstructed waveform.
@@ -2,9 +2,9 @@
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
- [![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.5.0/)
5
+ [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/3.0.1/)
7
6
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
7
+ [![ClickPy](https://img.shields.io/badge/downloads-clickpy-yellow.svg)](https://clickpy.clickhouse.com/dashboard/diffsptk)
8
8
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
9
9
  [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.6.0-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)
@@ -20,7 +20,7 @@
20
20
 
21
21
  ## Documentation
22
22
 
23
- - See [this page](https://sp-nitech.github.io/diffsptk/latest/) for the reference manual.
23
+ - See [this page](https://sp-nitech.github.io/diffsptk/3.0.1/) 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
@@ -39,6 +39,26 @@ pip install git+https://github.com/sp-nitech/diffsptk.git@master
39
39
 
40
40
  ## Examples
41
41
 
42
+ ### Running on a GPU
43
+
44
+ ```python
45
+ import diffsptk
46
+
47
+ stft_params = {"frame_length": 400, "frame_period": 80, "fft_length": 512}
48
+
49
+ # Read waveform.
50
+ x, sr = diffsptk.read("assets/data.wav", device="cuda")
51
+
52
+ # Compute spectrogram using a nn.Module class.
53
+ X1 = diffsptk.STFT(**stft_params).to("cuda")(x)
54
+
55
+ # Compute spectrogram using a functional method.
56
+ X2 = diffsptk.functional.stft(x, **stft_params)
57
+
58
+ assert X1.device == X2.device
59
+ assert X1.allclose(X2)
60
+ ```
61
+
42
62
  ### Mel-cepstral analysis and synthesis
43
63
 
44
64
  ```python
@@ -59,8 +79,8 @@ X = stft(x)
59
79
  # Estimate mel-cepstrum of x.
60
80
  alpha = diffsptk.get_alpha(sr)
61
81
  mcep = diffsptk.MelCepstralAnalysis(
62
- cep_order=M,
63
82
  fft_length=n_fft,
83
+ cep_order=M,
64
84
  alpha=alpha,
65
85
  n_iter=10,
66
86
  )
@@ -140,12 +160,14 @@ pitch_spec = diffsptk.PitchAdaptiveSpectralAnalysis(
140
160
  frame_period=fp,
141
161
  sample_rate=sr,
142
162
  fft_length=n_fft,
163
+ algorithm="cheap-trick",
164
+ out_format="power",
143
165
  )
144
166
  H = pitch_spec(x, f0)
145
167
 
146
168
  # Estimate mel-cepstrum of x.
147
169
  alpha = diffsptk.get_alpha(sr)
148
- mcep = diffsptk.MelCepstralAnalysis(cep_order=M, fft_length=n_fft, alpha=alpha)
170
+ mcep = diffsptk.MelCepstralAnalysis(fft_length=n_fft, cep_order=M, alpha=alpha)
149
171
  mc_a = mcep(A)
150
172
  mc_h = mcep(H)
151
173
 
@@ -221,8 +243,8 @@ X = stft(x)
221
243
 
222
244
  # Extract log mel-spectrogram.
223
245
  fbank = diffsptk.MelFilterBankAnalysis(
224
- n_channel=n_channel,
225
246
  fft_length=n_fft,
247
+ n_channel=n_channel,
226
248
  sample_rate=sr,
227
249
  )
228
250
  Y = fbank(X)
@@ -230,9 +252,9 @@ print(Y.shape)
230
252
 
231
253
  # Extract MFCC.
232
254
  mfcc = diffsptk.MFCC(
255
+ fft_length=n_fft,
233
256
  mfcc_order=M,
234
257
  n_channel=n_channel,
235
- fft_length=n_fft,
236
258
  sample_rate=sr,
237
259
  )
238
260
  Y = mfcc(X)
@@ -240,9 +262,9 @@ print(Y.shape)
240
262
 
241
263
  # Extract PLP.
242
264
  plp = diffsptk.PLP(
265
+ fft_length=n_fft,
243
266
  plp_order=M,
244
267
  n_channel=n_channel,
245
- fft_length=n_fft,
246
268
  sample_rate=sr,
247
269
  )
248
270
  Y = plp(X)
@@ -346,7 +368,7 @@ mdct = diffsptk.MDCT(fl)
346
368
  c = mdct(x)
347
369
 
348
370
  # Reconstruct x.
349
- imdct = diffpstk.IMDCT(fl)
371
+ imdct = diffsptk.IMDCT(fl)
350
372
  x_hat = imdct(c, out_length=x.size(0))
351
373
 
352
374
  # Write reconstructed waveform.
@@ -0,0 +1,24 @@
1
+ # ------------------------------------------------------------------------ #
2
+ # Copyright 2022 SPTK Working Group #
3
+ # #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); #
5
+ # you may not use this file except in compliance with the License. #
6
+ # You may obtain a copy of the License at #
7
+ # #
8
+ # http://www.apache.org/licenses/LICENSE-2.0 #
9
+ # #
10
+ # Unless required by applicable law or agreed to in writing, software #
11
+ # distributed under the License is distributed on an "AS IS" BASIS, #
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
+ # See the License for the specific language governing permissions and #
14
+ # limitations under the License. #
15
+ # ------------------------------------------------------------------------ #
16
+
17
+ from . import functional
18
+ from . import modules
19
+ from . import signals
20
+ from . import utils
21
+ from .modules import *
22
+ from .signals import *
23
+ from .utils import *
24
+ from .version import __version__