diffsptk 3.4.0__tar.gz → 3.5.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 (150) hide show
  1. {diffsptk-3.4.0 → diffsptk-3.5.0}/PKG-INFO +15 -12
  2. {diffsptk-3.4.0 → diffsptk-3.5.0}/README.md +10 -9
  3. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/functional.py +67 -37
  4. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/__init__.py +1 -1
  5. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/acorr.py +3 -4
  6. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/acr2csm.py +2 -2
  7. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/excite.py +20 -12
  8. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/f0eval.py +2 -2
  9. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/fftcep.py +3 -3
  10. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/gmm.py +2 -0
  11. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/levdur.py +4 -3
  12. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lpc.py +2 -1
  13. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mcep.py +3 -3
  14. diffsptk-3.5.0/diffsptk/modules/medfilt.py +144 -0
  15. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mgc2mgc.py +1 -1
  16. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mglsadf.py +286 -51
  17. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/pitch.py +2 -2
  18. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/rlevdur.py +19 -25
  19. diffsptk-3.5.0/diffsptk/modules/zerodf.py +236 -0
  20. diffsptk-3.5.0/diffsptk/version.py +1 -0
  21. {diffsptk-3.4.0 → diffsptk-3.5.0}/pyproject.toml +4 -2
  22. diffsptk-3.4.0/diffsptk/modules/hilbert2.py +0 -133
  23. diffsptk-3.4.0/diffsptk/modules/zerodf.py +0 -118
  24. diffsptk-3.4.0/diffsptk/version.py +0 -1
  25. {diffsptk-3.4.0 → diffsptk-3.5.0}/.gitignore +0 -0
  26. {diffsptk-3.4.0 → diffsptk-3.5.0}/CITATION.cff +0 -0
  27. {diffsptk-3.4.0 → diffsptk-3.5.0}/LICENSE +0 -0
  28. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/__init__.py +0 -0
  29. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/alaw.py +0 -0
  30. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ap.py +0 -0
  31. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/b2mc.py +0 -0
  32. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/base.py +0 -0
  33. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/c2acr.py +0 -0
  34. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/c2mpir.py +0 -0
  35. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/c2ndps.py +0 -0
  36. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/cdist.py +0 -0
  37. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/chroma.py +0 -0
  38. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/cqt.py +0 -0
  39. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/csm2acr.py +0 -0
  40. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/dct.py +0 -0
  41. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/decimate.py +0 -0
  42. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/delay.py +0 -0
  43. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/delta.py +0 -0
  44. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/dequantize.py +0 -0
  45. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/df2.py +0 -0
  46. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/dfs.py +0 -0
  47. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/dht.py +0 -0
  48. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/drc.py +0 -0
  49. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/dst.py +0 -0
  50. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/dtw.py +0 -0
  51. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/entropy.py +0 -0
  52. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/fbank.py +0 -0
  53. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/fftr.py +0 -0
  54. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/flux.py +0 -0
  55. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/frame.py +0 -0
  56. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/freqt.py +0 -0
  57. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/freqt2.py +0 -0
  58. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/gammatone.py +0 -0
  59. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/gnorm.py +0 -0
  60. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/griffin.py +0 -0
  61. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/grpdelay.py +0 -0
  62. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/hilbert.py +0 -0
  63. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/histogram.py +0 -0
  64. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ialaw.py +0 -0
  65. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ica.py +0 -0
  66. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/icqt.py +0 -0
  67. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/idct.py +0 -0
  68. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/idht.py +0 -0
  69. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/idst.py +0 -0
  70. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ifbank.py +0 -0
  71. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ifftr.py +0 -0
  72. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ifreqt2.py +0 -0
  73. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/igammatone.py +0 -0
  74. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ignorm.py +0 -0
  75. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/imdct.py +0 -0
  76. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/imdst.py +0 -0
  77. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/imglsadf.py +0 -0
  78. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/imsvq.py +0 -0
  79. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/interpolate.py +0 -0
  80. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ipnorm.py +0 -0
  81. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ipqmf.py +0 -0
  82. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/is2par.py +0 -0
  83. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/istft.py +0 -0
  84. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/iulaw.py +0 -0
  85. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ivq.py +0 -0
  86. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lar2par.py +0 -0
  87. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lbg.py +0 -0
  88. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/linear_intpl.py +0 -0
  89. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lpc2lsp.py +0 -0
  90. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lpc2par.py +0 -0
  91. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lpccheck.py +0 -0
  92. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lsp2lpc.py +0 -0
  93. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lsp2sp.py +0 -0
  94. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/lspcheck.py +0 -0
  95. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/magic_intpl.py +0 -0
  96. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mc2b.py +0 -0
  97. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mcpf.py +0 -0
  98. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mdct.py +0 -0
  99. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mdst.py +0 -0
  100. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mfcc.py +0 -0
  101. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mgc2sp.py +0 -0
  102. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mgcep.py +0 -0
  103. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mlpg.py +0 -0
  104. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mlsacheck.py +0 -0
  105. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/mpir2c.py +0 -0
  106. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/msvq.py +0 -0
  107. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ndps2c.py +0 -0
  108. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/nmf.py +0 -0
  109. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/norm0.py +0 -0
  110. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/oband.py +0 -0
  111. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/par2is.py +0 -0
  112. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/par2lar.py +0 -0
  113. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/par2lpc.py +0 -0
  114. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/pca.py +0 -0
  115. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/phase.py +0 -0
  116. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/pitch_spec.py +0 -0
  117. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/plp.py +0 -0
  118. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/pnorm.py +0 -0
  119. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/pol_root.py +0 -0
  120. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/poledf.py +0 -0
  121. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/pqmf.py +0 -0
  122. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/quantize.py +0 -0
  123. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/rmse.py +0 -0
  124. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/root_pol.py +0 -0
  125. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/smcep.py +0 -0
  126. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/snr.py +0 -0
  127. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/spec.py +0 -0
  128. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/stft.py +0 -0
  129. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/ulaw.py +0 -0
  130. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/unframe.py +0 -0
  131. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/vq.py +0 -0
  132. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/wht.py +0 -0
  133. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/window.py +0 -0
  134. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/world_synth.py +0 -0
  135. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/yingram.py +0 -0
  136. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/modules/zcross.py +0 -0
  137. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/signals.py +0 -0
  138. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/librosa/LICENSE +0 -0
  139. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/librosa/__init__.py +0 -0
  140. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/librosa/constantq.py +0 -0
  141. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/librosa/filters.py +0 -0
  142. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/librosa/typing.py +0 -0
  143. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/librosa/util.py +0 -0
  144. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/world/LICENSE +0 -0
  145. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/world/__init__.py +0 -0
  146. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/third_party/world/common.py +0 -0
  147. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/typing.py +0 -0
  148. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/utils/__init__.py +0 -0
  149. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/utils/private.py +0 -0
  150. {diffsptk-3.4.0 → diffsptk-3.5.0}/diffsptk/utils/public.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffsptk
