blob: 1d87106f0d3194cf04c1565f74c433f6113bdf78 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
use std::path::Path;
use crate::tts::{save_wav, ChatterboxTTS};
mod audio;
mod listen;
pub mod tts;
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Loading ChatterboxTTS...");
let tts = ChatterboxTTS::from_pretrained(None)?;
println!("Model loaded successfully!");
// Load reference audio from mp3
println!("Loading reference audio...");
let reference = audio::to_16k_mono_from_path(Path::new("audio.mp3"))?;
let samples = &reference.samples;
let sample_rate = reference.sample_rate;
// Voice cloning using audio samples
println!("Generating TTS with voice cloning...");
let audio = tts.generate_tts_with_samples(
"Hello, this is a test of the voice cloning system [chuckles]. Repeat after me \" I am Steve Jobs!\"",
samples,
sample_rate,
)?;
println!("Generated {} samples", audio.len());
save_wav(&audio, Path::new("output.wav"))?;
println!("Saved to output.wav");
let segments = listen::listen()?;
println!("Captured {} diarized segments", segments.len());
Ok(())
}
|