diffsptk 2.0.0__tar.gz → 2.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 (140) hide show
  1. {diffsptk-2.0.0 → diffsptk-2.5.0}/.gitignore +2 -3
  2. diffsptk-2.5.0/CITATION.cff +26 -0
  3. {diffsptk-2.0.0 → diffsptk-2.5.0}/PKG-INFO +206 -39
  4. {diffsptk-2.0.0 → diffsptk-2.5.0}/README.md +188 -25
  5. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/functional.py +563 -33
  6. diffsptk-2.5.0/diffsptk/misc/librosa/LICENSE +15 -0
  7. diffsptk-2.5.0/diffsptk/misc/librosa/__init__.py +2 -0
  8. diffsptk-2.5.0/diffsptk/misc/librosa/constantq.py +95 -0
  9. diffsptk-2.5.0/diffsptk/misc/librosa/filters.py +299 -0
  10. diffsptk-2.5.0/diffsptk/misc/librosa/util.py +172 -0
  11. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/misc/signals.py +5 -2
  12. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/misc/utils.py +116 -16
  13. diffsptk-2.5.0/diffsptk/misc/world.py +113 -0
  14. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/__init__.py +43 -4
  15. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/acorr.py +8 -8
  16. diffsptk-2.5.0/diffsptk/modules/acr2csm.py +124 -0
  17. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/alaw.py +2 -2
  18. diffsptk-2.5.0/diffsptk/modules/ap.py +549 -0
  19. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/b2mc.py +8 -2
  20. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/c2acr.py +2 -2
  21. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/c2mpir.py +3 -3
  22. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/c2ndps.py +7 -2
  23. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/cdist.py +12 -13
  24. diffsptk-2.5.0/diffsptk/modules/chroma.py +131 -0
  25. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/cqt.py +23 -35
  26. diffsptk-2.5.0/diffsptk/modules/csm2acr.py +97 -0
  27. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/dct.py +35 -10
  28. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/decimate.py +2 -5
  29. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/delay.py +2 -2
  30. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/delta.py +2 -2
  31. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/dequantize.py +4 -4
  32. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/df2.py +2 -2
  33. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/dfs.py +2 -2
  34. diffsptk-2.5.0/diffsptk/modules/dht.py +95 -0
  35. diffsptk-2.5.0/diffsptk/modules/drc.py +183 -0
  36. diffsptk-2.5.0/diffsptk/modules/dst.py +107 -0
  37. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/entropy.py +5 -5
  38. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/excite.py +96 -23
  39. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/fbank.py +9 -8
  40. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/fftcep.py +7 -2
  41. diffsptk-2.5.0/diffsptk/modules/flux.py +106 -0
  42. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/frame.py +18 -7
  43. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/freqt.py +7 -2
  44. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/freqt2.py +9 -3
  45. diffsptk-2.5.0/diffsptk/modules/gammatone.py +225 -0
  46. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/gmm.py +211 -87
  47. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/gnorm.py +10 -4
  48. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/grpdelay.py +2 -2
  49. diffsptk-2.5.0/diffsptk/modules/hilbert.py +96 -0
  50. diffsptk-2.5.0/diffsptk/modules/hilbert2.py +105 -0
  51. diffsptk-2.5.0/diffsptk/modules/histogram.py +114 -0
  52. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/ialaw.py +2 -2
  53. diffsptk-2.5.0/diffsptk/modules/ica.py +181 -0
  54. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/icqt.py +25 -37
  55. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/idct.py +15 -8
  56. diffsptk-2.5.0/diffsptk/modules/idht.py +88 -0
  57. diffsptk-2.5.0/diffsptk/modules/idst.py +88 -0
  58. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/ifreqt2.py +9 -3
  59. diffsptk-2.5.0/diffsptk/modules/igammatone.py +203 -0
  60. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/ignorm.py +8 -2
  61. diffsptk-2.5.0/diffsptk/modules/imdct.py +160 -0
  62. diffsptk-2.5.0/diffsptk/modules/imdst.py +73 -0
  63. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/imglsadf.py +7 -12
  64. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/imsvq.py +7 -2
  65. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/interpolate.py +2 -2
  66. diffsptk-2.5.0/diffsptk/modules/ipnorm.py +71 -0
  67. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/ipqmf.py +12 -3
  68. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/istft.py +4 -4
  69. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/iulaw.py +3 -3
  70. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/ivq.py +7 -2
  71. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/lar2par.py +2 -2
  72. diffsptk-2.5.0/diffsptk/modules/lbg.py +328 -0
  73. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/levdur.py +21 -7
  74. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/linear_intpl.py +5 -5
  75. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/lpc.py +11 -8
  76. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/lpc2lsp.py +12 -6
  77. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/lpc2par.py +2 -2
  78. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/lpccheck.py +2 -2
  79. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/lsp2lpc.py +2 -2
  80. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/lsp2sp.py +14 -6
  81. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/lspcheck.py +6 -6
  82. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/magic_intpl.py +6 -6
  83. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mc2b.py +8 -2
  84. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mcep.py +3 -3
  85. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mcpf.py +11 -5
  86. diffsptk-2.5.0/diffsptk/modules/mdct.py +163 -0
  87. diffsptk-2.5.0/diffsptk/modules/mdst.py +70 -0
  88. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mfcc.py +6 -6
  89. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mgc2mgc.py +12 -7
  90. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mgc2sp.py +9 -9
  91. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mgcep.py +5 -5
  92. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mglsadf.py +236 -83
  93. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mlpg.py +5 -3
  94. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mlsacheck.py +9 -3
  95. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/mpir2c.py +2 -2
  96. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/msvq.py +8 -7
  97. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/ndps2c.py +7 -2
  98. diffsptk-2.5.0/diffsptk/modules/nmf.py +246 -0
  99. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/norm0.py +2 -2
  100. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/par2lar.py +2 -2
  101. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/par2lpc.py +2 -2
  102. diffsptk-2.5.0/diffsptk/modules/pca.py +211 -0
  103. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/phase.py +3 -3
  104. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/pitch.py +112 -53
  105. diffsptk-2.5.0/diffsptk/modules/pitch_spec.py +185 -0
  106. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/plp.py +6 -6
  107. diffsptk-2.5.0/diffsptk/modules/pnorm.py +87 -0
  108. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/pol_root.py +2 -2
  109. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/poledf.py +9 -3
  110. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/pqmf.py +12 -3
  111. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/quantize.py +4 -4
  112. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/rlevdur.py +3 -3
  113. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/rmse.py +9 -13
  114. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/root_pol.py +4 -4
  115. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/smcep.py +9 -3
  116. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/snr.py +4 -4
  117. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/spec.py +7 -7
  118. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/stft.py +4 -5
  119. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/ulaw.py +2 -2
  120. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/unframe.py +4 -4
  121. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/vq.py +8 -7
  122. diffsptk-2.5.0/diffsptk/modules/wht.py +115 -0
  123. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/window.py +28 -13
  124. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/yingram.py +3 -3
  125. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/zcross.py +14 -8
  126. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/modules/zerodf.py +3 -3
  127. diffsptk-2.5.0/diffsptk/version.py +1 -0
  128. {diffsptk-2.0.0 → diffsptk-2.5.0}/pyproject.toml +33 -26
  129. diffsptk-2.0.0/.github/workflows/ci.yml +0 -57
  130. diffsptk-2.0.0/.github/workflows/stale.yml +0 -23
  131. diffsptk-2.0.0/Makefile +0 -122
  132. diffsptk-2.0.0/UPLOAD +0 -18
  133. diffsptk-2.0.0/codecov.yml +0 -11
  134. diffsptk-2.0.0/diffsptk/modules/ap.py +0 -338
  135. diffsptk-2.0.0/diffsptk/modules/lbg.py +0 -195
  136. diffsptk-2.0.0/diffsptk/modules/pca.py +0 -130
  137. diffsptk-2.0.0/diffsptk/version.py +0 -1
  138. {diffsptk-2.0.0 → diffsptk-2.5.0}/LICENSE +0 -0
  139. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/__init__.py +0 -0
  140. {diffsptk-2.0.0 → diffsptk-2.5.0}/diffsptk/misc/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  # project