3
- Version: 3.4.0
3
+ Version: 3.5.0
4
4
  Summary: Speech signal processing modules for machine learning
5
5
  Project-URL: Homepage, https://sp-tk.sourceforge.net/
6
- Project-URL: Documentation, https://sp-nitech.github.io/diffsptk/latest/
6
+ Project-URL: Documentation, https://sp-nitech.github.io/diffsptk/stable/
7
7
  Project-URL: Source, https://github.com/sp-nitech/diffsptk
8
8
  Author: SPTK Working Group
9
9
  Maintainer-email: Takenori Yoshimura <takenori@sp.nitech.ac.jp>
@@ -17,7 +17,9 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
20
21
  Requires-Python: >=3.10
22
+ Requires-Dist: mpmath>=0.17.0
21
23
  Requires-Dist: numpy>=1.23.0
22
24
  Requires-Dist: penn<1.0.0,>=0.0.1
23
25
  Requires-Dist: pylstraight>=0.1.0
@@ -26,7 +28,7 @@ Requires-Dist: soundfile>=0.10.2
26
28
  Requires-Dist: torch>=2.3.1
27
29
  Requires-Dist: torchaudio>=2.3.1
28
30
  Requires-Dist: torchcomp<0.3.0,>=0.1.0
29
- Requires-Dist: torchlpc<0.7.0,>=0.1.0
31
+ Requires-Dist: torchlpc<0.7.0,>=0.4.0
30
32
  Requires-Dist: tqdm>=4.63.0
