diffsptk 3.3.0__tar.gz → 3.3.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 (146) hide show
  1. {diffsptk-3.3.0 → diffsptk-3.3.1}/PKG-INFO +4 -4
  2. {diffsptk-3.3.0 → diffsptk-3.3.1}/README.md +3 -3
  3. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/functional.py +1 -1
  4. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/drc.py +6 -4
  5. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/excite.py +10 -1
  6. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/griffin.py +6 -5
  7. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/poledf.py +9 -4
  8. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/signals.py +111 -1
  9. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/utils/public.py +1 -1
  10. diffsptk-3.3.1/diffsptk/version.py +1 -0
  11. diffsptk-3.3.0/diffsptk/version.py +0 -1
  12. {diffsptk-3.3.0 → diffsptk-3.3.1}/.gitignore +0 -0
  13. {diffsptk-3.3.0 → diffsptk-3.3.1}/CITATION.cff +0 -0
  14. {diffsptk-3.3.0 → diffsptk-3.3.1}/LICENSE +0 -0
  15. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/__init__.py +0 -0
  16. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/__init__.py +0 -0
  17. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/acorr.py +0 -0
  18. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/acr2csm.py +0 -0
  19. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/alaw.py +0 -0
  20. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ap.py +0 -0
  21. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/b2mc.py +0 -0
  22. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/base.py +0 -0
  23. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/c2acr.py +0 -0
  24. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/c2mpir.py +0 -0
  25. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/c2ndps.py +0 -0
  26. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/cdist.py +0 -0
  27. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/chroma.py +0 -0
  28. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/cqt.py +0 -0
  29. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/csm2acr.py +0 -0
  30. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/dct.py +0 -0
  31. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/decimate.py +0 -0
  32. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/delay.py +0 -0
  33. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/delta.py +0 -0
  34. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/dequantize.py +0 -0
  35. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/df2.py +0 -0
  36. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/dfs.py +0 -0
  37. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/dht.py +0 -0
  38. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/dst.py +0 -0
  39. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/entropy.py +0 -0
  40. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/fbank.py +0 -0
  41. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/fftcep.py +0 -0
  42. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/fftr.py +0 -0
  43. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/flux.py +0 -0
  44. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/frame.py +0 -0
  45. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/freqt.py +0 -0
  46. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/freqt2.py +0 -0
  47. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/gammatone.py +0 -0
  48. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/gmm.py +0 -0
  49. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/gnorm.py +0 -0
  50. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/grpdelay.py +0 -0
  51. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/hilbert.py +0 -0
  52. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/hilbert2.py +0 -0
  53. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/histogram.py +0 -0
  54. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ialaw.py +0 -0
  55. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ica.py +0 -0
  56. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/icqt.py +0 -0
  57. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/idct.py +0 -0
  58. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/idht.py +0 -0
  59. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/idst.py +0 -0
  60. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ifbank.py +0 -0
  61. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ifftr.py +0 -0
  62. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ifreqt2.py +0 -0
  63. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/igammatone.py +0 -0
  64. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ignorm.py +0 -0
  65. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/imdct.py +0 -0
  66. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/imdst.py +0 -0
  67. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/imglsadf.py +0 -0
  68. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/imsvq.py +0 -0
  69. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/interpolate.py +0 -0
  70. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ipnorm.py +0 -0
  71. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ipqmf.py +0 -0
  72. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/is2par.py +0 -0
  73. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/istft.py +0 -0
  74. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/iulaw.py +0 -0
  75. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ivq.py +0 -0
  76. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lar2par.py +0 -0
  77. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lbg.py +0 -0
  78. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/levdur.py +0 -0
  79. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/linear_intpl.py +0 -0
  80. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lpc.py +0 -0
  81. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lpc2lsp.py +0 -0
  82. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lpc2par.py +0 -0
  83. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lpccheck.py +0 -0
  84. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lsp2lpc.py +0 -0
  85. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lsp2sp.py +0 -0
  86. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/lspcheck.py +0 -0
  87. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/magic_intpl.py +0 -0
  88. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mc2b.py +0 -0
  89. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mcep.py +0 -0
  90. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mcpf.py +0 -0
  91. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mdct.py +0 -0
  92. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mdst.py +0 -0
  93. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mfcc.py +0 -0
  94. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mgc2mgc.py +0 -0
  95. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mgc2sp.py +0 -0
  96. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mgcep.py +0 -0
  97. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mglsadf.py +0 -0
  98. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mlpg.py +0 -0
  99. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mlsacheck.py +0 -0
  100. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/mpir2c.py +0 -0
  101. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/msvq.py +0 -0
  102. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ndps2c.py +0 -0
  103. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/nmf.py +0 -0
  104. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/norm0.py +0 -0
  105. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/oband.py +0 -0
  106. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/par2is.py +0 -0
  107. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/par2lar.py +0 -0
  108. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/par2lpc.py +0 -0
  109. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/pca.py +0 -0
  110. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/phase.py +0 -0
  111. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/pitch.py +0 -0
  112. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/pitch_spec.py +0 -0
  113. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/plp.py +0 -0
  114. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/pnorm.py +0 -0
  115. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/pol_root.py +0 -0
  116. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/pqmf.py +0 -0
  117. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/quantize.py +0 -0
  118. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/rlevdur.py +0 -0
  119. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/rmse.py +0 -0
  120. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/root_pol.py +0 -0
  121. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/smcep.py +0 -0
  122. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/snr.py +0 -0
  123. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/spec.py +0 -0
  124. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/stft.py +0 -0
  125. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/ulaw.py +0 -0
  126. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/unframe.py +0 -0
  127. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/vq.py +0 -0
  128. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/wht.py +0 -0
  129. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/window.py +0 -0
  130. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/world_synth.py +0 -0
  131. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/yingram.py +0 -0
  132. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/zcross.py +0 -0
  133. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/modules/zerodf.py +0 -0
  134. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/librosa/LICENSE +0 -0
  135. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/librosa/__init__.py +0 -0
  136. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/librosa/constantq.py +0 -0
  137. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/librosa/filters.py +0 -0
  138. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/librosa/typing.py +0 -0
  139. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/librosa/util.py +0 -0
  140. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/world/LICENSE +0 -0
  141. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/world/__init__.py +0 -0
  142. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/third_party/world/common.py +0 -0
  143. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/typing.py +0 -0
  144. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/utils/__init__.py +0 -0
  145. {diffsptk-3.3.0 → diffsptk-3.3.1}/diffsptk/utils/private.py +0 -0
  146. {diffsptk-3.3.0 → diffsptk-3.3.1}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffsptk
