diffsptk 1.2.1__tar.gz → 2.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. {diffsptk-1.2.1 → diffsptk-2.0.1}/.gitignore +1 -2
  2. diffsptk-2.0.1/CITATION.cff +26 -0
  3. {diffsptk-1.2.1 → diffsptk-2.0.1}/PKG-INFO +49 -20
  4. {diffsptk-1.2.1 → diffsptk-2.0.1}/README.md +43 -17
  5. {diffsptk-1.2.1 → diffsptk-2.0.1}/diffsptk/__init__.py +3 -2
  6. diffsptk-2.0.1/diffsptk/functional.py +1943 -0
  7. {diffsptk-1.2.1 → diffsptk-2.0.1}/diffsptk/misc/signals.py +24 -26
  8. {diffsptk-1.2.1 → diffsptk-2.0.1}/diffsptk/misc/utils.py +66 -52
  9. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/__init__.py +11 -7
  10. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/acorr.py +53 -40
  11. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/alaw.py +26 -14
  12. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ap.py +30 -34
  13. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/b2mc.py +24 -13
  14. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/c2acr.py +31 -18
  15. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/c2mpir.py +18 -13
  16. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/c2ndps.py +34 -18
  17. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/cdist.py +26 -21
  18. diffsptk-2.0.1/diffsptk/modules/cqt.py +299 -0
  19. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/dct.py +30 -33
  20. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/decimate.py +24 -16
  21. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/delay.py +26 -23
  22. diffsptk-2.0.1/diffsptk/modules/delta.py +165 -0
  23. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/dequantize.py +30 -26
  24. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/df2.py +9 -10
  25. diffsptk-2.0.1/diffsptk/modules/dfs.py +112 -0
  26. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/entropy.py +26 -15
  27. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/excite.py +27 -21
  28. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/fbank.py +113 -64
  29. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/fftcep.py +29 -25
  30. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/frame.py +27 -23
  31. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/freqt.py +48 -28
  32. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/freqt2.py +78 -77
  33. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/gmm.py +23 -21
  34. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/gnorm.py +26 -15
  35. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/grpdelay.py +68 -35
  36. diffsptk-2.0.1/diffsptk/modules/histogram.py +114 -0
  37. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ialaw.py +26 -15
  38. diffsptk-2.0.1/diffsptk/modules/icqt.py +244 -0
  39. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/idct.py +25 -10
  40. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ifreqt2.py +55 -34
  41. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ignorm.py +25 -14
  42. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/imglsadf.py +3 -3
  43. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/imsvq.py +2 -2
  44. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/interpolate.py +26 -19
  45. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ipqmf.py +10 -10
  46. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/istft.py +34 -15
  47. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/iulaw.py +24 -12
  48. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ivq.py +2 -2
  49. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lar2par.py +21 -16
  50. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lbg.py +18 -16
  51. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/levdur.py +17 -13
  52. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/linear_intpl.py +17 -14
  53. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lpc.py +17 -12
  54. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lpc2lsp.py +65 -48
  55. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lpc2par.py +33 -31
  56. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lpccheck.py +45 -20
  57. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lsp2lpc.py +43 -33
  58. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lsp2sp.py +88 -54
  59. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lspcheck.py +47 -34
  60. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/magic_intpl.py +26 -11
  61. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mc2b.py +27 -13
  62. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mcep.py +18 -23
  63. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mcpf.py +17 -18
  64. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mfcc.py +32 -26
  65. diffsptk-2.0.1/diffsptk/modules/mgc2mgc.py +383 -0
  66. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mgc2sp.py +65 -41
  67. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mgcep.py +25 -29
  68. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mglsadf.py +30 -30
  69. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mlpg.py +63 -47
  70. diffsptk-2.0.1/diffsptk/modules/mlsacheck.py +200 -0
  71. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mpir2c.py +18 -13
  72. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/msvq.py +5 -5
  73. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ndps2c.py +37 -20
  74. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/norm0.py +12 -6
  75. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/par2lar.py +14 -9
  76. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/par2lpc.py +31 -10
  77. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/pca.py +58 -15
  78. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/phase.py +38 -27
  79. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/pitch.py +33 -25
  80. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/plp.py +38 -32
  81. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/pol_root.py +24 -12
  82. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/poledf.py +17 -14
  83. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/pqmf.py +17 -17
  84. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/quantize.py +29 -28
  85. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/rlevdur.py +31 -19
  86. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/rmse.py +21 -16
  87. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/root_pol.py +39 -20
  88. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/smcep.py +36 -45
  89. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/snr.py +35 -27
  90. diffsptk-2.0.1/diffsptk/modules/spec.py +133 -0
  91. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/stft.py +43 -21
  92. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ulaw.py +24 -12
  93. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/unframe.py +48 -28
  94. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/vq.py +5 -5
  95. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/window.py +62 -49
  96. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/yingram.py +77 -49
  97. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/zcross.py +25 -13
  98. {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/zerodf.py +27 -22
  99. diffsptk-2.0.1/diffsptk/version.py +1 -0
  100. diffsptk-2.0.1/pyproject.toml +97 -0
  101. diffsptk-1.2.1/diffsptk/core/cqt.py +0 -115
  102. diffsptk-1.2.1/diffsptk/core/delta.py +0 -172
  103. diffsptk-1.2.1/diffsptk/core/dfs.py +0 -142
  104. diffsptk-1.2.1/diffsptk/core/mgc2mgc.py +0 -293
  105. diffsptk-1.2.1/diffsptk/core/mlsacheck.py +0 -168
  106. diffsptk-1.2.1/diffsptk/core/spec.py +0 -108
  107. diffsptk-1.2.1/diffsptk/version.py +0 -1
  108. diffsptk-1.2.1/pyproject.toml +0 -101
  109. {diffsptk-1.2.1 → diffsptk-2.0.1}/LICENSE +0 -0
  110. {diffsptk-1.2.1 → diffsptk-2.0.1}/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.0.1
4
4
  Summary: Speech signal processing modules for machine learning
5
5
  Project-URL: Homepage, https://sp-tk.sourceforge.net/
6
6
  Project-URL: Documentation, https://sp-nitech.github.io/diffsptk/latest/
@@ -11,11 +11,15 @@ 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
22
+ Requires-Dist: librosa>=0.10.1
19
23
  Requires-Dist: numpy
20
24
  Requires-Dist: soundfile>=0.10.2
21
25
  Requires-Dist: torch>=1.11.0
@@ -24,14 +28,13 @@ Requires-Dist: torchcrepe>=0.0.21
24
28
  Requires-Dist: torchlpc>=0.2.0
25
29
  Requires-Dist: vector-quantize-pytorch<=1.12.12,>=0.8.0
26
30
  Provides-Extra: dev
27
- Requires-Dist: black; extra == 'dev'
28
31
  Requires-Dist: build; extra == 'dev'
29
32
  Requires-Dist: isort; extra == 'dev'
30
33
  Requires-Dist: numpydoc; extra == 'dev'
31
34
  Requires-Dist: pydata-sphinx-theme; extra == 'dev'
32
- Requires-Dist: pyproject-flake8; extra == 'dev'
33
35
  Requires-Dist: pytest; extra == 'dev'
34
36
  Requires-Dist: pytest-cov; extra == 'dev'
37
+ Requires-Dist: ruff; extra == 'dev'
35
38
  Requires-Dist: sphinx; extra == 'dev'
36
39
  Requires-Dist: twine; extra == 'dev'
37
40
  Description-Content-Type: text/markdown
@@ -41,15 +44,15 @@ diffsptk
41
44
  *diffsptk* is a differentiable version of [SPTK](https://github.com/sp-nitech/SPTK) based on the PyTorch framework.
42
45
 
43
46
  [![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/)
47
+ [![Stable Manual](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/diffsptk/2.0.1/)
45
48
  [![Downloads](https://static.pepy.tech/badge/diffsptk)](https://pepy.tech/project/diffsptk)
46
49
  [![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)
50
+ [![PyTorch Version](https://img.shields.io/badge/pytorch-1.11.0%20%7C%202.3.0-orange.svg)](https://pypi.python.org/pypi/diffsptk)
48
51
  [![PyPI Version](https://img.shields.io/pypi/v/diffsptk.svg)](https://pypi.python.org/pypi/diffsptk)
49
52
  [![Codecov](https://codecov.io/gh/sp-nitech/diffsptk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/sp-nitech/diffsptk)
50
53
  [![License](https://img.shields.io/github/license/sp-nitech/diffsptk.svg)](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
51
54
  [![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)
55
+ [![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
56
 
54
57
 
55
58
  Requirements
@@ -82,11 +85,10 @@ Examples
82
85
  ```python
83
86
  import diffsptk
84
87
 
85
- # Set analysis condition.
86
- fl = 400
87
- fp = 80
88
- n_fft = 512
89
- M = 24
88
+ fl = 400 # Frame length.
89
+ fp = 80 # Frame period.
90
+ n_fft = 512 # FFT length.
91
+ M = 24 # Mel-cepstrum dimensions.
90
92
 
91
93
  # Read waveform.
92
94
  x, sr = diffsptk.read("assets/data.wav")
@@ -133,12 +135,11 @@ diffsptk.write("unvoiced.wav", x_unvoiced, sr)
133
135
  ```python
134
136
  import diffsptk
135
137
 
136
- # Set analysis condition.
137
- fl = 400
138
- fp = 80
139
- n_fft = 512
140
- n_channel = 80
141
- M = 12
138
+ fl = 400 # Frame length
139
+ fp = 80 # Frame period
140
+ n_fft = 512 # FFT length
141
+ n_channel = 80 # Number of channels
142
+ M = 12 # MFCC/PLP dimensions
142
143
 
143
144
  # Read waveform.
144
145
  x, sr = diffsptk.read("assets/data.wav")
@@ -205,6 +206,34 @@ error = (x_hat - x).abs().sum()
205
206
  print(error)
206
207
  ```
207
208
 
209
+ ### Constant-Q transform
210
+ ```python
211
+ import diffsptk
212
+ import librosa # This is to get sample audio.
213
+
214
+ fp = 128 # Frame period.
215
+ K = 252 # Number of CQ-bins.
216
+ B = 36 # Number of bins per octave.
217
+
218
+ # Read waveform.
219
+ x, sr = diffsptk.read(librosa.ex("trumpet"))
220
+
221
+ # Transform x.
222
+ cqt = diffsptk.CQT(fp, sr, n_bin=K, n_bin_per_octave=B)
223
+ c = cqt(x)
224
+
225
+ # Reconstruct x.
226
+ icqt = diffsptk.ICQT(fp, sr, n_bin=K, n_bin_per_octave=B)
227
+ x_hat = icqt(c, out_length=x.size(0))
228
+
229
+ # Write reconstructed waveform.
230
+ diffsptk.write("reconst.wav", x_hat, sr)
231
+
232
+ # Compute error.
233
+ error = (x_hat - x).abs().sum()
234
+ print(error)
235
+ ```
236
+
208
237
  ### Vector quantization
209
238
  ```python
210
239
  import diffsptk
@@ -230,13 +259,13 @@ License
230
259
  This software is released under the Apache License 2.0.
231
260
 
232
261
 
233
- Reference
234
- ---------
262
+ Citation
263
+ --------
235
264
  ```bibtex
236
265
  @InProceedings{sp-nitech2023sptk,
237
266
  author = {Takenori Yoshimura and Takato Fujimoto and Keiichiro Oura and Keiichi Tokuda},
238
267
  title = {{SPTK4}: An open-source software toolkit for speech signal processing},
239
- booktitle = {12th ISCASpeech Synthesis Workshop (SSW 2023)},
268
+ booktitle = {12th ISCA Speech Synthesis Workshop (SSW 2023)},
240
269
  pages = {211--217},
241
270
  year = {2023},
242
271
  }
@@ -3,15 +3,15 @@ diffsptk
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.0.1/)
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.11.0%20%7C%202.3.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)
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
16
 
17
17
  Requirements
@@ -44,11 +44,10 @@ Examples
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")
@@ -95,12 +94,11 @@ diffsptk.write("unvoiced.wav", x_unvoiced, sr)
95
94
  ```python
96
95
  import diffsptk
97
96
 
98
- # Set analysis condition.
99
- fl = 400
100
- fp = 80
101
- n_fft = 512
102
- n_channel = 80
103
- M = 12
97
+ fl = 400 # Frame length
98
+ fp = 80 # Frame period
99
+ n_fft = 512 # FFT length
100
+ n_channel = 80 # Number of channels
101
+ M = 12 # MFCC/PLP dimensions
104
102
 
105
103
  # Read waveform.
106
104
  x, sr = diffsptk.read("assets/data.wav")
@@ -167,6 +165,34 @@ error = (x_hat - x).abs().sum()
167
165
  print(error)
168
166
  ```
169
167
 
168
+ ### Constant-Q transform
169
+ ```python
170
+ import diffsptk
171
+ import librosa # This is to get sample audio.
172
+
173
+ fp = 128 # Frame period.
174
+ K = 252 # Number of CQ-bins.
175
+ B = 36 # Number of bins per octave.
176
+
177
+ # Read waveform.
178
+ x, sr = diffsptk.read(librosa.ex("trumpet"))
179
+
180
+ # Transform x.
181
+ cqt = diffsptk.CQT(fp, sr, n_bin=K, n_bin_per_octave=B)
182
+ c = cqt(x)
183
+
184
+ # Reconstruct x.
185
+ icqt = diffsptk.ICQT(fp, sr, n_bin=K, n_bin_per_octave=B)
186
+ x_hat = icqt(c, out_length=x.size(0))
187
+
188
+ # Write reconstructed waveform.
189
+ diffsptk.write("reconst.wav", x_hat, sr)
190
+
191
+ # Compute error.
192
+ error = (x_hat - x).abs().sum()
193
+ print(error)
194
+ ```
195
+
170
196
  ### Vector quantization
171
197
  ```python
172
198
  import diffsptk
@@ -192,13 +218,13 @@ License
192
218
  This software is released under the Apache License 2.0.
193
219
 
194
220
 
195
- Reference
196
- ---------
221
+ Citation
222
+ --------
197
223
  ```bibtex
198
224
  @InProceedings{sp-nitech2023sptk,
199
225
  author = {Takenori Yoshimura and Takato Fujimoto and Keiichiro Oura and Keiichi Tokuda},
200
226
  title = {{SPTK4}: An open-source software toolkit for speech signal processing},
201
- booktitle = {12th ISCASpeech Synthesis Workshop (SSW 2023)},
227
+ booktitle = {12th ISCA Speech Synthesis Workshop (SSW 2023)},
202
228
  pages = {211--217},
203
229
  year = {2023},
204
230
  }
@@ -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__