31
33
  Requires-Dist: vector-quantize-pytorch>=1.14.9
32
34
  Provides-Extra: dev
@@ -45,14 +47,15 @@ Description-Content-Type: text/markdown
45
47
 
46
48
  # diffsptk
47
49
 
48
- *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
50
+ *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) built on the PyTorch framework.
51
+ It provides various speech signal processing modules as PyTorch layers,
52
+ allowing users to integrate classic signal processing algorithms directly into neural network architectures and optimize them through backpropagation.
49
53
 
50
- [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/3.4.0/)
54
+ [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/stable/)
51
55
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
52
56
  [![ClickPy](https://img.shields.io/badge/downloads-clickpy-yellow.svg)](https://clickpy.clickhouse.com/dashboard/diffsptk)
53
- [![Advisor](https://snyk.io/advisor/python/diffsptk/badge.svg)](https://snyk.io/advisor/python/diffsptk)
54
57
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
55
- [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.9.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
58
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.11.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
56
59
  [![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
57
60
  [![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
58
61
  [![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
@@ -66,19 +69,19 @@ Description-Content-Type: text/markdown
66
69
 
67
70
  ## Documentation
68
71
 
69
- - Online [documentation](https://sp-nitech.github.io/diffsptk/3.4.0/) for the reference manual
70
- - Conference [paper](https://www.isca-archive.org/ssw_2023/yoshimura23_ssw.html) on the ISCA Archive
71
- - Hands-on [tutorial](https://colab.research.google.com/drive/1xAoUKqXadvJXJ7RzN0OceB6y7q5i7Sn6?usp=drive_link) on Google Colab
72
+ - [**Reference Manual**](https://sp-nitech.github.io/diffsptk/stable/) - Detailed API documentation and module specifications.
73
+ - [**Interactive Tutorial**](https://colab.research.google.com/drive/1xAoUKqXadvJXJ7RzN0OceB6y7q5i7Sn6?usp=drive_link) (Google Colab) - Hands-on examples to get started with `diffsptk` in your browser.
74
+ - [**Conference Paper**](https://www.isca-archive.org/ssw_2023/yoshimura23_ssw.html) - Technical background and implementation details available on the ISCA Archive.
72
75
 
73
76
  ## Installation
74
77
 
75
- The latest stable release can be installed through PyPI by running
78
+ The latest stable release can be installed via PyPI:
76
79
 
77
80
  ```sh
78
81
  pip install diffsptk
79
82
  ```
80
83
 
81
- The development release can be installed from the master branch:
84
+ Alternatively, the development version can be installed directly from the GitHub repository:
82
85
 
83
86
  ```sh
84
87
  pip install git+https://github.com/sp-nitech/diffsptk.git@master
@@ -1,13 +1,14 @@
1
1
  # diffsptk
2
2
 
3
- *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
3
+ *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) built on the PyTorch framework.
4
+ It provides various speech signal processing modules as PyTorch layers,
5
+ allowing users to integrate classic signal processing algorithms directly into neural network architectures and optimize them through backpropagation.
4
6
 
5
- [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/3.4.0/)
7
+ [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/stable/)
6
8
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
7
9
  [![ClickPy](https://img.shields.io/badge/downloads-clickpy-yellow.svg)](https://clickpy.clickhouse.com/dashboard/diffsptk)
8
- [![Advisor](https://snyk.io/advisor/python/diffsptk/badge.svg)](https://snyk.io/advisor/python/diffsptk)
9
10
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
10
- [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.9.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
11
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.11.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
11
12
  [![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
12
13
  [![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
13
14
  [![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
@@ -21,19 +22,19 @@
21
22
 
22
23
  ## Documentation
23
24
 
24
- - Online [documentation](https://sp-nitech.github.io/diffsptk/3.4.0/) for the reference manual
25
- - Conference [paper](https://www.isca-archive.org/ssw_2023/yoshimura23_ssw.html) on the ISCA Archive
26
- - Hands-on [tutorial](https://colab.research.google.com/drive/1xAoUKqXadvJXJ7RzN0OceB6y7q5i7Sn6?usp=drive_link) on Google Colab
25
+ - [**Reference Manual**](https://sp-nitech.github.io/diffsptk/stable/) - Detailed API documentation and module specifications.
26
+ - [**Interactive Tutorial**](https://colab.research.google.com/drive/1xAoUKqXadvJXJ7RzN0OceB6y7q5i7Sn6?usp=drive_link) (Google Colab) - Hands-on examples to get started with `diffsptk` in your browser.
27
+ - [**Conference Paper**](https://www.isca-archive.org/ssw_2023/yoshimura23_ssw.html) - Technical background and implementation details available on the ISCA Archive.
27
28
 
28
29
  ## Installation
29
30
 
30
- The latest stable release can be installed through PyPI by running
31
+ The latest stable release can be installed via PyPI:
31
32
 
32
33
  ```sh
33
34
  pip install diffsptk
34
35
  ```
35
36
 
36
- The development release can be installed from the master branch:
37
+ Alternatively, the development version can be installed directly from the GitHub repository:
37
38
 
38
39
  ```sh
39
40
  pip install git+https://github.com/sp-nitech/diffsptk.git@master
@@ -622,7 +622,7 @@ def excite(
622
622
  voiced_region: str = "pulse",
623
623
  unvoiced_region: str = "gauss",
624
624
  polarity: str = "auto",
625
- init_phase: str = "zeros",
625
+ init_phase: str | float = "zeros",
626
626
  ) -> Tensor:
627
627
  """Generate a simple excitation signal.
628
628
 
@@ -638,14 +638,14 @@ def excite(
638
638
  'triangle', 'square']
639
639
  The type of voiced region.
640
640
 
641
- unvoiced_region : ['zeros', 'gauss', 'uniform']
641
+ unvoiced_region : ['zeros', 'gauss', 'm-sequence', 'uniform']
642
642
  The type of unvoiced region.
643
643
 
644
644
  polarity : ['auto', 'unipolar', 'bipolar']
645
645
  The polarity.
646
646
 
647
- init_phase : ['zeros', 'random']
648
- The initial phase.
647
+ init_phase : ['zeros', 'random'] or float
648
+ The initial phase in radians.
649
649
 
650
650
  Returns
651
651
  -------
@@ -1138,33 +1138,6 @@ def hilbert(x: Tensor, fft_length: int | None = None, dim: int = -1) -> Tensor:
1138
1138
  return nn.HilbertTransform._func(x, fft_length=fft_length, dim=dim)
1139
1139
 
1140
1140
 
1141
- def hilbert2(
1142
- x: Tensor,
1143
- fft_length: ArrayLike[int] | int | None = None,
1144
- dim: ArrayLike[int] = (-2, -1),
1145
- ) -> Tensor:
1146
- """Compute the analytic signal using the Hilbert transform.
1147
-
1148
- Parameters
1149
- ----------
1150
- x : Tensor [shape=(..., T1, T2, ...)]
1151
- The input signal.
1152
-
1153
- fft_length : int, list[int], or None
1154
- The number of FFT bins. If None, set to (:math:`T1`, :math:`T2`).
1155
-
1156
- dim : list[int]
1157
- The dimensions along which to take the Hilbert transform.
1158
-
1159
- Returns
1160
- -------
1161
- out : Tensor [shape=(..., T1, T2, ...)]
1162
- The analytic signal.
1163
-
1164
- """
1165
- return nn.TwoDimensionalHilbertTransform._func(x, fft_length=fft_length, dim=dim)
1166
-
1167
-
1168
1141
  def histogram(
1169
1142
  x: Tensor,
1170
1143
  n_bin: int = 10,
@@ -1692,7 +1665,8 @@ def levdur(r: Tensor, eps: float | None = None) -> Tensor:
1692
1665
  The autocorrelation.
1693
1666
 
1694
1667
  eps : float >= 0 or None
1695
- A small value to improve numerical stability.
1668
+ A small value to improve numerical stability. If None, automatically set
1669
+ based on the input data type.
1696
1670
 
1697
1671
  Returns
1698
1672
  -------
@@ -1735,7 +1709,8 @@ def lpc(x: Tensor, lpc_order: int, eps: float | None = None) -> Tensor:
1735
1709
  The order of the LPC coefficients, :math:`M`.
1736
1710
 
1737
1711
  eps : float >= 0 or None
1738
- A small value to improve numerical stability.
1712
+ A small value to improve numerical stability. If None, automatically set
1713
+ based on the input data type.
1739
1714
 
1740
1715
  Returns
1741
1716
  -------
@@ -2089,6 +2064,42 @@ def mdst(x: Tensor, frame_length: int = 400, window: str = "sine") -> Tensor:
2089
2064
  )
2090
2065
 
2091
2066
 
2067
+ def medfilt(
2068
+ x: Tensor,
2069
+ filter_length: int = 3,
2070
+ across_features: bool = False,
2071
+ magic_number: float | None = None,
2072
+ ) -> Tensor:
2073
+ """Apply median filtering to the input sequence.
2074
+
2075
+ Parameters
2076
+ ----------
2077
+ x : Tensor [shape=(B, N, D) or (N, D) or (N,)]
2078
+ The input sequence.
2079
+
2080
+ filter_length : int > 0
2081
+ The length of the median filter, :math:`L`.
2082
+
2083
+ across_features : bool
2084
+ If True, apply the filter across the feature dimension.
2085
+
2086
+ magic_number : float or None
2087
+ The magic number representing unvoiced frames.
2088
+
2089
+ Returns
2090
+ -------
2091
+ out : Tensor [shape=(B, N, D) or (B, N) or (N, D) or (N,)]
2092
+ The filtered sequence.
2093
+
2094
+ """
2095
+ return nn.MedianFilter._func(
2096
+ x,
2097
+ filter_length=filter_length,
2098
+ across_features=across_features,
2099
+ magic_number=magic_number,
2100
+ )
2101
+
2102
+
2092
2103
  def mfcc(
2093
2104
  x: Tensor,
2094
2105
  mfcc_order: int,
@@ -2742,7 +2753,7 @@ def quantize(
2742
2753
  )
2743
2754
 
2744
2755
 
2745
- def rlevdur(a: Tensor) -> Tensor:
2756
+ def rlevdur(a: Tensor, n_fft: int = 512) -> Tensor:
2746
2757
  """Solve a Yule-Walker linear system given the LPC coefficients.
2747
2758
 
2748
2759
  Parameters
@@ -2750,13 +2761,16 @@ def rlevdur(a: Tensor) -> Tensor:
2750
2761
  a : Tensor [shape=(..., M+1)]
2751
2762
  The gain and the LPC coefficients.
2752
2763
 
2764
+ n_fft : int >> M
2765
+ The number of FFT bins. Accurate conversion requires a large value.
2766
+
2753
2767
  Returns
2754
2768
  -------
2755
2769
  out : Tensor [shape=(..., M+1)]
2756
2770
  The autocorrelation.
2757
2771
 
2758
2772
  """
2759
- return nn.ReverseLevinsonDurbin._func(a)
2773
+ return nn.ReverseLevinsonDurbin._func(a, n_fft=n_fft)
2760
2774
 
2761
2775
 
2762
2776
  def rmse(x: Tensor, y: Tensor, reduction: str = "mean") -> Tensor:
@@ -3234,7 +3248,12 @@ def zcross(
3234
3248
 
3235
3249
 
3236
3250
  def zerodf(
3237
- x: Tensor, b: Tensor, frame_period: int = 80, ignore_gain: bool = False
3251
+ x: Tensor,
3252
+ b: Tensor,
3253
+ frame_period: int = 80,
3254
+ ignore_gain: bool = False,
3255
+ zeroth_index: int = 0,
3256
+ mode: str = "direct",
3238
3257
  ) -> Tensor:
3239
3258
  """Apply an all-zero digital filter.
3240
3259
 
@@ -3252,6 +3271,12 @@ def zerodf(
3252
3271
  ignore_gain : bool
3253
3272
  If True, perform filtering without the gain.
3254
3273
 
3274
+ zeroth_index : int >= 0
3275
+ The index of the zeroth coefficient in the filter coefficients.
3276
+
3277
+ mode : ['direct', 'efficient']
3278
+ The implementation mode for time-varying convolution.
3279
+
3255
3280
  Returns
3256
3281
  -------
3257
3282
  out : Tensor [shape=(..., T)]
@@ -3259,5 +3284,10 @@ def zerodf(
3259
3284
 
3260
3285
  """
3261
3286
  return nn.AllZeroDigitalFilter._func(
3262
- x, b, frame_period=frame_period, ignore_gain=ignore_gain
3287
+ x,
3288
+ b,
3289
+ frame_period=frame_period,
3290
+ ignore_gain=ignore_gain,
3291
+ zeroth_index=zeroth_index,
3292
+ mode=mode,
3263
3293
  )
@@ -62,7 +62,6 @@ from .gnorm import GeneralizedCepstrumGainNormalization
62
62
  from .griffin import GriffinLim
63
63
  from .grpdelay import GroupDelay
64
64
  from .hilbert import HilbertTransform
65
- from .hilbert2 import TwoDimensionalHilbertTransform
66
65
  from .histogram import Histogram
67
66
  from .ialaw import ALawExpansion
68
67
  from .ica import IndependentComponentAnalysis
@@ -117,6 +116,7 @@ from .mdct import ModifiedDiscreteCosineTransform
117
116
  from .mdct import ModifiedDiscreteCosineTransform as MDCT
118
117
  from .mdst import ModifiedDiscreteSineTransform
119
118
  from .mdst import ModifiedDiscreteSineTransform as MDST
119
+ from .medfilt import MedianFilter
120
120
  from .mfcc import MelFrequencyCepstralCoefficientsAnalysis
121
121
  from .mfcc import MelFrequencyCepstralCoefficientsAnalysis as MFCC
122
122
  from .mgc2mgc import MelGeneralizedCepstrumToMelGeneralizedCepstrum
@@ -101,10 +101,9 @@ class Autocorrelation(BaseFunctionalModule):
101
101
  elif out_format in (2, "biased"):
102
102
  formatter = lambda x: x / frame_length
103
103
  elif out_format in (3, "unbiased"):
104
- formatter = lambda x: x / (
105
- torch.arange(
106
- frame_length, frame_length - acr_order - 1, -1, device=x.device
107
- )
104
+ n = frame_length - acr_order - 1
105
+ formatter = lambda x: (
106
+ x / (torch.arange(frame_length, n, -1, device=x.device))
108
107
  )
109
108
  else:
110
109
  raise ValueError(f"out_format {out_format} is not supported.")
@@ -140,12 +140,12 @@ class AutocorrelationToCompositeSinusoidalModelCoefficients(BaseFunctionalModule
140
140
  u1, u2 = torch.tensor_split(u, 2, dim=-1)
141
141
 
142
142
  U = hankel(-u)
143
- p = torch.matmul(U.inverse(), u2.unsqueeze(-1)).squeeze(-1)
143
+ p = torch.linalg.solve(U, u2.unsqueeze(-1)).squeeze(-1)
144
144
  x = PolynomialToRoots._func(F.pad(p.flip(-1), (1, 0), value=1))
145
145
  x, _ = torch.sort(x.real, descending=True)
146
146
  w = torch.acos(x)
147
147
 
148
148
  V = vander(x)
149
- m = torch.matmul(V.inverse(), u1.unsqueeze(-1)).squeeze(-1)
149
+ m = torch.linalg.solve(V, u1.unsqueeze(-1)).squeeze(-1)
150
150
  c = torch.cat((w, m), dim=-1)
151
151
  return c
@@ -45,8 +45,8 @@ class ExcitationGeneration(BaseFunctionalModule):
45
45
  polarity : ['auto', 'unipolar', 'bipolar']
46
46
  The polarity.
47
47
 
48
- init_phase : ['zeros', 'random']
49
- The initial phase.
48
+ init_phase : ['zeros', 'random'] or float
49
+ The initial phase in radians.
50
50
 
51
51
  """
52
52
 
@@ -57,7 +57,7 @@ class ExcitationGeneration(BaseFunctionalModule):
57
57
  voiced_region: str = "pulse",
58
58
  unvoiced_region: str = "gauss",
59
59
  polarity: str = "auto",
60
- init_phase: str = "zeros",
60
+ init_phase: str | float = "zeros",
61
61
  ) -> None:
62
62
  super().__init__()
63
63
 
@@ -108,7 +108,7 @@ class ExcitationGeneration(BaseFunctionalModule):
108
108
  voiced_region: str,
109
109
  unvoiced_region: str,
110
110
  polarity: str,
111
- init_phase: str,
111
+ init_phase: str | float,
112
112
  ) -> Precomputed:
113
113
  ExcitationGeneration._check(frame_period)
114
114
  return (frame_period, voiced_region, unvoiced_region, polarity, init_phase)
@@ -121,7 +121,7 @@ class ExcitationGeneration(BaseFunctionalModule):
121
121
  voiced_region: str,
122
122
  unvoiced_region: str,
123
123
  polarity: str,
124
- init_phase: str,
124
+ init_phase: str | float,
125
125
  ) -> torch.Tensor:
126
126
  # Make mask represents voiced region.
127
127
  base_mask = torch.clip(p, min=0, max=1)
@@ -148,12 +148,16 @@ class ExcitationGeneration(BaseFunctionalModule):
148
148
  s = torch.cumsum(q.double(), dim=-1)
149
149
  bias, _ = torch.cummax(s * ~mask, dim=-1)
150
150
  phase = (s - bias).to(p.dtype)
151
- if init_phase == "zeros":
152
- pass
151
+ if not isinstance(init_phase, str):
152
+ shift = init_phase / TAU
153
+ elif init_phase == "zeros":
154
+ shift = 0.0
153
155
  elif init_phase == "random":
154
- phase += torch.rand_like(p[..., :1])
156
+ shift = torch.rand_like(p[..., :1])
155
157
  else:
156
158
  raise ValueError(f"init_phase {init_phase} is not supported.")
159
+ if isinstance(shift, torch.Tensor) or shift != 0.0:
160
+ phase += shift
157
161
 
158
162
  # Generate excitation signal using phase.
159
163
  if polarity == "auto":
@@ -167,15 +171,19 @@ class ExcitationGeneration(BaseFunctionalModule):
167
171
 
168
172
  def get_pulse_pos(p):
169
173
  r = torch.ceil(p)
170
- r = F.pad(r, (1, 0))
171
174
  return torch.ge(torch.diff(r), 1)
172
175
 
176
+ if isinstance(shift, float):
177
+ padded_phase = F.pad(phase, (1, 0), value=shift)
178
+ else:
179
+ padded_phase = torch.cat([shift, phase], dim=-1)
180
+
173
181
  if unipolar:
174
- pulse_pos = get_pulse_pos(phase)
182
+ pulse_pos = get_pulse_pos(padded_phase)
175
183
  e[pulse_pos] = torch.sqrt(p[pulse_pos])
176
184
  else:
177
- pulse_pos1 = get_pulse_pos(phase)
178
- pulse_pos2 = get_pulse_pos(0.5 * phase)
185
+ pulse_pos1 = get_pulse_pos(padded_phase)
186
+ pulse_pos2 = get_pulse_pos(0.5 * padded_phase)
179
187
  e[pulse_pos1] = torch.sqrt(p[pulse_pos1])
180
188
  e[pulse_pos1 & ~pulse_pos2] *= -1
181
189
  elif voiced_region == "sinusoidal":
@@ -111,8 +111,8 @@ class F0Evaluation(BaseFunctionalModule):
111
111
  )
112
112
  else:
113
113
  TP = torch.sum((x != UNVOICED_SYMBOL) & (y != UNVOICED_SYMBOL), dim=-1)
114
- FP = torch.sum((x == UNVOICED_SYMBOL) & (y != UNVOICED_SYMBOL), dim=-1)
115
- FN = torch.sum((x != UNVOICED_SYMBOL) & (y == UNVOICED_SYMBOL), dim=-1)
114
+ FP = torch.sum((x != UNVOICED_SYMBOL) & (y == UNVOICED_SYMBOL), dim=-1)
115
+ FN = torch.sum((x == UNVOICED_SYMBOL) & (y != UNVOICED_SYMBOL), dim=-1)
116
116
  TN = torch.sum((x == UNVOICED_SYMBOL) & (y == UNVOICED_SYMBOL), dim=-1)
117
117
  FPFN = FP + FN
118
118
  if out_format == "vuv-error-rate":
@@ -76,9 +76,9 @@ class CepstralAnalysis(BaseFunctionalModule):
76
76
  >>> fftcep = diffsptk.CepstralAnalysis(fft_length=16, cep_order=3)
77
77
  >>> x = diffsptk.ramp(19)
78
78
  >>> c = fftcep(stft(x))
79
- >>> c
80
- tensor([[-0.9663, 0.8190, -0.0932, -0.0152],
81
- [-0.8540, 4.6173, -0.5496, -0.3206]])
79
+ >>> c.round(decimals=3)
80
+ tensor([[-0.9660, 0.8190, -0.0930, -0.0150],
81
+ [-0.8540, 4.6170, -0.5500, -0.3210]])
82
82
 
83
83
  """
84
84
  check_size(x.size(-1), self.in_dim, "dimension of spectrum")
@@ -346,6 +346,7 @@ class GaussianMixtureModeling(BaseLearnerModule):
346
346
  nu = px / y.view(-1, 1)
347
347
  nm = nu * self.mu
348
348
  a = pxx - y.view(-1, 1) * (2 * nm - mm)
349
+ a = torch.nan_to_num(a, nan=0.0, posinf=0.0, neginf=0.0)
349
350
  b = xi.view(-1, 1) * self.ubm_sigma.diagonal(dim1=-2, dim2=-1)
350
351
  c = xi.view(-1, 1) * (self.ubm_mu - self.mu) ** 2
351
352
  sigma = (a + b + c) * z.view(-1, 1)
@@ -368,6 +369,7 @@ class GaussianMixtureModeling(BaseLearnerModule):
368
369
  nm = outer(nu, self.mu)
369
370
  mn = nm.transpose(-2, -1)
370
371
  a = pxx - y.view(-1, 1, 1) * (nm + mn - mm)
372
+ a = torch.nan_to_num(a, nan=0.0, posinf=0.0, neginf=0.0)
371
373
  b = xi.view(-1, 1, 1) * self.ubm_sigma
372
374
  c = xi.view(-1, 1, 1) * outer(self.ubm_mu - self.mu)
373
375
  sigma = (a + b + c) * z.view(-1, 1, 1)
@@ -30,8 +30,9 @@ class LevinsonDurbin(BaseFunctionalModule):
30
30
  lpc_order : int >= 0
31
31
  The order of the LPC coefficients, :math:`M`.
32
32
 
33
- eps : float >= 0
34
- A small value to improve numerical stability.
33
+ eps : float >= 0 or None
34
+ A small value to improve numerical stability. If None, automatically set
35
+ based on the data type.
35
36
 
36
37
  device : torch.device or None
37
38
  The device of this module.
@@ -121,7 +122,7 @@ class LevinsonDurbin(BaseFunctionalModule):
121
122
  R = symmetric_toeplitz(r[..., :-1]) + eye # [..., M, M]
122
123
 
123
124
  # Solve system.
124
- a = torch.matmul(R.inverse(), -r1.unsqueeze(-1)).squeeze(-1)
125
+ a = torch.linalg.solve(R, -r1.unsqueeze(-1)).squeeze(-1)
125
126
 
126
127
  # Compute gain.
127
128
  K = torch.sqrt((r1 * a).sum(-1, keepdim=True) + r0)
@@ -39,7 +39,8 @@ class LinearPredictiveCodingAnalysis(BaseFunctionalModule):
39
39
  The order of the LPC coefficients, :math:`M`.
40
40
 
41
41
  eps : float >= 0 or None
42
- A small value to improve numerical stability.
42
+ A small value to improve numerical stability. If None, automatically set
43
+ based on the data type.
43
44
 
44
45
  device : torch.device or None
45
46
  The device of this module.
@@ -99,9 +99,9 @@ class MelCepstralAnalysis(BaseFunctionalModule):
99
99
  ... )
100
100
  >>> x = diffsptk.ramp(19)
101
101
  >>> mc = mcep(stft(x))
102
- >>> mc
103
- tensor([[-0.8851, 0.7917, -0.1737, 0.0175],
104
- [-0.3522, 4.4222, -1.0882, -0.0510]])
102
+ >>> mc.round(decimals=3)
103
+ tensor([[-0.8850, 0.7920, -0.1740, 0.0170],
104
+ [-0.3520, 4.4220, -1.0880, -0.0510]])
105
105
 
106
106
  """
107
107
  check_size(x.size(-1), self.in_dim, "dimension of spectrum")