diffsptk 1.2.1__tar.gz → 2.1.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 (113) hide show
  1. {diffsptk-1.2.1 → diffsptk-2.1.0}/.gitignore +1 -2
  2. diffsptk-2.1.0/CITATION.cff +26 -0
  3. {diffsptk-1.2.1 → diffsptk-2.1.0}/PKG-INFO +71 -37
  4. {diffsptk-1.2.1 → diffsptk-2.1.0}/README.md +61 -33
  5. {diffsptk-1.2.1 → diffsptk-2.1.0}/diffsptk/__init__.py +3 -2
  6. diffsptk-2.1.0/diffsptk/functional.py +2033 -0
  7. {diffsptk-1.2.1 → diffsptk-2.1.0}/diffsptk/misc/signals.py +24 -26
  8. {diffsptk-1.2.1 → diffsptk-2.1.0}/diffsptk/misc/utils.py +78 -54
  9. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/__init__.py +15 -7
  10. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/acorr.py +53 -40
  11. diffsptk-2.1.0/diffsptk/modules/acr2csm.py +118 -0
  12. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/alaw.py +26 -14
  13. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/ap.py +30 -34
  14. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/b2mc.py +24 -13
  15. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/c2acr.py +31 -18
  16. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/c2mpir.py +18 -13
  17. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/c2ndps.py +34 -18
  18. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/cdist.py +26 -21
  19. diffsptk-2.1.0/diffsptk/modules/cqt.py +299 -0
  20. diffsptk-2.1.0/diffsptk/modules/csm2acr.py +92 -0
  21. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/dct.py +30 -33
  22. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/decimate.py +24 -16
  23. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/delay.py +26 -23
  24. diffsptk-2.1.0/diffsptk/modules/delta.py +165 -0
  25. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/dequantize.py +30 -26
  26. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/df2.py +9 -10
  27. diffsptk-2.1.0/diffsptk/modules/dfs.py +112 -0
  28. diffsptk-2.1.0/diffsptk/modules/drc.py +183 -0
  29. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/entropy.py +26 -15
  30. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/excite.py +27 -21
  31. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/fbank.py +113 -64
  32. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/fftcep.py +29 -25
  33. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/frame.py +27 -23
  34. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/freqt.py +48 -28
  35. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/freqt2.py +78 -77
  36. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/gmm.py +23 -21
  37. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/gnorm.py +26 -15
  38. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/grpdelay.py +68 -35
  39. diffsptk-2.1.0/diffsptk/modules/histogram.py +114 -0
  40. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/ialaw.py +26 -15
  41. diffsptk-2.1.0/diffsptk/modules/icqt.py +244 -0
  42. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/idct.py +25 -10
  43. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/ifreqt2.py +55 -34
  44. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/ignorm.py +25 -14
  45. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/imglsadf.py +3 -3
  46. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/imsvq.py +2 -2
  47. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/interpolate.py +26 -19
  48. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/ipqmf.py +10 -10
  49. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/istft.py +34 -15
  50. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/iulaw.py +24 -12
  51. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/ivq.py +2 -2
  52. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lar2par.py +21 -16
  53. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lbg.py +18 -16
  54. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/levdur.py +18 -13
  55. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/linear_intpl.py +17 -14
  56. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lpc.py +17 -12
  57. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lpc2lsp.py +65 -48
  58. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lpc2par.py +33 -31
  59. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lpccheck.py +45 -20
  60. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lsp2lpc.py +43 -33
  61. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lsp2sp.py +88 -54
  62. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/lspcheck.py +47 -34
  63. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/magic_intpl.py +26 -11
  64. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mc2b.py +27 -13
  65. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mcep.py +18 -23
  66. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mcpf.py +17 -18
  67. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mfcc.py +32 -26
  68. diffsptk-2.1.0/diffsptk/modules/mgc2mgc.py +383 -0
  69. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mgc2sp.py +65 -41
  70. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mgcep.py +25 -29
  71. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mglsadf.py +35 -31
  72. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mlpg.py +63 -47
  73. diffsptk-2.1.0/diffsptk/modules/mlsacheck.py +200 -0
  74. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/mpir2c.py +18 -13
  75. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/msvq.py +5 -5
  76. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/ndps2c.py +37 -20
  77. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/norm0.py +12 -6
  78. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/par2lar.py +14 -9
  79. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/par2lpc.py +31 -10
  80. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/pca.py +58 -15
  81. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/phase.py +38 -27
  82. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/pitch.py +33 -25
  83. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/plp.py +38 -32
  84. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/pol_root.py +24 -12
  85. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/poledf.py +23 -14
  86. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/pqmf.py +17 -17
  87. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/quantize.py +29 -28
  88. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/rlevdur.py +31 -19
  89. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/rmse.py +21 -16
  90. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/root_pol.py +39 -20
  91. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/smcep.py +36 -45
  92. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/snr.py +35 -27
  93. diffsptk-2.1.0/diffsptk/modules/spec.py +133 -0
  94. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/stft.py +43 -21
  95. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/ulaw.py +24 -12
  96. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/unframe.py +48 -28
  97. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/vq.py +5 -5
  98. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/window.py +62 -49
  99. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/yingram.py +77 -49
  100. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/zcross.py +25 -13
  101. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.1.0/diffsptk/modules}/zerodf.py +27 -22
  102. diffsptk-2.1.0/diffsptk/version.py +1 -0
  103. diffsptk-2.1.0/pyproject.toml +100 -0
  104. diffsptk-1.2.1/diffsptk/core/cqt.py +0 -115
  105. diffsptk-1.2.1/diffsptk/core/delta.py +0 -172
  106. diffsptk-1.2.1/diffsptk/core/dfs.py +0 -142
  107. diffsptk-1.2.1/diffsptk/core/mgc2mgc.py +0 -293
  108. diffsptk-1.2.1/diffsptk/core/mlsacheck.py +0 -168
  109. diffsptk-1.2.1/diffsptk/core/spec.py +0 -108
  110. diffsptk-1.2.1/diffsptk/version.py +0 -1
  111. diffsptk-1.2.1/pyproject.toml +0 -101
  112. {diffsptk-1.2.1 → diffsptk-2.1.0}/LICENSE +0 -0
  113. {diffsptk-1.2.1 → diffsptk-2.1.0}/diffsptk/misc/__init__.py +0 -0