2
+ .venv/
2
3
  dist/
3
- venv/
4
4
 
5
5
  # codecov
6
6
  .coverage
@@ -10,8 +10,7 @@ coverage.xml
10
10
  _build/
11
11
 
12
12
  # tools
13
- tools/SPTK/
14
- tools/taplo/
13
+ tools/**/
15
14
 
16
15
  # misc
17
16
  __pycache__/
@@ -0,0 +1,26 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ authors:
4
+ - family-names: "SPTK Working Group"
5
+ title: "diffsptk"
6
+ url: "https://github.com/sp-nitech/diffsptk"
7
+ preferred-citation:
8
+ type: conference-paper
9
+ title: "SPTK4: An open-source software toolkit for speech signal processing"
10
+ authors:
11
+ - family-names: "Yoshimura"
12
+ given-names: "Takenori"
13
+ - family-names: "Fujimoto"
14
+ given-names: "Takato"
15
+ - family-names: "Oura"
16
+ given-names: "Keiichiro"
17
+ - family-names: "Tokuda"
18
+ given-names: "Keiichi"
19
+ collection-title: "12th ISCA Speech Synthesis Workshop"
20
+ collection-type: proceedings
21
+ doi: 10.21437/SSW.2023-33
22
+ month: 8
23
+ start: 211
24
+ end: 217
25
+ year: 2023
26
+ url: "https://www.isca-archive.org/ssw_2023/yoshimura23_ssw.pdf"
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: diffsptk
3
- Version: 2.0.0
3
+ Version: 2.5.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,28 @@ 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
- Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
19
17
  Classifier: Programming Language :: Python :: 3.11
