mirror of
https://github.com/neodyland/sbv2-api.git
synced 2025-12-23 15:59:57 +00:00
Compare commits
42 Commits
commit-dd8
...
commit-905
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5e92f6211 | ||
|
|
b835577325 | ||
|
|
3caf93441a | ||
|
|
4deefc596b | ||
|
|
9174aa9b11 | ||
|
|
6bccf0468b | ||
|
|
bbb3f0003b | ||
|
|
46de7a9d3f | ||
|
|
252b27de48 | ||
|
|
1dd3e02562 | ||
|
|
4990261ecd | ||
|
|
e873892223 | ||
|
|
f081b2ed22 | ||
|
|
103eb51ca8 | ||
|
|
01541ff381 | ||
|
|
70c2341afd | ||
|
|
a5d783bd65 | ||
|
|
633dfc305e | ||
|
|
53d7daf11a | ||
|
|
5abfe732e4 | ||
|
|
48aef6cef4 | ||
|
|
64fc74eee6 | ||
|
|
6e01103c5d | ||
|
|
00e95cd77c | ||
|
|
01f2aaa406 | ||
|
|
3785faf81e | ||
|
|
70e16f95ad | ||
|
|
a67df43fc7 | ||
|
|
472d1c600f | ||
|
|
acf94a1283 | ||
|
|
dd5c536f39 | ||
|
|
07637f587d | ||
|
|
e8dbf956e1 | ||
|
|
2687af1a9b | ||
|
|
e915e2bc84 | ||
|
|
22ed557395 | ||
|
|
b8f0477318 | ||
|
|
f4de3e15ae | ||
|
|
fc944b9d33 | ||
|
|
4255e15748 | ||
|
|
8bf3906105 | ||
|
|
1d80eda325 |
116
Cargo.lock
generated
116
Cargo.lock
generated
@@ -78,9 +78,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.96"
|
version = "1.0.98"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4"
|
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atomic-waker"
|
name = "atomic-waker"
|
||||||
@@ -606,14 +606,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "env_logger"
|
name = "env_logger"
|
||||||
version = "0.11.6"
|
version = "0.11.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0"
|
checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"env_filter",
|
"env_filter",
|
||||||
"humantime",
|
"jiff",
|
||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -630,7 +630,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -896,12 +896,6 @@ version = "1.0.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "humantime"
|
|
||||||
version = "2.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
@@ -1186,6 +1180,30 @@ version = "1.0.14"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff"
|
||||||
|
version = "0.2.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c102670231191d07d37a35af3eb77f1f0dbf7a71be51a962dcd57ea607be7260"
|
||||||
|
dependencies = [
|
||||||
|
"jiff-static",
|
||||||
|
"log",
|
||||||
|
"portable-atomic",
|
||||||
|
"portable-atomic-util",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jiff-static"
|
||||||
|
version = "0.2.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4cdde31a9d349f1b1f51a0b3714a5940ac022976f4b49485fc04be052b183b4c"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jlabel"
|
name = "jlabel"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
@@ -1397,7 +1415,7 @@ dependencies = [
|
|||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"tar",
|
"tar",
|
||||||
"thiserror 2.0.11",
|
"thiserror 2.0.12",
|
||||||
"yada",
|
"yada",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1425,9 +1443,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.26"
|
version = "0.4.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "macro_rules_attribute"
|
name = "macro_rules_attribute"
|
||||||
@@ -1797,7 +1815,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc"
|
checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
"thiserror 2.0.11",
|
"thiserror 2.0.12",
|
||||||
"ucd-trie",
|
"ucd-trie",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1943,9 +1961,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyo3"
|
name = "pyo3"
|
||||||
version = "0.23.5"
|
version = "0.24.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7778bffd85cf38175ac1f545509665d0b9b92a198ca7941f131f85f7a4f9a872"
|
checksum = "7f1c6c3591120564d64db2261bec5f910ae454f01def849b9c22835a84695e86"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
@@ -1962,9 +1980,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyo3-build-config"
|
name = "pyo3-build-config"
|
||||||
version = "0.23.5"
|
version = "0.24.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94f6cbe86ef3bf18998d9df6e0f3fc1050a8c5efa409bf712e661a4366e010fb"
|
checksum = "e9b6c2b34cf71427ea37c7001aefbaeb85886a074795e35f161f5aecc7620a7a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
@@ -1972,9 +1990,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyo3-ffi"
|
name = "pyo3-ffi"
|
||||||
version = "0.23.5"
|
version = "0.24.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e9f1b4c431c0bb1c8fb0a338709859eed0d030ff6daa34368d3b152a63dfdd8d"
|
checksum = "5507651906a46432cdda02cd02dd0319f6064f1374c9147c45b978621d2c3a9c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"pyo3-build-config",
|
"pyo3-build-config",
|
||||||
@@ -1982,9 +2000,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyo3-macros"
|
name = "pyo3-macros"
|
||||||
version = "0.23.5"
|
version = "0.24.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fbc2201328f63c4710f68abdf653c89d8dbc2858b88c5d88b0ff38a75288a9da"
|
checksum = "b0d394b5b4fd8d97d48336bb0dd2aebabad39f1d294edd6bcd2cccf2eefe6f42"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"pyo3-macros-backend",
|
"pyo3-macros-backend",
|
||||||
@@ -1994,9 +2012,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyo3-macros-backend"
|
name = "pyo3-macros-backend"
|
||||||
version = "0.23.5"
|
version = "0.24.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fca6726ad0f3da9c9de093d6f116a93c1a38e417ed73bf138472cf4064f72028"
|
checksum = "fd72da09cfa943b1080f621f024d2ef7e2773df7badd51aa30a2be1f8caa7c8e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -2098,7 +2116,7 @@ checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.15",
|
"getrandom 0.2.15",
|
||||||
"libredox",
|
"libredox",
|
||||||
"thiserror 2.0.11",
|
"thiserror 2.0.12",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2204,7 +2222,7 @@ dependencies = [
|
|||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2306,7 +2324,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tar",
|
"tar",
|
||||||
"thiserror 2.0.11",
|
"thiserror 2.0.12",
|
||||||
"tokenizers",
|
"tokenizers",
|
||||||
"ureq",
|
"ureq",
|
||||||
"zstd",
|
"zstd",
|
||||||
@@ -2364,18 +2382,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.218"
|
version = "1.0.219"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
|
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.218"
|
version = "1.0.219"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
|
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2384,9 +2402,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.139"
|
version = "1.0.140"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6"
|
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -2614,9 +2632,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "target-lexicon"
|
name = "target-lexicon"
|
||||||
version = "0.12.16"
|
version = "0.13.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
@@ -2629,7 +2647,7 @@ dependencies = [
|
|||||||
"getrandom 0.3.1",
|
"getrandom 0.3.1",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2643,11 +2661,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "2.0.11"
|
version = "2.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc"
|
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl 2.0.11",
|
"thiserror-impl 2.0.12",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2663,9 +2681,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "2.0.11"
|
version = "2.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
|
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2732,9 +2750,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.43.0"
|
version = "1.44.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e"
|
checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -2926,9 +2944,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ureq"
|
name = "ureq"
|
||||||
version = "3.0.8"
|
version = "3.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "06f78313c985f2fba11100dd06d60dd402d0cabb458af4d94791b8e09c025323"
|
checksum = "b7a3e9af6113ecd57b8c63d3cd76a385b2e3881365f1f489e54f49801d0c83ea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"der",
|
"der",
|
||||||
@@ -2948,9 +2966,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ureq-proto"
|
name = "ureq-proto"
|
||||||
version = "0.3.3"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "64adb55464bad1ab1aa9229133d0d59d2f679180f4d15f0d9debe616f541f25e"
|
checksum = "fadf18427d33828c311234884b7ba2afb57143e6e7e69fda7ee883b624661e36"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"http",
|
"http",
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -1,10 +1,19 @@
|
|||||||
# SBV2-API
|
# SBV2-API
|
||||||
|
|
||||||
## 注意:本バージョンはアルファ版です。
|
> [!CAUTION]
|
||||||
安定版を利用したい場合は[こちら](https://github.com/tuna2134/sbv2-api/tree/v0.1.x)をご覧ください。
|
> 本バージョンはアルファ版です。
|
||||||
|
>
|
||||||
|
> 安定版を利用したい場合は[こちら](https://github.com/neodyland/sbv2-api/tree/v0.1.x)をご覧ください。
|
||||||
|
|
||||||
## 注意: オプションの辞書はLGPLです。
|
> [!CAUTION]
|
||||||
オプションの辞書を使用する場合、バイナリの内部の辞書部分について、LGPLが適用されます。
|
> オプションの辞書はLGPLです。
|
||||||
|
>
|
||||||
|
> オプションの辞書を使用する場合、バイナリの内部の辞書部分について、LGPLが適用されます。
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> このレポジトリはメンテナンスの都合上、[tuna2134](https:://github.com/tuna2134)氏の所属する[Neodyland](https://neody.land/)へとリポジトリ所在地を移動しました。
|
||||||
|
>
|
||||||
|
> 引き続きtuna2134氏がメインメンテナとして管理しています。
|
||||||
|
|
||||||
## プログラミングに詳しくない方向け
|
## プログラミングに詳しくない方向け
|
||||||
|
|
||||||
@@ -20,7 +29,7 @@ JP-Extra しか対応していません。(基本的に対応する予定もあ
|
|||||||
|
|
||||||
## 変換方法
|
## 変換方法
|
||||||
|
|
||||||
[こちら](https://github.com/tuna2134/sbv2-api/tree/main/scripts/convert)を参照してください。
|
[こちら](https://github.com/neodyland/sbv2-api/tree/main/scripts/convert)を参照してください。
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ crate-type = ["cdylib"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
ndarray.workspace = true
|
ndarray.workspace = true
|
||||||
pyo3 = { version = "0.23.0", features = ["anyhow"] }
|
pyo3 = { version = "0.24.0", features = ["anyhow"] }
|
||||||
sbv2_core = { path = "../sbv2_core", features = ["std"], default-features = false }
|
sbv2_core = { path = "../sbv2_core", features = ["std"], default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use crate::mora::{MORA_KATA_TO_MORA_PHONEMES, VOWELS};
|
use crate::mora::{CONSONANTS, MORA_KATA_TO_MORA_PHONEMES, MORA_PHONEMES_TO_MORA_KATA, VOWELS};
|
||||||
use crate::norm::{replace_punctuation, PUNCTUATIONS};
|
use crate::norm::{replace_punctuation, PUNCTUATIONS};
|
||||||
use jpreprocess::{kind, DefaultTokenizer, JPreprocess, SystemDictionaryConfig, UserDictionary};
|
use jpreprocess::{kind, DefaultTokenizer, JPreprocess, SystemDictionaryConfig, UserDictionary};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
@@ -76,6 +76,34 @@ static MORA_PATTERN: Lazy<Vec<String>> = Lazy::new(|| {
|
|||||||
});
|
});
|
||||||
static LONG_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\w)(ー*)").unwrap());
|
static LONG_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\w)(ー*)").unwrap());
|
||||||
|
|
||||||
|
fn phone_tone_to_kana(phones: Vec<String>, tones: Vec<i32>) -> Vec<(String, i32)> {
|
||||||
|
let phones = &phones[1..];
|
||||||
|
let tones = &tones[1..];
|
||||||
|
let mut results = Vec::new();
|
||||||
|
let mut current_mora = String::new();
|
||||||
|
for ((phone, next_phone), (&tone, &next_tone)) in phones
|
||||||
|
.iter()
|
||||||
|
.zip(phones.iter().skip(1))
|
||||||
|
.zip(tones.iter().zip(tones.iter().skip(1)))
|
||||||
|
{
|
||||||
|
if PUNCTUATIONS.contains(&phone.clone().as_str()) {
|
||||||
|
results.push((phone.to_string(), tone));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if CONSONANTS.contains(&phone.clone()) {
|
||||||
|
assert_eq!(current_mora, "");
|
||||||
|
assert_eq!(tone, next_tone);
|
||||||
|
current_mora = phone.to_string()
|
||||||
|
} else {
|
||||||
|
current_mora += phone;
|
||||||
|
let kana = MORA_PHONEMES_TO_MORA_KATA.get(¤t_mora).unwrap();
|
||||||
|
results.push((kana.to_string(), tone));
|
||||||
|
current_mora = String::new();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results
|
||||||
|
}
|
||||||
|
|
||||||
pub struct JTalkProcess {
|
pub struct JTalkProcess {
|
||||||
jpreprocess: Arc<JPreprocessType>,
|
jpreprocess: Arc<JPreprocessType>,
|
||||||
parsed: Vec<String>,
|
parsed: Vec<String>,
|
||||||
@@ -165,6 +193,11 @@ impl JTalkProcess {
|
|||||||
Ok((phones, tones, new_word2ph))
|
Ok((phones, tones, new_word2ph))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn g2kana_tone(&self) -> Result<Vec<(String, i32)>> {
|
||||||
|
let (phones, tones, _) = self.g2p()?;
|
||||||
|
Ok(phone_tone_to_kana(phones, tones))
|
||||||
|
}
|
||||||
|
|
||||||
fn distribute_phone(n_phone: i32, n_word: i32) -> Vec<i32> {
|
fn distribute_phone(n_phone: i32, n_word: i32) -> Vec<i32> {
|
||||||
let mut phones_per_word = vec![0; n_word as usize];
|
let mut phones_per_word = vec![0; n_word as usize];
|
||||||
for _ in 0..n_phone {
|
for _ in 0..n_phone {
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ fn main_inner() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let audio =
|
let audio = tts_holder.easy_synthesize(ident, text, 0, 0, tts::SynthesizeOptions::default())?;
|
||||||
tts_holder.easy_synthesize(ident, &text, 0, 0, tts::SynthesizeOptions::default())?;
|
|
||||||
fs::write("output.wav", audio)?;
|
fs::write("output.wav", audio)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -25,6 +25,21 @@ static MORA_LIST_ADDITIONAL: Lazy<Vec<Mora>> = Lazy::new(|| {
|
|||||||
data.additional
|
data.additional
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pub static MORA_PHONEMES_TO_MORA_KATA: Lazy<HashMap<String, String>> = Lazy::new(|| {
|
||||||
|
let mut map = HashMap::new();
|
||||||
|
for mora in MORA_LIST_MINIMUM.iter() {
|
||||||
|
map.insert(
|
||||||
|
format!(
|
||||||
|
"{}{}",
|
||||||
|
mora.consonant.clone().unwrap_or("".to_string()),
|
||||||
|
mora.vowel
|
||||||
|
),
|
||||||
|
mora.mora.clone(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
map
|
||||||
|
});
|
||||||
|
|
||||||
pub static MORA_KATA_TO_MORA_PHONEMES: Lazy<HashMap<String, (Option<String>, String)>> =
|
pub static MORA_KATA_TO_MORA_PHONEMES: Lazy<HashMap<String, (Option<String>, String)>> =
|
||||||
Lazy::new(|| {
|
Lazy::new(|| {
|
||||||
let mut map = HashMap::new();
|
let mut map = HashMap::new();
|
||||||
@@ -37,4 +52,12 @@ pub static MORA_KATA_TO_MORA_PHONEMES: Lazy<HashMap<String, (Option<String>, Str
|
|||||||
map
|
map
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pub static CONSONANTS: Lazy<Vec<String>> = Lazy::new(|| {
|
||||||
|
let consonants = MORA_KATA_TO_MORA_PHONEMES
|
||||||
|
.values()
|
||||||
|
.filter_map(|(consonant, _)| consonant.clone())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
consonants
|
||||||
|
});
|
||||||
|
|
||||||
pub const VOWELS: [&str; 6] = ["a", "i", "u", "e", "o", "N"];
|
pub const VOWELS: [&str; 6] = ["a", "i", "u", "e", "o", "N"];
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ pub struct TTSModelHolder {
|
|||||||
tokenizer: Tokenizer,
|
tokenizer: Tokenizer,
|
||||||
bert: Session,
|
bert: Session,
|
||||||
models: Vec<TTSModel>,
|
models: Vec<TTSModel>,
|
||||||
jtalk: jtalk::JTalk,
|
pub jtalk: jtalk::JTalk,
|
||||||
max_loaded_models: Option<usize>,
|
max_loaded_models: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +205,23 @@ impl TTSModelHolder {
|
|||||||
) -> Result<(Array2<f32>, Array1<i64>, Array1<i64>, Array1<i64>)> {
|
) -> Result<(Array2<f32>, Array1<i64>, Array1<i64>, Array1<i64>)> {
|
||||||
crate::tts_util::parse_text_blocking(
|
crate::tts_util::parse_text_blocking(
|
||||||
text,
|
text,
|
||||||
|
None,
|
||||||
|
&self.jtalk,
|
||||||
|
&self.tokenizer,
|
||||||
|
|token_ids, attention_masks| {
|
||||||
|
crate::bert::predict(&mut self.bert, token_ids, attention_masks)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn parse_text_neo(
|
||||||
|
&mut self,
|
||||||
|
text: String,
|
||||||
|
given_tones: Option<Vec<i32>>,
|
||||||
|
) -> Result<(Array2<f32>, Array1<i64>, Array1<i64>, Array1<i64>)> {
|
||||||
|
crate::tts_util::parse_text_blocking(
|
||||||
|
&text,
|
||||||
|
given_tones,
|
||||||
&self.jtalk,
|
&self.jtalk,
|
||||||
&self.tokenizer,
|
&self.tokenizer,
|
||||||
|token_ids, attention_masks| {
|
|token_ids, attention_masks| {
|
||||||
@@ -347,6 +364,79 @@ impl TTSModelHolder {
|
|||||||
};
|
};
|
||||||
tts_util::array_to_vec(audio_array)
|
tts_util::array_to_vec(audio_array)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn easy_synthesize_neo<I: Into<TTSIdent> + Copy>(
|
||||||
|
&mut self,
|
||||||
|
ident: I,
|
||||||
|
text: &str,
|
||||||
|
given_tones: Option<Vec<i32>>,
|
||||||
|
style_id: i32,
|
||||||
|
speaker_id: i64,
|
||||||
|
options: SynthesizeOptions,
|
||||||
|
) -> Result<Vec<u8>> {
|
||||||
|
self.find_and_load_model(ident)?;
|
||||||
|
let style_vector = self.get_style_vector(ident, style_id, options.style_weight)?;
|
||||||
|
let audio_array = if options.split_sentences {
|
||||||
|
let texts: Vec<&str> = text.split('\n').collect();
|
||||||
|
let mut audios = vec![];
|
||||||
|
for (i, t) in texts.iter().enumerate() {
|
||||||
|
if t.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let (bert_ori, phones, tones, lang_ids) =
|
||||||
|
self.parse_text_neo(t.to_string(), given_tones.clone())?;
|
||||||
|
|
||||||
|
let vits2 = self
|
||||||
|
.find_model(ident)?
|
||||||
|
.vits2
|
||||||
|
.as_mut()
|
||||||
|
.ok_or(Error::ModelNotFoundError(ident.into().to_string()))?;
|
||||||
|
let audio = model::synthesize(
|
||||||
|
vits2,
|
||||||
|
bert_ori.to_owned(),
|
||||||
|
phones,
|
||||||
|
Array1::from_vec(vec![speaker_id]),
|
||||||
|
tones,
|
||||||
|
lang_ids,
|
||||||
|
style_vector.clone(),
|
||||||
|
options.sdp_ratio,
|
||||||
|
options.length_scale,
|
||||||
|
0.677,
|
||||||
|
0.8,
|
||||||
|
)?;
|
||||||
|
audios.push(audio.clone());
|
||||||
|
if i != texts.len() - 1 {
|
||||||
|
audios.push(Array3::zeros((1, 1, 22050)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
concatenate(
|
||||||
|
Axis(2),
|
||||||
|
&audios.iter().map(|x| x.view()).collect::<Vec<_>>(),
|
||||||
|
)?
|
||||||
|
} else {
|
||||||
|
let (bert_ori, phones, tones, lang_ids) = self.parse_text(text)?;
|
||||||
|
|
||||||
|
let vits2 = self
|
||||||
|
.find_model(ident)?
|
||||||
|
.vits2
|
||||||
|
.as_mut()
|
||||||
|
.ok_or(Error::ModelNotFoundError(ident.into().to_string()))?;
|
||||||
|
model::synthesize(
|
||||||
|
vits2,
|
||||||
|
bert_ori.to_owned(),
|
||||||
|
phones,
|
||||||
|
Array1::from_vec(vec![speaker_id]),
|
||||||
|
tones,
|
||||||
|
lang_ids,
|
||||||
|
style_vector,
|
||||||
|
options.sdp_ratio,
|
||||||
|
options.length_scale,
|
||||||
|
0.677,
|
||||||
|
0.8,
|
||||||
|
)?
|
||||||
|
};
|
||||||
|
tts_util::array_to_vec(audio_array)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Synthesize options
|
/// Synthesize options
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
|
||||||
use crate::error::Result;
|
use crate::error::Result;
|
||||||
|
use crate::jtalk::JTalkProcess;
|
||||||
|
use crate::mora::MORA_KATA_TO_MORA_PHONEMES;
|
||||||
|
use crate::norm::PUNCTUATIONS;
|
||||||
use crate::{jtalk, nlp, norm, tokenizer, utils};
|
use crate::{jtalk, nlp, norm, tokenizer, utils};
|
||||||
use hound::{SampleFormat, WavSpec, WavWriter};
|
use hound::{SampleFormat, WavSpec, WavWriter};
|
||||||
use ndarray::{concatenate, s, Array, Array1, Array2, Array3, Axis};
|
use ndarray::{concatenate, s, Array, Array1, Array2, Array3, Axis};
|
||||||
use tokenizers::Tokenizer;
|
use tokenizers::Tokenizer;
|
||||||
|
|
||||||
|
pub fn preprocess_parse_text(text: &str, jtalk: &jtalk::JTalk) -> Result<(String, JTalkProcess)> {
|
||||||
|
let text = jtalk.num2word(text)?;
|
||||||
|
let normalized_text = norm::normalize_text(&text);
|
||||||
|
|
||||||
|
let process = jtalk.process_text(&normalized_text)?;
|
||||||
|
Ok((normalized_text, process))
|
||||||
|
}
|
||||||
|
|
||||||
/// Parse text and return the input for synthesize
|
/// Parse text and return the input for synthesize
|
||||||
///
|
///
|
||||||
/// # Note
|
/// # Note
|
||||||
@@ -21,13 +33,9 @@ pub async fn parse_text(
|
|||||||
Box<dyn std::future::Future<Output = Result<ndarray::Array2<f32>>>>,
|
Box<dyn std::future::Future<Output = Result<ndarray::Array2<f32>>>>,
|
||||||
>,
|
>,
|
||||||
) -> Result<(Array2<f32>, Array1<i64>, Array1<i64>, Array1<i64>)> {
|
) -> Result<(Array2<f32>, Array1<i64>, Array1<i64>, Array1<i64>)> {
|
||||||
let text = jtalk.num2word(text)?;
|
let (normalized_text, process) = preprocess_parse_text(text, jtalk)?;
|
||||||
let normalized_text = norm::normalize_text(&text);
|
|
||||||
|
|
||||||
let process = jtalk.process_text(&normalized_text)?;
|
|
||||||
let (phones, tones, mut word2ph) = process.g2p()?;
|
let (phones, tones, mut word2ph) = process.g2p()?;
|
||||||
let (phones, tones, lang_ids) = nlp::cleaned_text_to_sequence(phones, tones);
|
let (phones, tones, lang_ids) = nlp::cleaned_text_to_sequence(phones, tones);
|
||||||
|
|
||||||
let phones = utils::intersperse(&phones, 0);
|
let phones = utils::intersperse(&phones, 0);
|
||||||
let tones = utils::intersperse(&tones, 0);
|
let tones = utils::intersperse(&tones, 0);
|
||||||
let lang_ids = utils::intersperse(&lang_ids, 0);
|
let lang_ids = utils::intersperse(&lang_ids, 0);
|
||||||
@@ -92,6 +100,7 @@ pub async fn parse_text(
|
|||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub fn parse_text_blocking(
|
pub fn parse_text_blocking(
|
||||||
text: &str,
|
text: &str,
|
||||||
|
given_tones: Option<Vec<i32>>,
|
||||||
jtalk: &jtalk::JTalk,
|
jtalk: &jtalk::JTalk,
|
||||||
tokenizer: &Tokenizer,
|
tokenizer: &Tokenizer,
|
||||||
bert_predict: impl FnOnce(Vec<i64>, Vec<i64>) -> Result<ndarray::Array2<f32>>,
|
bert_predict: impl FnOnce(Vec<i64>, Vec<i64>) -> Result<ndarray::Array2<f32>>,
|
||||||
@@ -100,7 +109,10 @@ pub fn parse_text_blocking(
|
|||||||
let normalized_text = norm::normalize_text(&text);
|
let normalized_text = norm::normalize_text(&text);
|
||||||
|
|
||||||
let process = jtalk.process_text(&normalized_text)?;
|
let process = jtalk.process_text(&normalized_text)?;
|
||||||
let (phones, tones, mut word2ph) = process.g2p()?;
|
let (phones, mut tones, mut word2ph) = process.g2p()?;
|
||||||
|
if let Some(given_tones) = given_tones {
|
||||||
|
tones = given_tones;
|
||||||
|
}
|
||||||
let (phones, tones, lang_ids) = nlp::cleaned_text_to_sequence(phones, tones);
|
let (phones, tones, lang_ids) = nlp::cleaned_text_to_sequence(phones, tones);
|
||||||
|
|
||||||
let phones = utils::intersperse(&phones, 0);
|
let phones = utils::intersperse(&phones, 0);
|
||||||
@@ -178,3 +190,23 @@ pub fn array_to_vec(audio_array: Array3<f32>) -> Result<Vec<u8>> {
|
|||||||
writer.finalize()?;
|
writer.finalize()?;
|
||||||
Ok(cursor.into_inner())
|
Ok(cursor.into_inner())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn kata_tone2phone_tone(kata_tone: Vec<(String, i32)>) -> Vec<(String, i32)> {
|
||||||
|
let mut results = vec![("_".to_string(), 0)];
|
||||||
|
for (mora, tone) in kata_tone {
|
||||||
|
if PUNCTUATIONS.contains(&mora.as_str()) {
|
||||||
|
results.push((mora, 0));
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
let (consonant, vowel) = MORA_KATA_TO_MORA_PHONEMES.get(&mora).unwrap();
|
||||||
|
if let Some(consonant) = consonant {
|
||||||
|
results.push((consonant.to_string(), tone));
|
||||||
|
results.push((vowel.to_string(), tone));
|
||||||
|
} else {
|
||||||
|
results.push((vowel.to_string(), tone));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
results.push(("_".to_string(), 0));
|
||||||
|
results
|
||||||
|
}
|
||||||
|
|||||||
19
crates/sbv2_editor/Cargo.toml
Normal file
19
crates/sbv2_editor/Cargo.toml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
[package]
|
||||||
|
name = "sbv2_editor"
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
description.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
documentation.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow.workspace = true
|
||||||
|
axum = "0.8.1"
|
||||||
|
dotenvy.workspace = true
|
||||||
|
env_logger.workspace = true
|
||||||
|
log = "0.4.27"
|
||||||
|
sbv2_core = { version = "0.2.0-alpha6", path = "../sbv2_core", features = ["aivmx"] }
|
||||||
|
serde = { version = "1.0.219", features = ["derive"] }
|
||||||
|
tokio = { version = "1.44.1", features = ["full"] }
|
||||||
2
crates/sbv2_editor/README.md
Normal file
2
crates/sbv2_editor/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# sbv2-voicevox
|
||||||
|
sbv2-apiをvoicevox化します。
|
||||||
226
crates/sbv2_editor/query2.json
Normal file
226
crates/sbv2_editor/query2.json
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
{
|
||||||
|
"accent_phrases": [
|
||||||
|
{
|
||||||
|
"moras": [
|
||||||
|
{
|
||||||
|
"text": "コ",
|
||||||
|
"consonant": "k",
|
||||||
|
"consonant_length": 0.10002632439136505,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.15740256011486053,
|
||||||
|
"pitch": 5.749961853027344
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "ン",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "N",
|
||||||
|
"vowel_length": 0.08265873789787292,
|
||||||
|
"pitch": 5.89122200012207
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "ニ",
|
||||||
|
"consonant": "n",
|
||||||
|
"consonant_length": 0.03657080978155136,
|
||||||
|
"vowel": "i",
|
||||||
|
"vowel_length": 0.1175866425037384,
|
||||||
|
"pitch": 5.969866752624512
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "チ",
|
||||||
|
"consonant": "ch",
|
||||||
|
"consonant_length": 0.09005842357873917,
|
||||||
|
"vowel": "i",
|
||||||
|
"vowel_length": 0.08666137605905533,
|
||||||
|
"pitch": 5.958892822265625
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "ワ",
|
||||||
|
"consonant": "w",
|
||||||
|
"consonant_length": 0.07833231985569,
|
||||||
|
"vowel": "a",
|
||||||
|
"vowel_length": 0.21250136196613312,
|
||||||
|
"pitch": 5.949411392211914
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"accent": 5,
|
||||||
|
"pause_mora": {
|
||||||
|
"text": "、",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "pau",
|
||||||
|
"vowel_length": 0.4723339378833771,
|
||||||
|
"pitch": 0.0
|
||||||
|
},
|
||||||
|
"is_interrogative": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"moras": [
|
||||||
|
{
|
||||||
|
"text": "オ",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.22004225850105286,
|
||||||
|
"pitch": 5.6870927810668945
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "ン",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "N",
|
||||||
|
"vowel_length": 0.09161105751991272,
|
||||||
|
"pitch": 5.93472957611084
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "セ",
|
||||||
|
"consonant": "s",
|
||||||
|
"consonant_length": 0.08924821764230728,
|
||||||
|
"vowel": "e",
|
||||||
|
"vowel_length": 0.14142127335071564,
|
||||||
|
"pitch": 6.121850490570068
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "エ",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "e",
|
||||||
|
"vowel_length": 0.10636933892965317,
|
||||||
|
"pitch": 6.157896041870117
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "ゴ",
|
||||||
|
"consonant": "g",
|
||||||
|
"consonant_length": 0.07600915431976318,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.09598273783922195,
|
||||||
|
"pitch": 6.188933849334717
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "オ",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.1079121008515358,
|
||||||
|
"pitch": 6.235202789306641
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "セ",
|
||||||
|
"consonant": "s",
|
||||||
|
"consonant_length": 0.09591838717460632,
|
||||||
|
"vowel": "e",
|
||||||
|
"vowel_length": 0.10286372154951096,
|
||||||
|
"pitch": 6.153214454650879
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "エ",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "e",
|
||||||
|
"vowel_length": 0.08992656320333481,
|
||||||
|
"pitch": 6.02571439743042
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "ノ",
|
||||||
|
"consonant": "n",
|
||||||
|
"consonant_length": 0.05660202354192734,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.09676017612218857,
|
||||||
|
"pitch": 5.711844444274902
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"accent": 5,
|
||||||
|
"pause_mora": null,
|
||||||
|
"is_interrogative": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"moras": [
|
||||||
|
{
|
||||||
|
"text": "セ",
|
||||||
|
"consonant": "s",
|
||||||
|
"consonant_length": 0.07805486768484116,
|
||||||
|
"vowel": "e",
|
||||||
|
"vowel_length": 0.09617523103952408,
|
||||||
|
"pitch": 5.774399280548096
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "カ",
|
||||||
|
"consonant": "k",
|
||||||
|
"consonant_length": 0.06712044775485992,
|
||||||
|
"vowel": "a",
|
||||||
|
"vowel_length": 0.148829385638237,
|
||||||
|
"pitch": 6.063965797424316
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "イ",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "i",
|
||||||
|
"vowel_length": 0.11061104387044907,
|
||||||
|
"pitch": 6.040698051452637
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "エ",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "e",
|
||||||
|
"vowel_length": 0.13046696782112122,
|
||||||
|
"pitch": 5.806027889251709
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"accent": 1,
|
||||||
|
"pause_mora": null,
|
||||||
|
"is_interrogative": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"moras": [
|
||||||
|
{
|
||||||
|
"text": "ヨ",
|
||||||
|
"consonant": "y",
|
||||||
|
"consonant_length": 0.07194744795560837,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.08622600883245468,
|
||||||
|
"pitch": 5.694094657897949
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "オ",
|
||||||
|
"consonant": null,
|
||||||
|
"consonant_length": null,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.10635452717542648,
|
||||||
|
"pitch": 5.787222385406494
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "コ",
|
||||||
|
"consonant": "k",
|
||||||
|
"consonant_length": 0.07077334076166153,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.09248624742031097,
|
||||||
|
"pitch": 5.793357849121094
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "ソ",
|
||||||
|
"consonant": "s",
|
||||||
|
"consonant_length": 0.08705667406320572,
|
||||||
|
"vowel": "o",
|
||||||
|
"vowel_length": 0.2238258570432663,
|
||||||
|
"pitch": 5.643765449523926
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"accent": 1,
|
||||||
|
"pause_mora": null,
|
||||||
|
"is_interrogative": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"speedScale": 1.0,
|
||||||
|
"pitchScale": 0.0,
|
||||||
|
"intonationScale": 1.0,
|
||||||
|
"volumeScale": 1.0,
|
||||||
|
"prePhonemeLength": 0.1,
|
||||||
|
"postPhonemeLength": 0.1,
|
||||||
|
"pauseLength": null,
|
||||||
|
"pauseLengthScale": 1.0,
|
||||||
|
"outputSamplingRate": 24000,
|
||||||
|
"outputStereo": false,
|
||||||
|
"kana": "コンニチワ'、オンセエゴ'オセエノ/セ'カイエ/ヨ'オコソ"
|
||||||
|
}
|
||||||
27
crates/sbv2_editor/src/error.rs
Normal file
27
crates/sbv2_editor/src/error.rs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
use axum::{
|
||||||
|
http::StatusCode,
|
||||||
|
response::{IntoResponse, Response},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub type AppResult<T> = std::result::Result<T, AppError>;
|
||||||
|
|
||||||
|
pub struct AppError(anyhow::Error);
|
||||||
|
|
||||||
|
impl IntoResponse for AppError {
|
||||||
|
fn into_response(self) -> Response {
|
||||||
|
(
|
||||||
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
format!("Something went wrong: {}", self.0),
|
||||||
|
)
|
||||||
|
.into_response()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<E> From<E> for AppError
|
||||||
|
where
|
||||||
|
E: Into<anyhow::Error>,
|
||||||
|
{
|
||||||
|
fn from(err: E) -> Self {
|
||||||
|
Self(err.into())
|
||||||
|
}
|
||||||
|
}
|
||||||
197
crates/sbv2_editor/src/main.rs
Normal file
197
crates/sbv2_editor/src/main.rs
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
use axum::extract::State;
|
||||||
|
use axum::{
|
||||||
|
extract::Query,
|
||||||
|
http::header::CONTENT_TYPE,
|
||||||
|
response::IntoResponse,
|
||||||
|
routing::{get, post},
|
||||||
|
Json, Router,
|
||||||
|
};
|
||||||
|
use sbv2_core::tts_util::kata_tone2phone_tone;
|
||||||
|
use sbv2_core::{
|
||||||
|
tts::{SynthesizeOptions, TTSModelHolder},
|
||||||
|
tts_util::preprocess_parse_text,
|
||||||
|
};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use tokio::{fs, net::TcpListener, sync::Mutex};
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use error::AppResult;
|
||||||
|
|
||||||
|
mod error;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct RequestCreateAudioQuery {
|
||||||
|
text: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
struct AudioQuery {
|
||||||
|
kana: String,
|
||||||
|
tone: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
struct ResponseCreateAudioQuery {
|
||||||
|
audio_query: Vec<AudioQuery>,
|
||||||
|
text: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn create_audio_query(
|
||||||
|
State(state): State<AppState>,
|
||||||
|
Query(request): Query<RequestCreateAudioQuery>,
|
||||||
|
) -> AppResult<impl IntoResponse> {
|
||||||
|
let (text, process) = {
|
||||||
|
let tts_model = state.tts_model.lock().await;
|
||||||
|
preprocess_parse_text(&request.text, &tts_model.jtalk)?
|
||||||
|
};
|
||||||
|
let kana_tone_list = process.g2kana_tone()?;
|
||||||
|
let audio_query = kana_tone_list
|
||||||
|
.iter()
|
||||||
|
.map(|(kana, tone)| AudioQuery {
|
||||||
|
kana: kana.clone(),
|
||||||
|
tone: *tone,
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
Ok(Json(ResponseCreateAudioQuery { audio_query, text }))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct RequestSynthesis {
|
||||||
|
text: String,
|
||||||
|
speaker_id: i64,
|
||||||
|
sdp_ratio: f32,
|
||||||
|
length_scale: f32,
|
||||||
|
style_id: i32,
|
||||||
|
audio_query: Vec<AudioQuery>,
|
||||||
|
ident: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn synthesis(
|
||||||
|
State(state): State<AppState>,
|
||||||
|
Json(request): Json<RequestSynthesis>,
|
||||||
|
) -> AppResult<impl IntoResponse> {
|
||||||
|
let phone_tone = request
|
||||||
|
.audio_query
|
||||||
|
.iter()
|
||||||
|
.map(|query| (query.kana.clone(), query.tone))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
let phone_tone = kata_tone2phone_tone(phone_tone);
|
||||||
|
let tones = phone_tone.iter().map(|(_, tone)| *tone).collect::<Vec<_>>();
|
||||||
|
let buffer = {
|
||||||
|
let mut tts_model = state.tts_model.lock().await;
|
||||||
|
tts_model.easy_synthesize_neo(
|
||||||
|
&request.ident,
|
||||||
|
&request.text,
|
||||||
|
Some(tones),
|
||||||
|
request.style_id,
|
||||||
|
request.speaker_id,
|
||||||
|
SynthesizeOptions {
|
||||||
|
sdp_ratio: request.sdp_ratio,
|
||||||
|
length_scale: request.length_scale,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
)?
|
||||||
|
};
|
||||||
|
Ok(([(CONTENT_TYPE, "audio/wav")], buffer))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct AppState {
|
||||||
|
tts_model: Arc<Mutex<TTSModelHolder>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AppState {
|
||||||
|
pub async fn new() -> anyhow::Result<Self> {
|
||||||
|
let mut tts_model = TTSModelHolder::new(
|
||||||
|
&fs::read(env::var("BERT_MODEL_PATH")?).await?,
|
||||||
|
&fs::read(env::var("TOKENIZER_PATH")?).await?,
|
||||||
|
env::var("HOLDER_MAX_LOADED_MODElS")
|
||||||
|
.ok()
|
||||||
|
.and_then(|x| x.parse().ok()),
|
||||||
|
)?;
|
||||||
|
let models = env::var("MODELS_PATH").unwrap_or("models".to_string());
|
||||||
|
let mut f = fs::read_dir(&models).await?;
|
||||||
|
let mut entries = vec![];
|
||||||
|
while let Ok(Some(e)) = f.next_entry().await {
|
||||||
|
let name = e.file_name().to_string_lossy().to_string();
|
||||||
|
if name.ends_with(".onnx") && name.starts_with("model_") {
|
||||||
|
let name_len = name.len();
|
||||||
|
let name = name.chars();
|
||||||
|
entries.push(
|
||||||
|
name.collect::<Vec<_>>()[6..name_len - 5]
|
||||||
|
.iter()
|
||||||
|
.collect::<String>(),
|
||||||
|
);
|
||||||
|
} else if name.ends_with(".sbv2") {
|
||||||
|
let entry = &name[..name.len() - 5];
|
||||||
|
log::info!("Try loading: {entry}");
|
||||||
|
let sbv2_bytes = match fs::read(format!("{models}/{entry}.sbv2")).await {
|
||||||
|
Ok(b) => b,
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!("Error loading sbv2_bytes from file {entry}: {e}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if let Err(e) = tts_model.load_sbv2file(entry, sbv2_bytes) {
|
||||||
|
log::warn!("Error loading {entry}: {e}");
|
||||||
|
};
|
||||||
|
log::info!("Loaded: {entry}");
|
||||||
|
} else if name.ends_with(".aivmx") {
|
||||||
|
let entry = &name[..name.len() - 6];
|
||||||
|
log::info!("Try loading: {entry}");
|
||||||
|
let aivmx_bytes = match fs::read(format!("{models}/{entry}.aivmx")).await {
|
||||||
|
Ok(b) => b,
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!("Error loading aivmx bytes from file {entry}: {e}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if let Err(e) = tts_model.load_aivmx(entry, aivmx_bytes) {
|
||||||
|
log::error!("Error loading {entry}: {e}");
|
||||||
|
}
|
||||||
|
log::info!("Loaded: {entry}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for entry in entries {
|
||||||
|
log::info!("Try loading: {entry}");
|
||||||
|
let style_vectors_bytes =
|
||||||
|
match fs::read(format!("{models}/style_vectors_{entry}.json")).await {
|
||||||
|
Ok(b) => b,
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!("Error loading style_vectors_bytes from file {entry}: {e}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let vits2_bytes = match fs::read(format!("{models}/model_{entry}.onnx")).await {
|
||||||
|
Ok(b) => b,
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!("Error loading vits2_bytes from file {entry}: {e}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if let Err(e) = tts_model.load(&entry, style_vectors_bytes, vits2_bytes) {
|
||||||
|
log::warn!("Error loading {entry}: {e}");
|
||||||
|
};
|
||||||
|
log::info!("Loaded: {entry}");
|
||||||
|
}
|
||||||
|
Ok(Self {
|
||||||
|
tts_model: Arc::new(Mutex::new(tts_model)),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> anyhow::Result<()> {
|
||||||
|
dotenvy::dotenv_override().ok();
|
||||||
|
env_logger::init();
|
||||||
|
let app = Router::new()
|
||||||
|
.route("/", get(|| async { "Hello, world!" }))
|
||||||
|
.route("/audio_query", get(create_audio_query))
|
||||||
|
.route("/synthesis", post(synthesis))
|
||||||
|
.with_state(AppState::new().await?);
|
||||||
|
let listener = TcpListener::bind("0.0.0.0:8080").await?;
|
||||||
|
axum::serve(listener, app).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
8
crates/sbv2_wasm/pnpm-lock.yaml
generated
8
crates/sbv2_wasm/pnpm-lock.yaml
generated
@@ -23,7 +23,7 @@ importers:
|
|||||||
version: 0.25.0
|
version: 0.25.0
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.7.3
|
specifier: ^5.7.3
|
||||||
version: 5.7.3
|
version: 5.8.3
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
@@ -290,8 +290,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==}
|
resolution: {integrity: sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==}
|
||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
|
|
||||||
typescript@5.7.3:
|
typescript@5.8.3:
|
||||||
resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==}
|
resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==}
|
||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -499,6 +499,6 @@ snapshots:
|
|||||||
'@types/node': 22.13.5
|
'@types/node': 22.13.5
|
||||||
long: 5.3.1
|
long: 5.3.1
|
||||||
|
|
||||||
typescript@5.7.3: {}
|
typescript@5.8.3: {}
|
||||||
|
|
||||||
undici-types@6.20.0: {}
|
undici-types@6.20.0: {}
|
||||||
|
|||||||
19
test.py
Normal file
19
test.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
data = (requests.get("http://localhost:8080/audio_query", params={
|
||||||
|
"text": "こんにちは、今日はいい天気ですね。",
|
||||||
|
})).json()
|
||||||
|
print(data)
|
||||||
|
|
||||||
|
data = (requests.post("http://localhost:8080/synthesis", json={
|
||||||
|
"text": data["text"],
|
||||||
|
"ident": "tsukuyomi",
|
||||||
|
"speaker_id": 0,
|
||||||
|
"style_id": 0,
|
||||||
|
"sdp_ratio": 0.5,
|
||||||
|
"length_scale": 0.5,
|
||||||
|
"audio_query": data["audio_query"],
|
||||||
|
})).content
|
||||||
|
with open("test.wav", "wb") as f:
|
||||||
|
f.write(data)
|
||||||
Reference in New Issue
Block a user