@@ -10,8 +10,7 @@ coverage.xml
10
10
  _build/
11
11
 
12
12
  # tools
13
- tools/SPTK/
14
- tools/toml/
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
1
  Metadata-Version: 2.4
2
2
  Name: diffsptk
3
- Version: 1.2.1
3
+ Version: 2.1.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/
@@ -11,82 +11,87 @@ License: Apache 2.0
11
11
  License-File: LICENSE
12
12
  Keywords: dsp,pytorch,signal processing,sptk
13
13
  Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3 :: Only
14
16
  Classifier: Programming Language :: Python :: 3.8
15
17
  Classifier: Programming Language :: Python :: 3.9
16
18
  Classifier: Programming Language :: Python :: 3.10
17
19
  Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
18
21
  Requires-Python: >=3.8
19
- Requires-Dist: numpy
22
+ Requires-Dist: librosa>=0.10.1
23
+ Requires-Dist: numpy<2.0.0
24
+ Requires-Dist: scipy<1.14.0
20
25
  Requires-Dist: soundfile>=0.10.2
21
26
  Requires-Dist: torch>=1.11.0
22
27
  Requires-Dist: torchaudio>=0.11.0
28
+ Requires-Dist: torchcomp>=0.1.1
23
29
  Requires-Dist: torchcrepe>=0.0.21
24
30
  Requires-Dist: torchlpc>=0.2.0
