Add TTS voice builder (/tts): Piper + espeak, layers, effects
- src/tts.js: synth(config, text) -> cached mp3 in public/tts; up to 3 layers (engine, voice, speaker, speed, pitch, volume, delay) mixed with ffmpeg, 8 effects (stadium, echo, 8-bit, radio, robot, choir, warp, shaky), loudnorm; config is clamped and voice/speaker names are restricted to plain names - tools/tts/worker.py: long-running Python worker (JSON lines), Piper models kept loaded (LRU of 4), espeak-ng via libespeak-ng + ctypes - tools/tts/setup.sh: venv + piper-tts + default voice set - /tts page: presets, layers, effects, test playback, save/load/delete named voices (tts_voices table); TTS link in the nav - public/tts, tools/tts/venv and tools/tts/voices are gitignored Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
463c6580f4
commit
b5a81bdb15
10 changed files with 780 additions and 0 deletions
33
src/db.js
33
src/db.js
|
|
@ -86,6 +86,14 @@ function createSchema() {
|
|||
|
||||
-- Channel point rewards / built-in rewards / bits Power-ups: each trigger has variations,
|
||||
-- one is picked at random weighted by rarity (like Twitch alert variations).
|
||||
-- TTS voices built on the /tts page: config is JSON (layers + effects, see src/tts.js normalize()).
|
||||
CREATE TABLE IF NOT EXISTS tts_voices (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
config TEXT NOT NULL,
|
||||
created_at TEXT DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS reward_variations (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
kind TEXT NOT NULL, -- reward | auto_reward | power_up
|
||||
|
|
@ -268,6 +276,30 @@ function deleteVariation(id) {
|
|||
db.prepare('DELETE FROM reward_variations WHERE id = ?').run(id);
|
||||
}
|
||||
|
||||
// TTS voices (config is stored as JSON text, returned parsed)
|
||||
const ttsRow = r => r && { ...r, config: JSON.parse(r.config) };
|
||||
|
||||
function getAllTtsVoices() {
|
||||
return db.prepare('SELECT * FROM tts_voices ORDER BY name COLLATE NOCASE, id').all().map(ttsRow);
|
||||
}
|
||||
|
||||
function getTtsVoice(id) {
|
||||
return ttsRow(db.prepare('SELECT * FROM tts_voices WHERE id = ?').get(id));
|
||||
}
|
||||
|
||||
function createTtsVoice(name, config) {
|
||||
const r = db.prepare('INSERT INTO tts_voices (name, config) VALUES (?, ?)').run(name, JSON.stringify(config));
|
||||
return getTtsVoice(r.lastInsertRowid);
|
||||
}
|
||||
|
||||
function updateTtsVoice(id, name, config) {
|
||||
db.prepare('UPDATE tts_voices SET name = ?, config = ? WHERE id = ?').run(name, JSON.stringify(config), id);
|
||||
}
|
||||
|
||||
function deleteTtsVoice(id) {
|
||||
db.prepare('DELETE FROM tts_voices WHERE id = ?').run(id);
|
||||
}
|
||||
|
||||
// Activity log
|
||||
function logActivity(eventType, eventDetail, username, data, actionsFired) {
|
||||
db.prepare(`
|
||||
|
|
@ -293,5 +325,6 @@ module.exports = {
|
|||
getAllMedia, getMediaFile, createMedia, deleteMedia,
|
||||
getAllActions, getAction, createAction, toggleAction, deleteAction, getMatchingActions,
|
||||
getAllVariations, getVariationsFor, getVariation, createVariation, updateVariation, renameTrigger, deleteVariation,
|
||||
getAllTtsVoices, getTtsVoice, createTtsVoice, updateTtsVoice, deleteTtsVoice,
|
||||
logActivity, getActivityLog,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue