diffsptk 2.0.0__tar.gz → 3.0.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.
- {diffsptk-2.0.0 → diffsptk-3.0.0}/.gitignore +3 -4
- diffsptk-3.0.0/CITATION.cff +26 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/LICENSE +1 -1
- {diffsptk-2.0.0 → diffsptk-3.0.0}/PKG-INFO +211 -42
- {diffsptk-2.0.0 → diffsptk-3.0.0}/README.md +193 -28
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/__init__.py +4 -2
- diffsptk-3.0.0/diffsptk/functional.py +2743 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/__init__.py +46 -5
- diffsptk-3.0.0/diffsptk/modules/acorr.py +116 -0
- diffsptk-3.0.0/diffsptk/modules/acr2csm.py +142 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/alaw.py +39 -26
- diffsptk-3.0.0/diffsptk/modules/ap.py +630 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/b2mc.py +44 -24
- diffsptk-3.0.0/diffsptk/modules/base.py +57 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/c2acr.py +38 -19
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/c2mpir.py +43 -22
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/c2ndps.py +48 -29
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/cdist.py +41 -27
- diffsptk-3.0.0/diffsptk/modules/chroma.py +134 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/cqt.py +44 -39
- diffsptk-3.0.0/diffsptk/modules/csm2acr.py +111 -0
- diffsptk-3.0.0/diffsptk/modules/dct.py +125 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/decimate.py +37 -25
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/delay.py +49 -33
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/delta.py +56 -40
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/dequantize.py +43 -28
- diffsptk-3.0.0/diffsptk/modules/df2.py +137 -0
- diffsptk-3.0.0/diffsptk/modules/dfs.py +147 -0
- diffsptk-3.0.0/diffsptk/modules/dht.py +108 -0
- diffsptk-3.0.0/diffsptk/modules/drc.py +188 -0
- diffsptk-3.0.0/diffsptk/modules/dst.py +121 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/entropy.py +33 -21
- diffsptk-3.0.0/diffsptk/modules/excite.py +199 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/fbank.py +91 -70
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/fftcep.py +53 -27
- diffsptk-3.0.0/diffsptk/modules/flux.py +120 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/frame.py +53 -25
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/freqt.py +49 -35
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/freqt2.py +51 -36
- diffsptk-3.0.0/diffsptk/modules/gammatone.py +230 -0
- diffsptk-3.0.0/diffsptk/modules/gmm.py +451 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/gnorm.py +46 -25
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/grpdelay.py +41 -47
- diffsptk-3.0.0/diffsptk/modules/hilbert.py +110 -0
- diffsptk-3.0.0/diffsptk/modules/hilbert2.py +115 -0
- diffsptk-3.0.0/diffsptk/modules/histogram.py +129 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/ialaw.py +37 -26
- diffsptk-3.0.0/diffsptk/modules/ica.py +187 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/icqt.py +43 -38
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/idct.py +37 -22
- diffsptk-3.0.0/diffsptk/modules/idht.py +96 -0
- diffsptk-3.0.0/diffsptk/modules/idst.py +96 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/ifreqt2.py +47 -37
- diffsptk-3.0.0/diffsptk/modules/igammatone.py +207 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/ignorm.py +40 -25
- diffsptk-3.0.0/diffsptk/modules/imdct.py +205 -0
- diffsptk-3.0.0/diffsptk/modules/imdst.py +92 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/imglsadf.py +10 -16
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/imsvq.py +12 -6
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/interpolate.py +39 -24
- diffsptk-3.0.0/diffsptk/modules/ipnorm.py +90 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/ipqmf.py +26 -19
- diffsptk-3.0.0/diffsptk/modules/is2par.py +89 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/istft.py +71 -39
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/iulaw.py +34 -23
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/ivq.py +12 -6
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/lar2par.py +35 -15
- diffsptk-3.0.0/diffsptk/modules/lbg.py +343 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/levdur.py +45 -17
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/linear_intpl.py +36 -19
- diffsptk-3.0.0/diffsptk/modules/lpc.py +116 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/lpc2lsp.py +78 -59
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/lpc2par.py +42 -25
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/lpccheck.py +38 -25
- diffsptk-3.0.0/diffsptk/modules/lsp2lpc.py +163 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/lsp2sp.py +91 -78
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/lspcheck.py +49 -34
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/magic_intpl.py +36 -25
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/mc2b.py +45 -26
- diffsptk-3.0.0/diffsptk/modules/mcep.py +245 -0
- diffsptk-3.0.0/diffsptk/modules/mcpf.py +162 -0
- diffsptk-3.0.0/diffsptk/modules/mdct.py +214 -0
- diffsptk-3.0.0/diffsptk/modules/mdst.py +89 -0
- diffsptk-3.0.0/diffsptk/modules/mfcc.py +207 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/mgc2mgc.py +187 -185
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/mgc2sp.py +80 -66
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/mgcep.py +106 -86
- diffsptk-3.0.0/diffsptk/modules/mglsadf.py +540 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/mlpg.py +45 -33
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/mlsacheck.py +93 -84
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/mpir2c.py +47 -26
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/msvq.py +24 -19
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/ndps2c.py +51 -32
- diffsptk-3.0.0/diffsptk/modules/nmf.py +267 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/norm0.py +31 -12
- diffsptk-3.0.0/diffsptk/modules/par2is.py +92 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/par2lar.py +37 -15
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/par2lpc.py +38 -26
- diffsptk-3.0.0/diffsptk/modules/pca.py +216 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/phase.py +32 -17
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/pitch.py +150 -79
- diffsptk-3.0.0/diffsptk/modules/pitch_spec.py +532 -0
- diffsptk-3.0.0/diffsptk/modules/plp.py +279 -0
- diffsptk-3.0.0/diffsptk/modules/pnorm.py +121 -0
- diffsptk-3.0.0/diffsptk/modules/pol_root.py +115 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/poledf.py +44 -20
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/pqmf.py +50 -36
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/quantize.py +46 -28
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/rlevdur.py +38 -26
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/rmse.py +36 -23
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/root_pol.py +58 -38
- diffsptk-3.0.0/diffsptk/modules/smcep.py +272 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/snr.py +39 -30
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/spec.py +50 -47
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/stft.py +84 -41
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/ulaw.py +36 -23
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/unframe.py +55 -47
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/vq.py +21 -17
- diffsptk-3.0.0/diffsptk/modules/wht.py +126 -0
- diffsptk-3.0.0/diffsptk/modules/window.py +160 -0
- diffsptk-3.0.0/diffsptk/modules/yingram.py +196 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/zcross.py +41 -20
- {diffsptk-2.0.0 → diffsptk-3.0.0}/diffsptk/modules/zerodf.py +38 -20
- {diffsptk-2.0.0/diffsptk/misc → diffsptk-3.0.0/diffsptk}/signals.py +26 -23
- diffsptk-3.0.0/diffsptk/third_party/librosa/LICENSE +15 -0
- diffsptk-3.0.0/diffsptk/third_party/librosa/__init__.py +2 -0
- diffsptk-3.0.0/diffsptk/third_party/librosa/constantq.py +95 -0
- diffsptk-3.0.0/diffsptk/third_party/librosa/filters.py +299 -0
- diffsptk-3.0.0/diffsptk/third_party/librosa/util.py +172 -0
- diffsptk-3.0.0/diffsptk/third_party/world/LICENSE +39 -0
- diffsptk-3.0.0/diffsptk/third_party/world/__init__.py +1 -0
- diffsptk-3.0.0/diffsptk/third_party/world/common.py +150 -0
- diffsptk-3.0.0/diffsptk/utils/__init__.py +3 -0
- diffsptk-3.0.0/diffsptk/utils/private.py +293 -0
- diffsptk-3.0.0/diffsptk/utils/public.py +172 -0
- diffsptk-3.0.0/diffsptk/version.py +1 -0
- {diffsptk-2.0.0 → diffsptk-3.0.0}/pyproject.toml +34 -26
- diffsptk-2.0.0/.github/workflows/ci.yml +0 -57
- diffsptk-2.0.0/.github/workflows/stale.yml +0 -23
- diffsptk-2.0.0/Makefile +0 -122
- diffsptk-2.0.0/UPLOAD +0 -18
- diffsptk-2.0.0/codecov.yml +0 -11
- diffsptk-2.0.0/diffsptk/functional.py +0 -1897
- diffsptk-2.0.0/diffsptk/misc/__init__.py +0 -5
- diffsptk-2.0.0/diffsptk/misc/utils.py +0 -340
- diffsptk-2.0.0/diffsptk/modules/acorr.py +0 -110
- diffsptk-2.0.0/diffsptk/modules/ap.py +0 -338
- diffsptk-2.0.0/diffsptk/modules/dct.py +0 -86
- diffsptk-2.0.0/diffsptk/modules/df2.py +0 -103
- diffsptk-2.0.0/diffsptk/modules/dfs.py +0 -112
- diffsptk-2.0.0/diffsptk/modules/excite.py +0 -130
- diffsptk-2.0.0/diffsptk/modules/gmm.py +0 -340
- diffsptk-2.0.0/diffsptk/modules/lbg.py +0 -195
- diffsptk-2.0.0/diffsptk/modules/lpc.py +0 -74
- diffsptk-2.0.0/diffsptk/modules/lsp2lpc.py +0 -120
- diffsptk-2.0.0/diffsptk/modules/mcep.py +0 -138
- diffsptk-2.0.0/diffsptk/modules/mcpf.py +0 -103
- diffsptk-2.0.0/diffsptk/modules/mfcc.py +0 -139
- diffsptk-2.0.0/diffsptk/modules/mglsadf.py +0 -411
- diffsptk-2.0.0/diffsptk/modules/pca.py +0 -130
- diffsptk-2.0.0/diffsptk/modules/plp.py +0 -172
- diffsptk-2.0.0/diffsptk/modules/pol_root.py +0 -78
- diffsptk-2.0.0/diffsptk/modules/smcep.py +0 -176
- diffsptk-2.0.0/diffsptk/modules/window.py +0 -125
- diffsptk-2.0.0/diffsptk/modules/yingram.py +0 -174
- diffsptk-2.0.0/diffsptk/version.py +0 -1
|
@@ -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"
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright
|
|
190
|
+
Copyright 2022 SPTK Working Group
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: diffsptk
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.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
|
-
|
|
21
|
-
|
|
22
|
-
Requires-
|
|
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: pylstraight>=0.1.0
|
|
24
|
+
Requires-Dist: scipy>=1.12.0
|
|
23
25
|
Requires-Dist: soundfile>=0.10.2
|
|
24
|
-
Requires-Dist: torch>=
|
|
25
|
-
Requires-Dist: torchaudio>=
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist: torchlpc>=0.
|
|
28
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: torch>=2.3.1
|
|
27
|
+
Requires-Dist: torchaudio>=2.3.1
|
|
28
|
+
Requires-Dist: torchcomp>=0.2.0
|
|
29
|
+
Requires-Dist: torchlpc>=0.6.0
|
|
30
|
+
Requires-Dist: tqdm>=4.63.0
|
|
31
|
+
Requires-Dist: vector-quantize-pytorch>=1.14.9
|
|
29
32
|
Provides-Extra: dev
|
|
30
33
|
Requires-Dist: build; extra == 'dev'
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist:
|
|
34
|
+
Requires-Dist: codespell; 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
|
[](https://sp-nitech.github.io/diffsptk/latest/)
|
|
47
|
-
[](https://sp-nitech.github.io/diffsptk/
|
|
51
|
+
[](https://sp-nitech.github.io/diffsptk/3.0.0/)
|
|
48
52
|
[](https://pepy.tech/project/diffsptk)
|
|
49
53
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
50
|
-
[](https://pypi.python.org/pypi/diffsptk)
|
|
51
55
|
[](https://pypi.python.org/pypi/diffsptk)
|
|
52
56
|
[](https://app.codecov.io/gh/sp-nitech/diffsptk)
|
|
53
57
|
[](https://github.com/sp-nitech/diffsptk/blob/master/LICENSE)
|
|
54
58
|
[](https://github.com/sp-nitech/diffsptk/actions)
|
|
55
59
|
[](https://github.com/astral-sh/ruff)
|
|
56
60
|
|
|
61
|
+
## Requirements
|
|
57
62
|
|
|
58
|
-
|
|
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
|
-
|
|
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/3.0.0/) 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(
|
|
106
|
+
mcep = diffsptk.MelCepstralAnalysis(
|
|
107
|
+
fft_length=n_fft,
|
|
108
|
+
cep_order=M,
|
|
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=
|
|
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(
|
|
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,109 @@ 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
|
+
algorithm="cheap-trick",
|
|
189
|
+
out_format="power",
|
|
190
|
+
)
|
|
191
|
+
H = pitch_spec(x, f0)
|
|
192
|
+
|
|
193
|
+
# Estimate mel-cepstrum of x.
|
|
194
|
+
alpha = diffsptk.get_alpha(sr)
|
|
195
|
+
mcep = diffsptk.MelCepstralAnalysis(fft_length=n_fft, cep_order=M, alpha=alpha)
|
|
196
|
+
mc_a = mcep(A)
|
|
197
|
+
mc_h = mcep(H)
|
|
198
|
+
|
|
199
|
+
# Generate excitation signals.
|
|
200
|
+
excite = diffsptk.ExcitationGeneration(frame_period=fp, unvoiced_region="zeros")
|
|
201
|
+
p = (sr / f0).nan_to_num(posinf=0)
|
|
202
|
+
pulse = excite(p)
|
|
203
|
+
noise = diffsptk.nrand(len(pulse) - 1)
|
|
204
|
+
|
|
205
|
+
# Make mixed excitation signal and reconstruct x.
|
|
206
|
+
mlsa = diffsptk.MLSA(filter_order=M, frame_period=fp, alpha=alpha, taylor_order=20)
|
|
207
|
+
e_p = pulse - mlsa(pulse, mc_a)
|
|
208
|
+
e_a = mlsa(noise, mc_a)
|
|
209
|
+
e = e_p + e_a
|
|
210
|
+
x_hat = mlsa(e, mc_h)
|
|
211
|
+
|
|
212
|
+
# Write reconstructed waveform.
|
|
213
|
+
diffsptk.write("reconst.wav", x_hat, sr)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### LPC analysis and synthesis
|
|
217
|
+
|
|
218
|
+
```python
|
|
219
|
+
import diffsptk
|
|
220
|
+
|
|
221
|
+
fl = 400 # Frame length.
|
|
222
|
+
fp = 80 # Frame period.
|
|
223
|
+
M = 24 # LPC dimensions.
|
|
224
|
+
|
|
225
|
+
# Read waveform.
|
|
226
|
+
x, sr = diffsptk.read("assets/data.wav")
|
|
227
|
+
|
|
228
|
+
# Estimate LPC of x.
|
|
229
|
+
frame = diffsptk.Frame(frame_length=fl, frame_period=fp)
|
|
230
|
+
window = diffsptk.Window(in_length=fl)
|
|
231
|
+
lpc = diffsptk.LPC(frame_length=fl, lpc_order=M, eps=1e-6)
|
|
232
|
+
a = lpc(window(frame(x)))
|
|
233
|
+
|
|
234
|
+
# Convert to inverse filter coefficients.
|
|
235
|
+
norm0 = diffsptk.AllPoleToAllZeroDigitalFilterCoefficients(filter_order=M)
|
|
236
|
+
b = norm0(a)
|
|
237
|
+
|
|
238
|
+
# Reconstruct x.
|
|
239
|
+
zerodf = diffsptk.AllZeroDigitalFilter(filter_order=M, frame_period=fp)
|
|
240
|
+
poledf = diffsptk.AllPoleDigitalFilter(filter_order=M, frame_period=fp)
|
|
241
|
+
x_hat = poledf(zerodf(x, b), a)
|
|
242
|
+
|
|
243
|
+
# Write reconstructed waveform.
|
|
244
|
+
diffsptk.write("reconst.wav", x_hat, sr)
|
|
245
|
+
|
|
246
|
+
# Compute error.
|
|
247
|
+
error = (x_hat - x).abs().sum()
|
|
248
|
+
print(error)
|
|
249
|
+
```
|
|
250
|
+
|
|
134
251
|
### Mel-spectrogram, MFCC, and PLP extraction
|
|
252
|
+
|
|
135
253
|
```python
|
|
136
254
|
import diffsptk
|
|
137
255
|
|
|
@@ -148,10 +266,10 @@ x, sr = diffsptk.read("assets/data.wav")
|
|
|
148
266
|
stft = diffsptk.STFT(frame_length=fl, frame_period=fp, fft_length=n_fft)
|
|
149
267
|
X = stft(x)
|
|
150
268
|
|
|
151
|
-
# Extract mel-spectrogram.
|
|
269
|
+
# Extract log mel-spectrogram.
|
|
152
270
|
fbank = diffsptk.MelFilterBankAnalysis(
|
|
153
|
-
n_channel=n_channel,
|
|
154
271
|
fft_length=n_fft,
|
|
272
|
+
n_channel=n_channel,
|
|
155
273
|
sample_rate=sr,
|
|
156
274
|
)
|
|
157
275
|
Y = fbank(X)
|
|
@@ -159,9 +277,9 @@ print(Y.shape)
|
|
|
159
277
|
|
|
160
278
|
# Extract MFCC.
|
|
161
279
|
mfcc = diffsptk.MFCC(
|
|
280
|
+
fft_length=n_fft,
|
|
162
281
|
mfcc_order=M,
|
|
163
282
|
n_channel=n_channel,
|
|
164
|
-
fft_length=n_fft,
|
|
165
283
|
sample_rate=sr,
|
|
166
284
|
)
|
|
167
285
|
Y = mfcc(X)
|
|
@@ -169,9 +287,9 @@ print(Y.shape)
|
|
|
169
287
|
|
|
170
288
|
# Extract PLP.
|
|
171
289
|
plp = diffsptk.PLP(
|
|
290
|
+
fft_length=n_fft,
|
|
172
291
|
plp_order=M,
|
|
173
292
|
n_channel=n_channel,
|
|
174
|
-
fft_length=n_fft,
|
|
175
293
|
sample_rate=sr,
|
|
176
294
|
)
|
|
177
295
|
Y = plp(X)
|
|
@@ -179,6 +297,7 @@ print(Y.shape)
|
|
|
179
297
|
```
|
|
180
298
|
|
|
181
299
|
### Subband decomposition
|
|
300
|
+
|
|
182
301
|
```python
|
|
183
302
|
import diffsptk
|
|
184
303
|
|
|
@@ -191,12 +310,36 @@ x, sr = diffsptk.read("assets/data.wav")
|
|
|
191
310
|
# Decompose x.
|
|
192
311
|
pqmf = diffsptk.PQMF(K, M)
|
|
193
312
|
decimate = diffsptk.Decimation(K)
|
|
194
|
-
y = decimate(pqmf(x)
|
|
313
|
+
y = decimate(pqmf(x))
|
|
195
314
|
|
|
196
315
|
# Reconstruct x.
|
|
197
316
|
interpolate = diffsptk.Interpolation(K)
|
|
198
317
|
ipqmf = diffsptk.IPQMF(K, M)
|
|
199
|
-
x_hat = ipqmf(interpolate(K * y
|
|
318
|
+
x_hat = ipqmf(interpolate(K * y)).reshape(-1)
|
|
319
|
+
|
|
320
|
+
# Write reconstructed waveform.
|
|
321
|
+
diffsptk.write("reconst.wav", x_hat, sr)
|
|
322
|
+
|
|
323
|
+
# Compute error.
|
|
324
|
+
error = (x_hat - x).abs().sum()
|
|
325
|
+
print(error)
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Gammatone filter bank analysis and synthesis
|
|
329
|
+
|
|
330
|
+
```python
|
|
331
|
+
import diffsptk
|
|
332
|
+
|
|
333
|
+
# Read waveform.
|
|
334
|
+
x, sr = diffsptk.read("assets/data.wav")
|
|
335
|
+
|
|
336
|
+
# Decompose x.
|
|
337
|
+
gammatone = diffsptk.GammatoneFilterBankAnalysis(sr)
|
|
338
|
+
y = gammatone(x)
|
|
339
|
+
|
|
340
|
+
# Reconstruct x.
|
|
341
|
+
igammatone = diffsptk.GammatoneFilterBankSynthesis(sr)
|
|
342
|
+
x_hat = igammatone(y).reshape(-1)
|
|
200
343
|
|
|
201
344
|
# Write reconstructed waveform.
|
|
202
345
|
diffsptk.write("reconst.wav", x_hat, sr)
|
|
@@ -207,6 +350,7 @@ print(error)
|
|
|
207
350
|
```
|
|
208
351
|
|
|
209
352
|
### Constant-Q transform
|
|
353
|
+
|
|
210
354
|
```python
|
|
211
355
|
import diffsptk
|
|
212
356
|
import librosa # This is to get sample audio.
|
|
@@ -234,7 +378,34 @@ error = (x_hat - x).abs().sum()
|
|
|
234
378
|
print(error)
|
|
235
379
|
```
|
|
236
380
|
|
|
381
|
+
### Modified discrete cosine transform
|
|
382
|
+
|
|
383
|
+
```python
|
|
384
|
+
import diffsptk
|
|
385
|
+
|
|
386
|
+
fl = 512 # Frame length.
|
|
387
|
+
|
|
388
|
+
# Read waveform.
|
|
389
|
+
x, sr = diffsptk.read("assets/data.wav")
|
|
390
|
+
|
|
391
|
+
# Transform x.
|
|
392
|
+
mdct = diffsptk.MDCT(fl)
|
|
393
|
+
c = mdct(x)
|
|
394
|
+
|
|
395
|
+
# Reconstruct x.
|
|
396
|
+
imdct = diffsptk.IMDCT(fl)
|
|
397
|
+
x_hat = imdct(c, out_length=x.size(0))
|
|
398
|
+
|
|
399
|
+
# Write reconstructed waveform.
|
|
400
|
+
diffsptk.write("reconst.wav", x_hat, sr)
|
|
401
|
+
|
|
402
|
+
# Compute error.
|
|
403
|
+
error = (x_hat - x).abs().sum()
|
|
404
|
+
print(error)
|
|
405
|
+
```
|
|
406
|
+
|
|
237
407
|
### Vector quantization
|
|
408
|
+
|
|
238
409
|
```python
|
|
239
410
|
import diffsptk
|
|
240
411
|
|
|
@@ -253,14 +424,12 @@ error = (x_hat - x).abs().sum()
|
|
|
253
424
|
print(error)
|
|
254
425
|
```
|
|
255
426
|
|
|
427
|
+
## License
|
|
256
428
|
|
|
257
|
-
License
|
|
258
|
-
-------
|
|
259
429
|
This software is released under the Apache License 2.0.
|
|
260
430
|
|
|
431
|
+
## Citation
|
|
261
432
|
|
|
262
|
-
Reference
|
|
263
|
-
---------
|
|
264
433
|
```bibtex
|
|
265
434
|
@InProceedings{sp-nitech2023sptk,
|
|
266
435
|
author = {Takenori Yoshimura and Takato Fujimoto and Keiichiro Oura and Keiichi Tokuda},
|