3
- Version: 3.3.0
3
+ Version: 3.3.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/
@@ -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
- [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/3.3.0/)
50
+ [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/3.3.1/)
51
51
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
52
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
- [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.7.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
54
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.8.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)
56
56
  [![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
57
57
  [![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](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.3.0/) for the reference manual.
68
+ - See [this page](https://sp-nitech.github.io/diffsptk/3.3.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
@@ -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
- [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/3.3.0/)
5
+ [![Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/3.3.1/)
6
6
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
7
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
- [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.7.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
9
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-2.3.1%20%7C%202.8.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)
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)
@@ -20,7 +20,7 @@
20
20
 
21
21
  ## Documentation
22
22
 
23
- - See [this page](https://sp-nitech.github.io/diffsptk/3.3.0/) for the reference manual.
23
+ - See [this page](https://sp-nitech.github.io/diffsptk/3.3.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
@@ -561,7 +561,7 @@ def excite(
561
561
  'triangle', 'square']
562
562
  The type of voiced region.
563
563
 
564
- unvoiced_region : ['zeros', 'gauss']
564
+ unvoiced_region : ['zeros', 'gauss', 'uniform']
565
565
  The type of unvoiced region.
566
566
 
567
567
  polarity : ['auto', 'unipolar', 'bipolar']
@@ -16,10 +16,9 @@
16
16
 
17
17
  import numpy as np
18
18
  import torch
19
- import torchcomp
20
19
  from torch import nn
21
20
 
22
- from ..typing import Precomputed
21
+ from ..typing import Callable, Precomputed
23
22
  from ..utils.private import filter_values, to, to_2d
24
23
  from .base import BaseFunctionalModule
25
24
 
@@ -161,6 +160,8 @@ class DynamicRangeCompression(BaseFunctionalModule):
161
160
  device: torch.device | None,
162
161
  dtype: torch.dtype | None,
163
162
  ) -> Precomputed:
163
+ import torchcomp
164
+
164
165
  DynamicRangeCompression._check(
165
166
  ratio, attack_time, release_time, sample_rate, makeup_gain, abs_max
166
167
  )
@@ -179,12 +180,13 @@ class DynamicRangeCompression(BaseFunctionalModule):
179
180
  makeup_gain = to(torch.tensor(makeup_gain, device=device), dtype=dtype)
180
181
  makeup_gain = 10 ** (makeup_gain / 20)
181
182
  params = torch.stack([threshold, ratio, attack_time, release_time, makeup_gain])
182
- return (abs_max,), None, (params,)
183
+ return (abs_max, torchcomp.compexp_gain), None, (params,)
183
184
 
184
185
  @staticmethod
185
186
  def _forward(
186
187
  x: torch.Tensor,
187
188
  abs_max: float,
189
+ compexp_gain: Callable,
188
190
  params: torch.Tensor,
189
191
  ) -> torch.Tensor:
190
192
  eps = 1e-10
@@ -192,7 +194,7 @@ class DynamicRangeCompression(BaseFunctionalModule):
192
194
  y = to_2d(x)
193
195
  y_abs = y.abs() / abs_max + eps
194
196
 
195
- g = torchcomp.compexp_gain(
197
+ g = compexp_gain(
196
198
  y_abs,
197
199
  params[0],
198
200
  params[1],
@@ -14,9 +14,12 @@
14
14
  # limitations under the License. #
15
15
  # ------------------------------------------------------------------------ #
16
16
 
17
+ import math
18
+
17
19
  import torch
18
20
  import torch.nn.functional as F
19
21
 
22
+ from ..signals import mseq
20
23
  from ..typing import Precomputed
21
24
  from ..utils.private import TAU, UNVOICED_SYMBOL, filter_values
22
25
  from .base import BaseFunctionalModule
@@ -36,7 +39,7 @@ class ExcitationGeneration(BaseFunctionalModule):
36
39
  'triangle', 'square']
37
40
  The type of voiced region.
38
41
 
39
- unvoiced_region : ['zeros', 'gauss']
42
+ unvoiced_region : ['zeros', 'gauss', 'm-sequence', 'uniform']
40
43
  The type of unvoiced region.
41
44
 
42
45
  polarity : ['auto', 'unipolar', 'bipolar']
@@ -206,6 +209,12 @@ class ExcitationGeneration(BaseFunctionalModule):
206
209
  pass
207
210
  elif unvoiced_region == "gauss":
208
211
  e[~mask] = torch.randn(torch.sum(~mask), device=e.device, dtype=e.dtype)
212
+ elif unvoiced_region == "m-sequence":
213
+ e[~mask] = mseq(torch.sum(~mask) - 1, device=e.device, dtype=e.dtype)
214
+ elif unvoiced_region == "uniform":
215
+ e[~mask] = math.sqrt(12) * (
216
+ torch.rand(torch.sum(~mask), device=e.device, dtype=e.dtype) - 0.5
217
+ )
209
218
  else:
210
219
  raise ValueError(f"unvoiced_region {unvoiced_region} is not supported.")
211
220
  return e
@@ -54,7 +54,7 @@ class GriffinLim(BaseFunctionalModule):
54
54
  symmetric : bool
55
55
  If True, the window is symmetric, otherwise periodic.
56
56
 
57
- n_iter : int >= 1
57
+ n_iter : int >= 0
58
58
  The number of iterations for phase reconstruction.
59
59
 
60
60
  alpha : float >= 0
@@ -159,8 +159,8 @@ class GriffinLim(BaseFunctionalModule):
159
159
  beta: float,
160
160
  gamma: float,
161
161
  ) -> None:
162
- if n_iter <= 0:
163
- raise ValueError("n_iter must be positive.")
162
+ if n_iter < 0:
163
+ raise ValueError("n_iter must be non-negative.")
164
164
  if alpha < 0:
165
165
  raise ValueError("alpha must be non-negative.")
166
166
  if beta < 0:
@@ -259,7 +259,8 @@ class GriffinLim(BaseFunctionalModule):
259
259
  if logger is not None:
260
260
  logger.info(f"alpha: {alpha}, beta: {beta}, gamma: {gamma}")
261
261
 
262
- s = torch.sqrt(y)
262
+ eps = 1e-16
263
+ s = torch.sqrt(y + eps)
263
264
  angle = torch.exp(1j * phase_generator(s))
264
265
 
265
266
  t_prev = d_prev = 0 # This suppresses F821 and F841.
@@ -275,7 +276,7 @@ class GriffinLim(BaseFunctionalModule):
275
276
  c = t + alpha * diff
276
277
  d = t + beta * diff
277
278
 
278
- angle = c / (c.abs() + 1e-16)
279
+ angle = c / (c.abs() + eps)
279
280
  t_prev = t
280
281
  d_prev = d
281
282
 
@@ -15,9 +15,8 @@
15
15
  # ------------------------------------------------------------------------ #
16
16
 
17
17
  import torch
18
- from torchlpc import sample_wise_lpc
19
18
 
20
- from ..typing import Precomputed
19
+ from ..typing import Callable, Precomputed
21
20
  from ..utils.private import check_size, filter_values
22
21
  from .base import BaseFunctionalModule
23
22
  from .linear_intpl import LinearInterpolation
@@ -105,11 +104,17 @@ class AllPoleDigitalFilter(BaseFunctionalModule):
105
104
  filter_order: int, frame_period: int, ignore_gain: bool = False
106
105
  ) -> Precomputed:
107
106
  AllPoleDigitalFilter._check(filter_order, frame_period)
108
- return (frame_period, ignore_gain)
107
+ from torchlpc import sample_wise_lpc
108
+
109
+ return (frame_period, ignore_gain, sample_wise_lpc)
109
110
 
110
111
  @staticmethod
111
112
  def _forward(
112
- x: torch.Tensor, a: torch.Tensor, frame_period: int, ignore_gain: bool
113
+ x: torch.Tensor,
114
+ a: torch.Tensor,
115
+ frame_period: int,
116
+ ignore_gain: bool,
117
+ sample_wise_lpc: Callable,
113
118
  ) -> torch.Tensor:
114
119
  check_size(x.size(-1), a.size(-2) * frame_period, "sequence length")
115
120
 
@@ -14,6 +14,8 @@
14
14
  # limitations under the License. #
15
15
  # ------------------------------------------------------------------------ #
16
16
 
17
+ import math
18
+
17
19
  import torch
18
20
 
19
21
 
@@ -234,10 +236,69 @@ def train(
234
236
  return x
235
237
 
236
238
 
239
+ def mseq(*order: int, **kwargs) -> torch.Tensor:
240
+ """Generate M-sequence.
241
+
242
+ See `mseq <https://sp-nitech.github.io/sptk/latest/main/mseq.html>`_
243
+ for details.
244
+
245
+ Parameters
246
+ ----------
247
+ order : int >= 0
248
+ The order of the sequence, :math:`M`.
249
+
250
+ **kwargs : additional keyword arguments
251
+ See `torch.ones <https://pytorch.org/docs/stable/generated/torch.ones.html>`_.
252
+
253
+ Returns
254
+ -------
255
+ out : Tensor [shape=(M+1,)]
256
+ The random value sequence.
257
+
258
+ Examples
259
+ --------
260
+ >>> x = diffsptk.mseq(4)
261
+ >>> x
262
+ tensor([-1., 1., -1., 1., -1.])
263
+
264
+ """
265
+ if any(isinstance(item, (list, tuple)) for item in order):
266
+ order = list(*order)
267
+ else:
268
+ order = list(order)
269
+ order[-1] += 1
270
+
271
+ out_length = math.prod(order)
272
+ out = torch.ones(out_length, **kwargs)
273
+
274
+ init = 0x55555555 # int("01010101010101010101010101010101", 2)
275
+ B0 = 0x00000001 # 1 << 0
276
+ B28 = 0x10000000 # 1 << 28
277
+ B31 = 0x80000000 # 1 << 31
278
+ B31F = 0x7FFFFFFF # ~(1 << 31) & 0xFFFFFFFF
279
+
280
+ x = init
281
+ for i in range(out_length):
282
+ x >>= 1
283
+
284
+ x0 = 1 if x & B0 else -1
285
+ x28 = 1 if x & B28 else -1
286
+
287
+ if x0 + x28:
288
+ x &= B31F
289
+ else:
290
+ x |= B31
291
+
292
+ if x0 != 1:
293
+ out[i] = x0
294
+
295
+ return out.reshape(order)
296
+
297
+
237
298
  def nrand(
238
299
  *order: int, mean: float = 0, stdv: float = 1, var: float | None = None, **kwargs
239
300
  ) -> torch.Tensor:
240
- """Generate random number sequence.
301
+ """Generate Gaussian random number sequence.
241
302
 
242
303
  See `nrand <https://sp-nitech.github.io/sptk/latest/main/nrand.html>`_
243
304
  for details.
@@ -288,3 +349,52 @@ def nrand(
288
349
  x = torch.randn(*order, **kwargs)
289
350
  x = x * stdv + mean
290
351
  return x
352
+
353
+
354
+ def rand(*order: int, a: float = 0, b: float = 1, **kwargs) -> torch.Tensor:
355
+ """Generate uniform random number sequence.
356
+
357
+ See `rand <https://sp-nitech.github.io/sptk/latest/main/rand.html>`_
358
+ for details.
359
+
360
+ Parameters
361
+ ----------
362
+ order : int >= 0
363
+ The order of the sequence, :math:`M`.
364
+
365
+ a : float
366
+ The lower bound.
367
+
368
+ b : float >= 0
369
+ The upper bound.
370
+
371
+ **kwargs : additional keyword arguments
372
+ See `torch.rand <https://pytorch.org/docs/stable/generated/torch.rand.html>`_.
373
+
374
+ Returns
375
+ -------
376
+ out : Tensor [shape=(M+1,)]
377
+ The random value sequence.
378
+
379
+ Examples
380
+ --------
381
+ >>> x = diffsptk.rand(4)
382
+ >>> x
383
+ tensor([0.3425, 0.5997, 0.2882, 0.3961, 0.9791])
384
+ >>> x = diffsptk.rand(2, 4)
385
+ >>> x
386
+ tensor([[0.6170, 0.3649, 0.9397, 0.2408, 0.1868],
387
+ [0.6527, 0.1400, 0.3955, 0.9999, 0.8298]])
388
+
389
+ """
390
+ if b <= a:
391
+ raise ValueError("Lower bound must be less than upper bound.")
392
+
393
+ if any(isinstance(item, (list, tuple)) for item in order):
394
+ order = list(*order)
395
+ else:
396
+ order = list(order)
397
+ order[-1] += 1
398
+ x = torch.rand(*order, **kwargs)
399
+ x = (b - a) * x + a
400
+ return x
@@ -190,5 +190,5 @@ def write(
190
190
  >>> diffsptk.write("out.wav", x, sr)
191
191
 
192
192
  """
193
- x = x.cpu().numpy() if torch.is_tensor(x) else x
193
+ x = x.detach().cpu().numpy() if torch.is_tensor(x) else x
194
194
  sf.write(filename, x.T if channel_first else x, sr, **kwargs)
@@ -0,0 +1 @@
1
+ __version__ = "3.3.1"
@@ -1 +0,0 @@
1
- __version__ = "3.3.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes