diff --git a/docs/tips/cevioai_tips.md b/docs/tips/cevioai_tips.md new file mode 100644 index 0000000..240657b --- /dev/null +++ b/docs/tips/cevioai_tips.md @@ -0,0 +1,10 @@ +# halberd with {TTSの名前} + +halberdを{TTSの名前}で利用するための設定やtipsです + +## テキスト書き出し設定 + +音声書き出し + +- ファイル -> エクスポート -> セリフ連続WAVの書き出し +- セリフをテキスト出力:有効 diff --git a/halberd_cli/src/main.rs b/halberd_cli/src/main.rs index eab69f8..40e33f4 100644 --- a/halberd_cli/src/main.rs +++ b/halberd_cli/src/main.rs @@ -22,7 +22,7 @@ fn main() { Arg::new("TTS") .help("set TTS") .required(true) - .value_parser(["voiceroid", "coefont", "voicevox", "softalk", "talqu", "voicepeak", "aivoice"]) + .value_parser(["voiceroid", "coefont", "voicevox", "softalk", "talqu", "voicepeak", "aivoice", "cevioai"]) .index(1), ) .arg( diff --git a/halberd_cli/tests/cevioai_test.rs b/halberd_cli/tests/cevioai_test.rs new file mode 100644 index 0000000..82c94b9 --- /dev/null +++ b/halberd_cli/tests/cevioai_test.rs @@ -0,0 +1,15 @@ +use std::boxed::Box; + +use assert_cmd::Command; +use predicates::prelude::*; + +#[test] +// 入力値が正常だったとき(srtで出力) +fn normal_cevioai() -> Result<(), Box> { + let expected = "1\n00:00:00,000 --> 00:00:01,445\nこんにちは\n\n2\n00:00:01,446 --> 00:00:04,521\nこのダミーにはなんでも書いてあるの\n\n"; + + let mut cmd = Command::cargo_bin("halberdcli").unwrap(); + let assert = cmd.arg("cevioai").arg("tests/data/tts/cevioai").assert(); + assert.success().stdout(predicate::str::contains(expected)); + Ok(()) +} diff --git "a/halberd_cli/tests/data/tts/cevioai/00_\343\201\240\343\201\277\343\203\274_\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.txt" "b/halberd_cli/tests/data/tts/cevioai/00_\343\201\240\343\201\277\343\203\274_\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.txt" new file mode 100644 index 0000000..4fad5e7 --- /dev/null +++ "b/halberd_cli/tests/data/tts/cevioai/00_\343\201\240\343\201\277\343\203\274_\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.txt" @@ -0,0 +1 @@ +こんにちは \ No newline at end of file diff --git "a/halberd_cli/tests/data/tts/cevioai/00_\343\201\240\343\201\277\343\203\274_\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.wav" "b/halberd_cli/tests/data/tts/cevioai/00_\343\201\240\343\201\277\343\203\274_\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.wav" new file mode 100644 index 0000000..b5255bb Binary files /dev/null and "b/halberd_cli/tests/data/tts/cevioai/00_\343\201\240\343\201\277\343\203\274_\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.wav" differ diff --git "a/halberd_cli/tests/data/tts/cevioai/01_\343\201\240\343\201\277\343\203\274_\343\201\223\343\201\256\343\203\200\343\203\237\343\203\274\343\201\253\343\201\257\343\201\252\343\202\223\343\201\247\342\200\246.txt" "b/halberd_cli/tests/data/tts/cevioai/01_\343\201\240\343\201\277\343\203\274_\343\201\223\343\201\256\343\203\200\343\203\237\343\203\274\343\201\253\343\201\257\343\201\252\343\202\223\343\201\247\342\200\246.txt" new file mode 100644 index 0000000..5e43fbd --- /dev/null +++ "b/halberd_cli/tests/data/tts/cevioai/01_\343\201\240\343\201\277\343\203\274_\343\201\223\343\201\256\343\203\200\343\203\237\343\203\274\343\201\253\343\201\257\343\201\252\343\202\223\343\201\247\342\200\246.txt" @@ -0,0 +1 @@ +このダミーにはなんでも書いてあるの \ No newline at end of file diff --git "a/halberd_cli/tests/data/tts/cevioai/01_\343\201\240\343\201\277\343\203\274_\343\201\223\343\201\256\343\203\200\343\203\237\343\203\274\343\201\253\343\201\257\343\201\252\343\202\223\343\201\247\342\200\246.wav" "b/halberd_cli/tests/data/tts/cevioai/01_\343\201\240\343\201\277\343\203\274_\343\201\223\343\201\256\343\203\200\343\203\237\343\203\274\343\201\253\343\201\257\343\201\252\343\202\223\343\201\247\342\200\246.wav" new file mode 100644 index 0000000..774b6cb Binary files /dev/null and "b/halberd_cli/tests/data/tts/cevioai/01_\343\201\240\343\201\277\343\203\274_\343\201\223\343\201\256\343\203\200\343\203\237\343\203\274\343\201\253\343\201\257\343\201\252\343\202\223\343\201\247\342\200\246.wav" differ diff --git a/halberd_core/src/tts/cevioai.rs b/halberd_core/src/tts/cevioai.rs new file mode 100644 index 0000000..fefab3e --- /dev/null +++ b/halberd_core/src/tts/cevioai.rs @@ -0,0 +1,21 @@ +//! CeVIO AI関係のモジュール +use std::error::Error; +use std::path::PathBuf; + +use crate::text; +use crate::tts; +use crate::wav; + +pub struct Cevioai {} + +impl tts::profile::TTS for Cevioai { + fn serif_generator(&self, path: PathBuf) -> Result> { + text::generate_subtitle_from_txt(path) + } + fn wave_time_generator(&self, path: PathBuf) -> Result> { + wav::calculate_wave_seconds(path) + } + fn get_profile_name(&self) -> &'static str { + "cevioai" + } +} diff --git a/halberd_core/src/tts/mod.rs b/halberd_core/src/tts/mod.rs index 470bfdf..a4d802d 100644 --- a/halberd_core/src/tts/mod.rs +++ b/halberd_core/src/tts/mod.rs @@ -1,4 +1,5 @@ pub mod aivoice; +pub mod cevioai; pub mod coefont; pub mod profile; pub mod service; diff --git a/halberd_core/src/tts/service.rs b/halberd_core/src/tts/service.rs index 1de73d6..741498c 100644 --- a/halberd_core/src/tts/service.rs +++ b/halberd_core/src/tts/service.rs @@ -1,5 +1,6 @@ //! TTS関係の雑多な関数 use crate::tts::aivoice::Aivoice; +use crate::tts::cevioai::Cevioai; use crate::tts::coefont::CoeFont; use crate::tts::profile; use crate::tts::softalk::Softalk; @@ -20,6 +21,7 @@ pub fn select_tts_talk(profile_name: &str) -> Result, &'st "talqu" => Ok(Box::new(Talqu {})), "voicepeak" => Ok(Box::new(Voicepeak {})), "aivoice" => Ok(Box::new(Aivoice {})), + "cevioai" => Ok(Box::new(Cevioai {})), _ => Err("Didn't match profile name"), } } diff --git a/halberd_gui/src/App.tsx b/halberd_gui/src/App.tsx index ed65d4f..f055b79 100644 --- a/halberd_gui/src/App.tsx +++ b/halberd_gui/src/App.tsx @@ -147,6 +147,7 @@ function App() { SofTalk(utf-16le) TALQu(Shift_JIS) VOICEPEAK(utf-8) + CeVIO AI(utf-8)