25
31
  Requires-Dist: vector-quantize-pytorch<=1.12.12,>=0.8.0
26
32
  Provides-Extra: dev
27
- Requires-Dist: black; extra == 'dev'
28
33
  Requires-Dist: build; extra == 'dev'
29
34
  Requires-Dist: isort; extra == 'dev'
35
+ Requires-Dist: mdformat; extra == 'dev'
30
36
  Requires-Dist: numpydoc; extra == 'dev'
31
37
  Requires-Dist: pydata-sphinx-theme; extra == 'dev'
32
- Requires-Dist: pyproject-flake8; extra == 'dev'
33
38
  Requires-Dist: pytest; extra == 'dev'
34
39
  Requires-Dist: pytest-cov; extra == 'dev'
40
+ Requires-Dist: ruff; extra == 'dev'
35
41
  Requires-Dist: sphinx; extra == 'dev'
36
42
  Requires-Dist: twine; extra == 'dev'
37
43
  Description-Content-Type: text/markdown
38
44
 
39
- diffsptk
40
- ========
45
+ # diffsptk
46
+
41
47
  *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
42
48
 
43
49
  [![Latest Manual](https://img.shields.io/badge/docs-latest-blue.svg)](https://sp-nitech.github.io/diffsptk/latest/)
44
- [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/1.2.1/)
50
+ [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.1.0/)
45
51
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
46
52
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
47
- [![PyTorch Version](https://img.shields.io/badge/pytorch-1.11.0%20%7C%202.2.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
53
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-1.12.0%20%7C%202.3.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
48
54
  [![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
49
55
  [![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
50
56
  [![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
51
57
  [![GitHub Actions](https://github.com/sp-nitech/diffsptk/workflows/package/badge.svg)](https://github.com/sp-nitech/diffsptk/actions)
52
- [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
58
+ [![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)
53
59
 
60
+ ## Requirements
54
61
 
55
- Requirements
56
- ------------
57
62
  - Python 3.8+
58
- - PyTorch 1.11.0+
63
+ - PyTorch 1.12.0+
59
64
 
65
+ ## Documentation
60
66
 
61
- Documentation
62
- -------------
63
67
  - See [this page](https://sp-nitech.github.io/diffsptk/latest/) for a reference manual.
64
68
  - Our [paper](https://www.isca-speech.org/archive/ssw_2023/yoshimura23_ssw.html) is available on the ISCA Archive.
65
69
 
70
+ ## Installation
66
71
 
67
- Installation
68
- ------------
69
72
  The latest stable release can be installed through PyPI by running
73
+
70
74
  ```sh
71
75
  pip install diffsptk
72
76
  ```
77
+
73
78
  The development release can be installed from the master branch:
79
+
74
80
  ```sh
75
81
  pip install git+https://github.com/sp-nitech/diffsptk.git@master
76
82
  ```
77
83
 
84
+ ## Examples
78
85
 
79
- Examples
80
- --------
81
86
  ### Mel-cepstral analysis and synthesis
87
+
82
88
  ```python
83
89
  import diffsptk
84
90
 
85
- # Set analysis condition.
86
- fl = 400
87
- fp = 80
88
- n_fft = 512
89
- M = 24
91
+ fl = 400 # Frame length.
92
+ fp = 80 # Frame period.
93
+ n_fft = 512 # FFT length.
94
+ M = 24 # Mel-cepstrum dimensions.
90
95
 
91
96
  # Read waveform.
92
97
  x, sr = diffsptk.read("assets/data.wav")
@@ -130,15 +135,15 @@ diffsptk.write("unvoiced.wav", x_unvoiced, sr)
130
135
  ```
131
136
 
132
137
  ### Mel-spectrogram, MFCC, and PLP extraction
138
+
133
139
  ```python
134
140
  import diffsptk
135
141
 
136
- # Set analysis condition.
137
- fl = 400
138
- fp = 80
139
- n_fft = 512
140
- n_channel = 80
141
- M = 12
142
+ fl = 400 # Frame length
143
+ fp = 80 # Frame period
144
+ n_fft = 512 # FFT length
145
+ n_channel = 80 # Number of channels
146
+ M = 12 # MFCC/PLP dimensions
142
147
 
143
148
  # Read waveform.
144
149
  x, sr = diffsptk.read("assets/data.wav")
@@ -148,7 +153,7 @@ stft = diffsptk.STFT(frame_length=fl, frame_period=fp, fft_length=n_fft)
148
153
  X = stft(x)
149
154
 
150
155
  # Extract mel-spectrogram.
151
- fbank = diffsptk.MelFilterBankAnalysis(
156
+ fbank = diffsptk.FBANK(
152
157
  n_channel=n_channel,
153
158
  fft_length=n_fft,
154
159
  sample_rate=sr,
@@ -178,6 +183,7 @@ print(Y.shape)
178
183
  ```
179
184
 
180
185
  ### Subband decomposition
186
+
181
187
  ```python
182
188
  import diffsptk
183
189
 
@@ -190,12 +196,41 @@ x, sr = diffsptk.read("assets/data.wav")
190
196
  # Decompose x.
191
197
  pqmf = diffsptk.PQMF(K, M)
192
198
  decimate = diffsptk.Decimation(K)
193
- y = decimate(pqmf(x), dim=-1)
199
+ y = decimate(pqmf(x))
194
200
 
195
201
  # Reconstruct x.
196
202
  interpolate = diffsptk.Interpolation(K)
197
203
  ipqmf = diffsptk.IPQMF(K, M)
198
- x_hat = ipqmf(interpolate(K * y, dim=-1)).reshape(-1)
204
+ x_hat = ipqmf(interpolate(K * y)).reshape(-1)
205
+
206
+ # Write reconstructed waveform.
207
+ diffsptk.write("reconst.wav", x_hat, sr)
208
+
209
+ # Compute error.
210
+ error = (x_hat - x).abs().sum()
211
+ print(error)
212
+ ```
213
+
214
+ ### Constant-Q transform
215
+
216
+ ```python
217
+ import diffsptk
218
+ import librosa # This is to get sample audio.
219
+
220
+ fp = 128 # Frame period.
221
+ K = 252 # Number of CQ-bins.
222
+ B = 36 # Number of bins per octave.
223
+
224
+ # Read waveform.
225
+ x, sr = diffsptk.read(librosa.ex("trumpet"))
226
+
227
+ # Transform x.
228
+ cqt = diffsptk.CQT(fp, sr, n_bin=K, n_bin_per_octave=B)
229
+ c = cqt(x)
230
+
231
+ # Reconstruct x.
232
+ icqt = diffsptk.ICQT(fp, sr, n_bin=K, n_bin_per_octave=B)
233
+ x_hat = icqt(c, out_length=x.size(0))
199
234
 
200
235
  # Write reconstructed waveform.
201
236
  diffsptk.write("reconst.wav", x_hat, sr)
@@ -206,6 +241,7 @@ print(error)
206
241
  ```
207
242
 
208
243
  ### Vector quantization
244
+
209
245
  ```python
210
246
  import diffsptk
211
247
 
@@ -224,19 +260,17 @@ error = (x_hat - x).abs().sum()
224
260
  print(error)
225
261
  ```
226
262
 
263
+ ## License
227
264
 
228
- License
229
- -------
230
265
  This software is released under the Apache License 2.0.
231
266
 
267
+ ## Citation
232
268
 
233
- Reference
234
- ---------
235
269
  ```bibtex
236
270
  @InProceedings{sp-nitech2023sptk,
237
271
  author = {Takenori Yoshimura and Takato Fujimoto and Keiichiro Oura and Keiichi Tokuda},
238
272
  title = {{SPTK4}: An open-source software toolkit for speech signal processing},
239
- booktitle = {12th ISCASpeech Synthesis Workshop (SSW 2023)},
273
+ booktitle = {12th ISCA Speech Synthesis Workshop (SSW 2023)},
240
274
  pages = {211--217},
241
275
  year = {2023},
242
276
  }
@@ -1,54 +1,53 @@
1
- diffsptk
2
- ========
1
+ # diffsptk
2
+
3
3
  *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
4
4
 
5
5
  [![Latest Manual](https://img.shields.io/badge/docs-latest-blue.svg)](https://sp-nitech.github.io/diffsptk/latest/)
6
- [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/1.2.1/)
6
+ [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.1.0/)
7
7
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
8
8
  [![Python Version](https://img.shields.io/pypi/pyversions/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
9
- [![PyTorch Version](https://img.shields.io/badge/pytorch-1.11.0%20%7C%202.2.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
9
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-1.12.0%20%7C%202.3.1-orange.svg)](https://pypi.python.org/pypi/diffsptk)
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)
13
13
  [![GitHub Actions](https://github.com/sp-nitech/diffsptk/workflows/package/badge.svg)](https://github.com/sp-nitech/diffsptk/actions)
14
- [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
14
+ [![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)
15
15
 
16
+ ## Requirements
16
17
 
17
- Requirements
18
- ------------
19
18
  - Python 3.8+
20
- - PyTorch 1.11.0+
19
+ - PyTorch 1.12.0+
21
20
 
21
+ ## Documentation
22
22
 
23
- Documentation
24
- -------------
25
23
  - See [this page](https://sp-nitech.github.io/diffsptk/latest/) for a reference manual.
26
24
  - Our [paper](https://www.isca-speech.org/archive/ssw_2023/yoshimura23_ssw.html) is available on the ISCA Archive.
27
25
 
26
+ ## Installation
28
27
 
29
- Installation
30
- ------------
31
28
  The latest stable release can be installed through PyPI by running
29
+
32
30
  ```sh
33
31
  pip install diffsptk
34
32
  ```
33
+
35
34
  The development release can be installed from the master branch:
35
+
36
36
  ```sh
37
37
  pip install git+https://github.com/sp-nitech/diffsptk.git@master
38
38
  ```
39
39
 
40
+ ## Examples
40
41
 
41
- Examples
42
- --------
43
42
  ### Mel-cepstral analysis and synthesis
43
+
44
44
  ```python
45
45
  import diffsptk
46
46
 
47
- # Set analysis condition.
48
- fl = 400
49
- fp = 80
50
- n_fft = 512
51
- M = 24
47
+ fl = 400 # Frame length.
48
+ fp = 80 # Frame period.
49
+ n_fft = 512 # FFT length.
50
+ M = 24 # Mel-cepstrum dimensions.
52
51
 
53
52
  # Read waveform.
54
53
  x, sr = diffsptk.read("assets/data.wav")
@@ -92,15 +91,15 @@ diffsptk.write("unvoiced.wav", x_unvoiced, sr)
92
91
  ```
93
92
 
94
93
  ### Mel-spectrogram, MFCC, and PLP extraction
94
+
95
95
  ```python
96
96
  import diffsptk
97
97
 
98
- # Set analysis condition.
99
- fl = 400
100
- fp = 80
101
- n_fft = 512
102
- n_channel = 80
103
- M = 12
98
+ fl = 400 # Frame length
99
+ fp = 80 # Frame period
100
+ n_fft = 512 # FFT length
101
+ n_channel = 80 # Number of channels
102
+ M = 12 # MFCC/PLP dimensions
104
103
 
105
104
  # Read waveform.
106
105
  x, sr = diffsptk.read("assets/data.wav")
@@ -110,7 +109,7 @@ stft = diffsptk.STFT(frame_length=fl, frame_period=fp, fft_length=n_fft)
110
109
  X = stft(x)
111
110
 
112
111
  # Extract mel-spectrogram.
113
- fbank = diffsptk.MelFilterBankAnalysis(
112
+ fbank = diffsptk.FBANK(
114
113
  n_channel=n_channel,
115
114
  fft_length=n_fft,
116
115
  sample_rate=sr,
@@ -140,6 +139,7 @@ print(Y.shape)
140
139
  ```
141
140
 
142
141
  ### Subband decomposition
142
+
143
143
  ```python
144
144
  import diffsptk
145
145
 
@@ -152,12 +152,41 @@ x, sr = diffsptk.read("assets/data.wav")
152
152
  # Decompose x.
153
153
  pqmf = diffsptk.PQMF(K, M)
154
154
  decimate = diffsptk.Decimation(K)
155
- y = decimate(pqmf(x), dim=-1)
155
+ y = decimate(pqmf(x))
156
156
 
157
157
  # Reconstruct x.
158
158
  interpolate = diffsptk.Interpolation(K)
159
159
  ipqmf = diffsptk.IPQMF(K, M)
160
- x_hat = ipqmf(interpolate(K * y, dim=-1)).reshape(-1)
160
+ x_hat = ipqmf(interpolate(K * y)).reshape(-1)
161
+
162
+ # Write reconstructed waveform.
163
+ diffsptk.write("reconst.wav", x_hat, sr)
164
+
165
+ # Compute error.
166
+ error = (x_hat - x).abs().sum()
167
+ print(error)
168
+ ```
169
+
170
+ ### Constant-Q transform
171
+
172
+ ```python
173
+ import diffsptk
174
+ import librosa # This is to get sample audio.
175
+
176
+ fp = 128 # Frame period.
177
+ K = 252 # Number of CQ-bins.
178
+ B = 36 # Number of bins per octave.
179
+
180
+ # Read waveform.
181
+ x, sr = diffsptk.read(librosa.ex("trumpet"))
182
+
183
+ # Transform x.
184
+ cqt = diffsptk.CQT(fp, sr, n_bin=K, n_bin_per_octave=B)
185
+ c = cqt(x)
186
+
187
+ # Reconstruct x.
188
+ icqt = diffsptk.ICQT(fp, sr, n_bin=K, n_bin_per_octave=B)
189
+ x_hat = icqt(c, out_length=x.size(0))
161
190
 
162
191
  # Write reconstructed waveform.
163
192
  diffsptk.write("reconst.wav", x_hat, sr)
@@ -168,6 +197,7 @@ print(error)
168
197
  ```
169
198
 
170
199
  ### Vector quantization
200
+
171
201
  ```python
172
202
  import diffsptk
173
203
 
@@ -186,19 +216,17 @@ error = (x_hat - x).abs().sum()
186
216
  print(error)
187
217
  ```
188
218
 
219
+ ## License
189
220
 
190
- License
191
- -------
192
221
  This software is released under the Apache License 2.0.
193
222
 
223
+ ## Citation
194
224
 
195
- Reference
196
- ---------
197
225
  ```bibtex
198
226
  @InProceedings{sp-nitech2023sptk,
199
227
  author = {Takenori Yoshimura and Takato Fujimoto and Keiichiro Oura and Keiichi Tokuda},
200
228
  title = {{SPTK4}: An open-source software toolkit for speech signal processing},
201
- booktitle = {12th ISCASpeech Synthesis Workshop (SSW 2023)},
229
+ booktitle = {12th ISCA Speech Synthesis Workshop (SSW 2023)},
202
230
  pages = {211--217},
203
231
  year = {2023},
204
232
  }
@@ -1,5 +1,6 @@
1
- from . import core
1
+ from . import functional
2
2
  from . import misc
3
- from .core import *
3
+ from . import modules
4
4
  from .misc import *
5
+ from .modules import *
5
6
  from .version import __version__