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.
- {diffsptk-1.2.1 → diffsptk-2.0.1}/.gitignore +1 -2
- diffsptk-2.0.1/CITATION.cff +26 -0
- {diffsptk-1.2.1 → diffsptk-2.0.1}/PKG-INFO +49 -20
- {diffsptk-1.2.1 → diffsptk-2.0.1}/README.md +43 -17
- {diffsptk-1.2.1 → diffsptk-2.0.1}/diffsptk/__init__.py +3 -2
- diffsptk-2.0.1/diffsptk/functional.py +1943 -0
- {diffsptk-1.2.1 → diffsptk-2.0.1}/diffsptk/misc/signals.py +24 -26
- {diffsptk-1.2.1 → diffsptk-2.0.1}/diffsptk/misc/utils.py +66 -52
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/__init__.py +11 -7
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/acorr.py +53 -40
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/alaw.py +26 -14
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ap.py +30 -34
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/b2mc.py +24 -13
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/c2acr.py +31 -18
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/c2mpir.py +18 -13
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/c2ndps.py +34 -18
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/cdist.py +26 -21
- diffsptk-2.0.1/diffsptk/modules/cqt.py +299 -0
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/dct.py +30 -33
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/decimate.py +24 -16
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/delay.py +26 -23
- diffsptk-2.0.1/diffsptk/modules/delta.py +165 -0
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/dequantize.py +30 -26
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/df2.py +9 -10
- diffsptk-2.0.1/diffsptk/modules/dfs.py +112 -0
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/entropy.py +26 -15
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/excite.py +27 -21
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/fbank.py +113 -64
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/fftcep.py +29 -25
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/frame.py +27 -23
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/freqt.py +48 -28
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/freqt2.py +78 -77
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/gmm.py +23 -21
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/gnorm.py +26 -15
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/grpdelay.py +68 -35
- diffsptk-2.0.1/diffsptk/modules/histogram.py +114 -0
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ialaw.py +26 -15
- diffsptk-2.0.1/diffsptk/modules/icqt.py +244 -0
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/idct.py +25 -10
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ifreqt2.py +55 -34
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ignorm.py +25 -14
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/imglsadf.py +3 -3
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/imsvq.py +2 -2
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/interpolate.py +26 -19
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ipqmf.py +10 -10
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/istft.py +34 -15
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/iulaw.py +24 -12
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ivq.py +2 -2
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lar2par.py +21 -16
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lbg.py +18 -16
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/levdur.py +17 -13
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/linear_intpl.py +17 -14
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lpc.py +17 -12
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lpc2lsp.py +65 -48
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lpc2par.py +33 -31
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lpccheck.py +45 -20
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lsp2lpc.py +43 -33
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lsp2sp.py +88 -54
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/lspcheck.py +47 -34
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/magic_intpl.py +26 -11
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mc2b.py +27 -13
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mcep.py +18 -23
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mcpf.py +17 -18
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mfcc.py +32 -26
- diffsptk-2.0.1/diffsptk/modules/mgc2mgc.py +383 -0
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mgc2sp.py +65 -41
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mgcep.py +25 -29
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mglsadf.py +30 -30
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mlpg.py +63 -47
- diffsptk-2.0.1/diffsptk/modules/mlsacheck.py +200 -0
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/mpir2c.py +18 -13
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/msvq.py +5 -5
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ndps2c.py +37 -20
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/norm0.py +12 -6
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/par2lar.py +14 -9
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/par2lpc.py +31 -10
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/pca.py +58 -15
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/phase.py +38 -27
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/pitch.py +33 -25
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/plp.py +38 -32
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/pol_root.py +24 -12
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/poledf.py +17 -14
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/pqmf.py +17 -17
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/quantize.py +29 -28
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/rlevdur.py +31 -19
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/rmse.py +21 -16
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/root_pol.py +39 -20
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/smcep.py +36 -45
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/snr.py +35 -27
- diffsptk-2.0.1/diffsptk/modules/spec.py +133 -0
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/stft.py +43 -21
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/ulaw.py +24 -12
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/unframe.py +48 -28
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/vq.py +5 -5
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/window.py +62 -49
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/yingram.py +77 -49
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/zcross.py +25 -13
- {diffsptk-1.2.1/diffsptk/core → diffsptk-2.0.1/diffsptk/modules}/zerodf.py +27 -22
- diffsptk-2.0.1/diffsptk/version.py +1 -0
- diffsptk-2.0.1/pyproject.toml +97 -0
- diffsptk-1.2.1/diffsptk/core/cqt.py +0 -115
- diffsptk-1.2.1/diffsptk/core/delta.py +0 -172
- diffsptk-1.2.1/diffsptk/core/dfs.py +0 -142
- diffsptk-1.2.1/diffsptk/core/mgc2mgc.py +0 -293
- diffsptk-1.2.1/diffsptk/core/mlsacheck.py +0 -168
- diffsptk-1.2.1/diffsptk/core/spec.py +0 -108
- diffsptk-1.2.1/diffsptk/version.py +0 -1
- diffsptk-1.2.1/pyproject.toml +0 -101
- {diffsptk-1.2.1 → diffsptk-2.0.1}/LICENSE +0 -0
- {diffsptk-1.2.1 → diffsptk-2.0.1}/diffsptk/misc/__init__.py +0 -0
|
@@ -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:
|
|
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
|
[](https://sp-nitech.github.io/diffsptk/latest/)
|
|
44
|
-
[](https://sp-nitech.github.io/diffsptk/
|
|
47
|
+
[](https://sp-nitech.github.io/diffsptk/2.0.1/)
|
|
45
48
|
[](https://pepy.tech/project/diffsptk)
|
|
46
49
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
47
|
-
[](https://pypi.python.org/pypi/diffsptk)
|
|
48
51
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
49
52
|
[](https://app.codecov.io/gh/sp-nitech/diffsptk)
|
|
50
53
|
[](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
|
|
51
54
|
[](https://github.com/sp-nitech/diffsptk/actions)
|
|
52
|
-
[](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
|
-
#
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
#
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
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
|
|
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
|
[](https://sp-nitech.github.io/diffsptk/latest/)
|
|
6
|
-
[](https://sp-nitech.github.io/diffsptk/
|
|
6
|
+
[](https://sp-nitech.github.io/diffsptk/2.0.1/)
|
|
7
7
|
[](https://pepy.tech/project/diffsptk)
|
|
8
8
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
9
|
-
[](https://pypi.python.org/pypi/diffsptk)
|
|
10
10
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
11
11
|
[](https://app.codecov.io/gh/sp-nitech/diffsptk)
|
|
12
12
|
[](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
|
|
13
13
|
[](https://github.com/sp-nitech/diffsptk/actions)
|
|
14
|
-
[](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
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
#
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
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
|
|
227
|
+
booktitle = {12th ISCA Speech Synthesis Workshop (SSW 2023)},
|
|
202
228
|
pages = {211--217},
|
|
203
229
|
year = {2023},
|
|
204
230
|
}
|