Skip to main content

replace_speaker_vector

Function replace_speaker_vector 

Source
pub fn replace_speaker_vector(
    path: &Path,
    vector: &[f32],
) -> Result<PathBuf, FttsError>
Expand description

Replaces an existing enrolled voice, keeping the displaced one alongside it.

Enrollment is cheap to redo but a voice is not always cheap to re-record, and the reference a .spk came from may be long gone. The previous vector is copied to <path>.bak before the new one lands, so a mistaken overwrite is one mv away from undone rather than unrecoverable.

ยงErrors

When the vector is malformed, the backup cannot be written, or the file cannot be replaced.