Skip to content

Commit

Permalink
Merge pull request #108 from o108minmin/107-add-cevioai
Browse files Browse the repository at this point in the history
add cevioai
  • Loading branch information
o108minmin authored Apr 24, 2023
2 parents 6cea8af + 12055ef commit 421cb67
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/tips/cevioai_tips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# halberd with CeVIO AI

halberdをCeVIO AIで利用するための設定やtipsです

## テキスト書き出し設定

音声書き出し

- ファイル -> エクスポート -> セリフ連続WAVの書き出し
- セリフをテキスト出力:有効
2 changes: 1 addition & 1 deletion halberd_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
15 changes: 15 additions & 0 deletions halberd_cli/tests/cevioai_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::boxed::Box;

use assert_cmd::Command;
use predicates::prelude::*;

#[test]
// 入力値が正常だったとき(srtで出力)
fn normal_cevioai() -> Result<(), Box<dyn std::error::Error>> {
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(())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
こんにちは
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
このダミーにはなんでも書いてあるの
Binary file not shown.
21 changes: 21 additions & 0 deletions halberd_core/src/tts/cevioai.rs
Original file line number Diff line number Diff line change
@@ -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<String, Box<dyn Error>> {
text::generate_subtitle_from_txt(path)
}
fn wave_time_generator(&self, path: PathBuf) -> Result<f64, Box<dyn Error>> {
wav::calculate_wave_seconds(path)
}
fn get_profile_name(&self) -> &'static str {
"cevioai"
}
}
1 change: 1 addition & 0 deletions halberd_core/src/tts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod aivoice;
pub mod cevioai;
pub mod coefont;
pub mod profile;
pub mod service;
Expand Down
2 changes: 2 additions & 0 deletions halberd_core/src/tts/service.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -20,6 +21,7 @@ pub fn select_tts_talk(profile_name: &str) -> Result<Box<dyn profile::TTS>, &'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"),
}
}
Expand Down
1 change: 1 addition & 0 deletions halberd_gui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function App() {
<MenuItem value={"softalk"}>SofTalk(utf-16le)</MenuItem>
<MenuItem value={"talque"}>TALQu(Shift_JIS)</MenuItem>
<MenuItem value={"voicepeak"}>VOICEPEAK(utf-8)</MenuItem>
<MenuItem value={"cevioai"}>CeVIO AI(utf-8)</MenuItem>
</Select>
</FormControl>
</Grid>
Expand Down

0 comments on commit 421cb67

Please sign in to comment.