Limit voice selection to avoid awkward assignments
This commit is contained in:
@@ -18,12 +18,14 @@ speaker mappings, generated audio, and TTS endpoint stay on your computer.
|
|||||||
- Watches an EverQuest log without replaying historical lines on startup.
|
- Watches an EverQuest log without replaying historical lines on startup.
|
||||||
- Speaks `Name says, '…'` NPC dialogue by default.
|
- Speaks `Name says, '…'` NPC dialogue by default.
|
||||||
- Calls `GET /health`, shows live Kokoro connectivity in the status bar, and
|
- Calls `GET /health`, shows live Kokoro connectivity in the status bar, and
|
||||||
refreshes its selectable voice catalog from `GET /v1/audio/voices`.
|
refreshes its selectable voice catalog from `GET /v1/audio/voices`. NPC
|
||||||
|
selection is limited to Mudmouth's curated 27-voice English pool.
|
||||||
- Sends non-streaming WAV requests to `POST /v1/audio/speech` and plays clips
|
- Sends non-streaming WAV requests to `POST /v1/audio/speech` and plays clips
|
||||||
sequentially with native audio support.
|
sequentially with native audio support.
|
||||||
- Repeats an NPC's identical line at 1.5x speed, then 2x speed when each repeat
|
- Repeats an NPC's identical line at 1.5x speed, then 2x speed when each repeat
|
||||||
arrives within 15 seconds; a later line returns to normal speed.
|
arrives within 15 seconds; a later line returns to normal speed.
|
||||||
- Picks a real voice from your Kokoro server for a newly seen NPC and saves it.
|
- Picks a curated voice available on your Kokoro server for a newly seen NPC
|
||||||
|
and saves it.
|
||||||
- Lets you pin an NPC to a particular voice, reroll a persistent random voice,
|
- Lets you pin an NPC to a particular voice, reroll a persistent random voice,
|
||||||
or set the NPC to get a new random voice for every line.
|
or set the NPC to get a new random voice for every line.
|
||||||
- Can optionally narrate zone entries (`You have entered Lake Rathetear.`).
|
- Can optionally narrate zone entries (`You have entered Lake Rathetear.`).
|
||||||
|
|||||||
+36
-1
@@ -3,6 +3,40 @@ use reqwest::Url;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
/// Curated English Kokoro voices used for NPC selection and the voice manager.
|
||||||
|
///
|
||||||
|
/// Keeping this allowlist here means a server update cannot unexpectedly add
|
||||||
|
/// voices to Mudmouth's random assignment pool.
|
||||||
|
const NPC_VOICE_ALLOWLIST: &[&str] = &[
|
||||||
|
"af_heart",
|
||||||
|
"af_bella",
|
||||||
|
"af_nicole",
|
||||||
|
"af_alloy",
|
||||||
|
"af_aoede",
|
||||||
|
"af_kore",
|
||||||
|
"af_nova",
|
||||||
|
"af_sarah",
|
||||||
|
"af_river",
|
||||||
|
"af_jessica",
|
||||||
|
"af_sky",
|
||||||
|
"am_michael",
|
||||||
|
"am_fenrir",
|
||||||
|
"am_eric",
|
||||||
|
"am_echo",
|
||||||
|
"am_liam",
|
||||||
|
"am_onyx",
|
||||||
|
"am_adam",
|
||||||
|
"am_puck",
|
||||||
|
"bf_alice",
|
||||||
|
"bf_emma",
|
||||||
|
"bf_isabella",
|
||||||
|
"bf_lily",
|
||||||
|
"bm_daniel",
|
||||||
|
"bm_fable",
|
||||||
|
"bm_george",
|
||||||
|
"bm_lewis",
|
||||||
|
];
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct KokoroClient {
|
pub struct KokoroClient {
|
||||||
client: reqwest::Client,
|
client: reqwest::Client,
|
||||||
@@ -80,6 +114,7 @@ impl KokoroClient {
|
|||||||
.into_voices()
|
.into_voices()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|voice| voice.id)
|
.map(|voice| voice.id)
|
||||||
|
.filter(|voice| NPC_VOICE_ALLOWLIST.contains(&voice.as_str()))
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +171,7 @@ mod tests {
|
|||||||
let url = serve_once(
|
let url = serve_once(
|
||||||
"200 OK",
|
"200 OK",
|
||||||
"application/json",
|
"application/json",
|
||||||
br#"[{"id":"af_heart","name":"Heart"},{"id":"am_adam","name":"Adam"}]"#,
|
br#"[{"id":"af_heart","name":"Heart"},{"id":"am_adam","name":"Adam"},{"id":"af_onyx","name":"Onyx"}]"#,
|
||||||
);
|
);
|
||||||
let voices = KokoroClient::new(&url).unwrap().voices().await.unwrap();
|
let voices = KokoroClient::new(&url).unwrap().voices().await.unwrap();
|
||||||
assert_eq!(voices, vec!["af_heart", "am_adam"]);
|
assert_eq!(voices, vec!["af_heart", "am_adam"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user