From a735d3e972fae8b3cd6bcb88c90bdc7cec65a862 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 15 Feb 2023 01:24:16 -0500 Subject: [PATCH] sequence length --- .../by_table/tts_render_tasks/insert_tts_render_task.rs | 7 +++++++ .../news_story_audio_preprocessing/process_single_item.rs | 3 +++ 2 files changed, 10 insertions(+) diff --git a/crates/lib/sqlite_queries/src/queries/by_table/tts_render_tasks/insert_tts_render_task.rs b/crates/lib/sqlite_queries/src/queries/by_table/tts_render_tasks/insert_tts_render_task.rs index 4e36f826a4..34731d763a 100644 --- a/crates/lib/sqlite_queries/src/queries/by_table/tts_render_tasks/insert_tts_render_task.rs +++ b/crates/lib/sqlite_queries/src/queries/by_table/tts_render_tasks/insert_tts_render_task.rs @@ -8,8 +8,12 @@ pub struct Args <'a> { // TODO: This will be multiple types in the future pub news_story_token: &'a NewsStoryToken, + // 1-indexed offset of the audio file within the total speech pub sequence_order: i64, + // Total number of wav file items in the speech + pub sequence_length: i64, + pub tts_voice_identifier: &'a TtsModelToken, pub full_text: &'a str, @@ -30,6 +34,7 @@ INSERT INTO tts_render_tasks( story_type, story_token, sequence_order, + sequence_length, tts_service, tts_voice_identifier, full_text @@ -39,6 +44,7 @@ VALUES ( "news_story", ?, ?, + ?, "fakeyou", ?, ? @@ -47,6 +53,7 @@ VALUES ( tts_render_task_token, news_story_token, args.sequence_order, + args.sequence_length, tts_voice_identifier, args.full_text ); diff --git a/crates/programs/aichatbot-sidecar/src/workers/news_stories/news_story_audio_preprocessing/process_single_item.rs b/crates/programs/aichatbot-sidecar/src/workers/news_stories/news_story_audio_preprocessing/process_single_item.rs index 2283de8287..41b33dc924 100644 --- a/crates/programs/aichatbot-sidecar/src/workers/news_stories/news_story_audio_preprocessing/process_single_item.rs +++ b/crates/programs/aichatbot-sidecar/src/workers/news_stories/news_story_audio_preprocessing/process_single_item.rs @@ -49,12 +49,15 @@ pub async fn process_single_item(target: &NewsStoryProductionItem, job_state: &A // NB: John Madden voice model let tts_model_token = TtsModelToken::new_from_str("TM:30ha2t6bxfn4"); + let sequence_length = paragraphs.len() as i64; + for (i, paragraph) in paragraphs.iter().enumerate() { let sequence_order = (i + 1) as i64; insert_tts_render_task(InsertArgs { news_story_token: &target.news_story_token, sequence_order, + sequence_length, tts_voice_identifier: &tts_model_token, full_text: ¶graph, sqlite_pool: &job_state.sqlite_pool,