20
- Requires-Python: >=3.8
21
- Requires-Dist: librosa>=0.10.1
22
- Requires-Dist: numpy
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: numpy>=1.23.0
22
+ Requires-Dist: penn>=0.0.1
23
+ Requires-Dist: scipy>=1.12.0
23
24
  Requires-Dist: soundfile>=0.10.2
24
- Requires-Dist: torch>=1.11.0
25
- Requires-Dist: torchaudio>=0.11.0
26
- Requires-Dist: torchcrepe>=0.0.21
27
- Requires-Dist: torchlpc>=0.2.0
28
- Requires-Dist: vector-quantize-pytorch<=1.12.12,>=0.8.0
25
+ Requires-Dist: torch>=2.3.1
26
+ Requires-Dist: torchaudio>=2.3.1
27
+ Requires-Dist: torchcomp>=0.2.0
28
+ Requires-Dist: torchlpc>=0.6.0
29
+ Requires-Dist: tqdm>=4.63.0
30
+ Requires-Dist: vector-quantize-pytorch>=1.14.9
29
31
  Provides-Extra: dev
30
32
  Requires-Dist: build; extra == 'dev'
31
- Requires-Dist: grayskull; extra == 'dev'
32
- Requires-Dist: isort; extra == 'dev'
33
+ Requires-Dist: codespell; extra == 'dev'
34
+ Requires-Dist: docstrfmt; extra == 'dev'
35
+ Requires-Dist: mdformat; extra == 'dev'
33
36
  Requires-Dist: numpydoc; extra == 'dev'
37
+ Requires-Dist: pkginfo; extra == 'dev'
34
38
  Requires-Dist: pydata-sphinx-theme; extra == 'dev'
35
39
  Requires-Dist: pytest; extra == 'dev'
36
40
  Requires-Dist: pytest-cov; extra == 'dev'
@@ -39,49 +43,49 @@ Requires-Dist: sphinx; extra == 'dev'
39
43
  Requires-Dist: twine; extra == 'dev'
40
44
  Description-Content-Type: text/markdown
41
45
 
42
- diffsptk
43
- ========
46
+ # diffsptk
47
+
44
48
  *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
45
49
 
46
50
  [![Latest Manual](https://img.shields.io/badge/docs-latest-blue.svg)](https://sp-nitech.github.io/diffsptk/latest/)
47
- [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.0.0/)
51
+ [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.5.0/)
48
52
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
49
53
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
50
- [![PyTorch Version](https://img.shields.io/badge/pytorch-1.11.0%20%7C%202.2.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
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)
51
55
  [![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
52
56
  [![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
53
57
  [![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
54
58
  [![GitHub Actions](https://github.com/sp-nitech/diffsptk/workflows/package/badge.svg)](https://github.com/sp-nitech/diffsptk/actions)
55
59
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
56
60
 
61
+ ## Requirements
57
62
 
58
- Requirements
59
- ------------
60
- - Python 3.8+
61
- - PyTorch 1.11.0+
63
+ - Python 3.10+
64
+ - PyTorch 2.3.1+
62
65
 
66
+ ## Documentation
63
67
 
64
- Documentation
65
- -------------
66
- - See [this page](https://sp-nitech.github.io/diffsptk/latest/) for a reference manual.
68
+ - See [this page](https://sp-nitech.github.io/diffsptk/latest/) for the reference manual.
67
69
  - Our [paper](https://www.isca-speech.org/archive/ssw_2023/yoshimura23_ssw.html) is available on the ISCA Archive.
68
70
 
71
+ ## Installation
69
72
 
70
- Installation
71
- ------------
72
73
  The latest stable release can be installed through PyPI by running
74
+
73
75
  ```sh
74
76
  pip install diffsptk
75
77
  ```
78
+
76
79
  The development release can be installed from the master branch:
80
+
77
81
  ```sh
78
82
  pip install git+https://github.com/sp-nitech/diffsptk.git@master
79
83
  ```
80
84
 
85
+ ## Examples
81
86
 
82
- Examples
83
- --------
84
87
  ### Mel-cepstral analysis and synthesis
88
+
85
89
  ```python
86
90
  import diffsptk
87
91
 
@@ -99,11 +103,16 @@ X = stft(x)
99
103
 
100
104
  # Estimate mel-cepstrum of x.
101
105
  alpha = diffsptk.get_alpha(sr)
102
- mcep = diffsptk.MelCepstralAnalysis(cep_order=M, fft_length=n_fft, alpha=alpha, n_iter=10)
106
+ mcep = diffsptk.MelCepstralAnalysis(
107
+ cep_order=M,
108
+ fft_length=n_fft,
109
+ alpha=alpha,
110
+ n_iter=10,
111
+ )
103
112
  mc = mcep(X)
104
113
 
105
114
  # Reconstruct x.
106
- mlsa = diffsptk.MLSA(filter_order=M, frame_period=fp, alpha=alpha, taylor_order=30)
115
+ mlsa = diffsptk.MLSA(filter_order=M, frame_period=fp, alpha=alpha, taylor_order=20)
107
116
  x_hat = mlsa(mlsa(x, -mc), mc)
108
117
 
109
118
  # Write reconstructed waveform.
@@ -114,7 +123,14 @@ error = (x_hat - x).abs().sum()
114
123
  print(error)
115
124
 
116
125
  # Extract pitch of x.
117
- pitch = diffsptk.Pitch(frame_period=fp, sample_rate=sr, f_min=80, f_max=180)
126
+ pitch = diffsptk.Pitch(
127
+ frame_period=fp,
128
+ sample_rate=sr,
129
+ f_min=80,
130
+ f_max=180,
131
+ voicing_threshold=0.4,
132
+ out_format="pitch",
133
+ )
118
134
  p = pitch(x)
119
135
 
120
136
  # Generate excitation signal.
@@ -131,7 +147,107 @@ diffsptk.write("voiced.wav", x_voiced, sr)
131
147
  diffsptk.write("unvoiced.wav", x_unvoiced, sr)
132
148
  ```
133
149
 
150
+ ### WORLD analysis and mel-cepstral synthesis
151
+
152
+ ```python
153
+ import diffsptk
154
+
155
+ fp = 80 # Frame period.
156
+ n_fft = 1024 # FFT length.
157
+ M = 24 # Mel-cepstrum dimensions.
158
+
159
+ # Read waveform.
160
+ x, sr = diffsptk.read("assets/data.wav")
161
+
162
+ # Extract F0 of x, or prepare well-estimated F0.
163
+ pitch = diffsptk.Pitch(
164
+ frame_period=fp,
165
+ sample_rate=sr,
166
+ f_min=80,
167
+ f_max=180,
168
+ voicing_threshold=0.4,
169
+ out_format="f0",
170
+ )
171
+ f0 = pitch(x)
172
+
173
+ # Extract aperiodicity of x by D4C.
174
+ ap = diffsptk.Aperiodicity(
175
+ frame_period=fp,
176
+ sample_rate=sr,
177
+ fft_length=n_fft,
178
+ algorithm="d4c",
179
+ out_format="a",
180
+ )
181
+ A = ap(x, f0)
182
+
183
+ # Extract spectral envelope of x by CheapTrick.
184
+ pitch_spec = diffsptk.PitchAdaptiveSpectralAnalysis(
185
+ frame_period=fp,
186
+ sample_rate=sr,
187
+ fft_length=n_fft,
188
+ )
189
+ H = pitch_spec(x, f0)
190
+
191
+ # Estimate mel-cepstrum of x.
192
+ alpha = diffsptk.get_alpha(sr)
193
+ mcep = diffsptk.MelCepstralAnalysis(cep_order=M, fft_length=n_fft, alpha=alpha)
194
+ mc_a = mcep(A)
195
+ mc_h = mcep(H)
196
+
197
+ # Generate excitation signals.
198
+ excite = diffsptk.ExcitationGeneration(frame_period=fp, unvoiced_region="zeros")
199
+ p = (sr / f0).nan_to_num(posinf=0)
200
+ pulse = excite(p)
201
+ noise = diffsptk.nrand(len(pulse) - 1)
202
+
203
+ # Make mixed excitation signal and reconstruct x.
204
+ mlsa = diffsptk.MLSA(filter_order=M, frame_period=fp, alpha=alpha, taylor_order=20)
205
+ e_p = pulse - mlsa(pulse, mc_a)
206
+ e_a = mlsa(noise, mc_a)
207
+ e = e_p + e_a
208
+ x_hat = mlsa(e, mc_h)
209
+
210
+ # Write reconstructed waveform.
211
+ diffsptk.write("reconst.wav", x_hat, sr)
212
+ ```
213
+
214
+ ### LPC analysis and synthesis
215
+
216
+ ```python
217
+ import diffsptk
218
+
219
+ fl = 400 # Frame length.
220
+ fp = 80 # Frame period.
221
+ M = 24 # LPC dimensions.
222
+
223
+ # Read waveform.
224
+ x, sr = diffsptk.read("assets/data.wav")
225
+
226
+ # Estimate LPC of x.
227
+ frame = diffsptk.Frame(frame_length=fl, frame_period=fp)
228
+ window = diffsptk.Window(in_length=fl)
229
+ lpc = diffsptk.LPC(frame_length=fl, lpc_order=M, eps=1e-6)
230
+ a = lpc(window(frame(x)))
231
+
232
+ # Convert to inverse filter coefficients.
233
+ norm0 = diffsptk.AllPoleToAllZeroDigitalFilterCoefficients(filter_order=M)
234
+ b = norm0(a)
235
+
236
+ # Reconstruct x.
237
+ zerodf = diffsptk.AllZeroDigitalFilter(filter_order=M, frame_period=fp)
238
+ poledf = diffsptk.AllPoleDigitalFilter(filter_order=M, frame_period=fp)
239
+ x_hat = poledf(zerodf(x, b), a)
240
+
241
+ # Write reconstructed waveform.
242
+ diffsptk.write("reconst.wav", x_hat, sr)
243
+
244
+ # Compute error.
245
+ error = (x_hat - x).abs().sum()
246
+ print(error)
247
+ ```
248
+
134
249
  ### Mel-spectrogram, MFCC, and PLP extraction
250
+
135
251
  ```python
136
252
  import diffsptk
137
253
 
@@ -148,7 +264,7 @@ x, sr = diffsptk.read("assets/data.wav")
148
264
  stft = diffsptk.STFT(frame_length=fl, frame_period=fp, fft_length=n_fft)
149
265
  X = stft(x)
150
266
 
151
- # Extract mel-spectrogram.
267
+ # Extract log mel-spectrogram.
152
268
  fbank = diffsptk.MelFilterBankAnalysis(
153
269
  n_channel=n_channel,
154
270
  fft_length=n_fft,
@@ -179,6 +295,7 @@ print(Y.shape)
179
295
  ```
180
296
 
181
297
  ### Subband decomposition
298
+
182
299
  ```python
183
300
  import diffsptk
184
301
 
@@ -191,12 +308,36 @@ x, sr = diffsptk.read("assets/data.wav")
191
308
  # Decompose x.
192
309
  pqmf = diffsptk.PQMF(K, M)
193
310
  decimate = diffsptk.Decimation(K)
194
- y = decimate(pqmf(x), dim=-1)
311
+ y = decimate(pqmf(x))
195
312
 
196
313
  # Reconstruct x.
197
314
  interpolate = diffsptk.Interpolation(K)
198
315
  ipqmf = diffsptk.IPQMF(K, M)
199
- x_hat = ipqmf(interpolate(K * y, dim=-1)).reshape(-1)
316
+ x_hat = ipqmf(interpolate(K * y)).reshape(-1)
317
+
318
+ # Write reconstructed waveform.
319
+ diffsptk.write("reconst.wav", x_hat, sr)
320
+
321
+ # Compute error.
322
+ error = (x_hat - x).abs().sum()
323
+ print(error)
324
+ ```
325
+
326
+ ### Gammatone filter bank analysis and synthesis
327
+
328
+ ```python
329
+ import diffsptk
330
+
331
+ # Read waveform.
332
+ x, sr = diffsptk.read("assets/data.wav")
333
+
334
+ # Decompose x.
335
+ gammatone = diffsptk.GammatoneFilterBankAnalysis(sr)
336
+ y = gammatone(x)
337
+
338
+ # Reconstruct x.
339
+ igammatone = diffsptk.GammatoneFilterBankSynthesis(sr)
340
+ x_hat = igammatone(y).reshape(-1)
200
341
 
201
342
  # Write reconstructed waveform.
202
343
  diffsptk.write("reconst.wav", x_hat, sr)
@@ -207,6 +348,7 @@ print(error)
207
348
  ```
208
349
 
209
350
  ### Constant-Q transform
351
+
210
352
  ```python
211
353
  import diffsptk
212
354
  import librosa # This is to get sample audio.
@@ -234,7 +376,34 @@ error = (x_hat - x).abs().sum()
234
376
  print(error)
235
377
  ```
236
378
 
379
+ ### Modified discrete cosine transform
380
+
381
+ ```python
382
+ import diffsptk
383
+
384
+ fl = 512 # Frame length.
385
+
386
+ # Read waveform.
387
+ x, sr = diffsptk.read("assets/data.wav")
388
+
389
+ # Transform x.
390
+ mdct = diffsptk.MDCT(fl)
391
+ c = mdct(x)
392
+
393
+ # Reconstruct x.
394
+ imdct = diffpstk.IMDCT(fl)
395
+ x_hat = imdct(c, out_length=x.size(0))
396
+
397
+ # Write reconstructed waveform.
398
+ diffsptk.write("reconst.wav", x_hat, sr)
399
+
400
+ # Compute error.
401
+ error = (x_hat - x).abs().sum()
402
+ print(error)
403
+ ```
404
+
237
405
  ### Vector quantization
406
+
238
407
  ```python
239
408
  import diffsptk
240
409
 
@@ -253,14 +422,12 @@ error = (x_hat - x).abs().sum()
253
422
  print(error)
254
423
  ```
255
424
 
425
+ ## License
256
426
 
257
- License
258
- -------
259
427
  This software is released under the Apache License 2.0.
260
428
 
429
+ ## Citation
261
430
 
262
- Reference
263
- ---------
264
431
  ```bibtex
265
432
  @InProceedings{sp-nitech2023sptk,
266
433
  author = {Takenori Yoshimura and Takato Fujimoto and Keiichiro Oura and Keiichi Tokuda},