# caggazzotti/long-form-speech-anonymization architecture

> Architecture diagram of the GitHub repository caggazzotti/long-form-speech-anonymization, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/caggazzotti/long-form-speech-anonymization
- Repository: https://github.com/caggazzotti/long-form-speech-anonymization

## Overview

This research pipeline evaluates privacy protection against identifying speakers from long-form speech style. Its main workflow prepares utterance audio, transcribes it, paraphrases content, builds matched trials, and embeds and evaluates them; a parallel voice-anonymization workflow creates XTTS profiles and anonymized speech. README statements establish the high-level workflow; sampled source confirms several component behaviors. Unexcerpted modules are represented only where documented, so some internal links are intentionally omitted.

Main entry points: [`scripts/content_anonymization/embed_trials_sluar.py`](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/embed_trials_sluar.py) (SLUAR embedding), [`scripts/content_anonymization/build_trials_from_utterances.py`](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/build_trials_from_utterances.py) (Trial construction), [`scripts/voice_anonymization/create_xtts_base_profiles.py`](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/create_xtts_base_profiles.py) (XTTS base profiles), [`scripts/voice_anonymization/create_xtts_pseudo_profile.py`](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/create_xtts_pseudo_profile.py) (Pseudo-speaker profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Audio preparation"]
  node_prepare_audio["Segment audio"]
  node_utterance_wavs[("Utterance WAVs")]
end

subgraph group_voice["Voice anonymization"]
  node_base_profiles[("XTTS base profiles")]
  node_profile_builder["Pseudo-profile builder"]
  node_pseudo_profile[("Pseudo-speaker profile")]
  node_voice_anonymizer["Batch voice anonymizer"]
  node_voice_audio[("Voice-anonymized audio")]
end

subgraph group_content["Content anonymization"]
  node_whisper["Whisper transcription"]
  node_asr_text["ASR utterances"]
  node_prompt_generation["Paraphrase prompts"]
  node_response_conversion["Response conversion"]
  node_paraphrased_text["Anonymized text"]
end

subgraph group_eval["Trials and evaluation"]
  node_trial_builder["Trial construction"]
  node_matched_trials["Matched trials<br/>[match_trials.py]"]
  node_trial_files[("Trial files")]
  node_embedder["SLUAR embedding"]
  node_similarity["Aligned similarity"]
  node_ldc_evaluation["LDC evaluation"]
  node_matched_evaluation["Matched evaluation"]
end

node_fisher[("Fisher data")]
node_llm(("Paraphrase model"))
node_xtts(("XTTS synthesis"))

node_fisher -->|"provides audio"| node_prepare_audio
node_prepare_audio -->|"writes segments"| node_utterance_wavs
node_utterance_wavs -->|"transcribes"| node_whisper
node_whisper -->|"writes transcripts"| node_asr_text
node_asr_text -->|"generates prompts"| node_prompt_generation
node_prompt_generation -.->|"submits prompts"| node_llm
node_llm -.->|"returns responses"| node_response_conversion
node_response_conversion -->|"writes utterances"| node_paraphrased_text
node_asr_text -->|"builds trials"| node_trial_builder
node_paraphrased_text -->|"builds trials"| node_trial_builder
node_trial_builder -->|"writes trials"| node_trial_files
node_asr_text -->|"pairs utterances"| node_matched_trials
node_paraphrased_text -->|"pairs utterances"| node_matched_trials
node_matched_trials -->|"writes matched trials"| node_trial_files
node_trial_files -->|"embeds trials"| node_embedder
node_embedder -.->|"compares embeddings"| node_similarity
node_embedder -->|"evaluates baseline"| node_ldc_evaluation
node_embedder -.->|"evaluates matched trials"| node_matched_evaluation
node_fisher -.->|"reference audio"| node_base_profiles
node_base_profiles -->|"builds profiles"| node_profile_builder
node_base_profiles -->|"averages profiles"| node_pseudo_profile
node_profile_builder -->|"creates per-speaker profiles"| node_pseudo_profile
node_pseudo_profile -->|"loads profile"| node_voice_anonymizer
node_xtts -->|"synthesizes speech"| node_voice_anonymizer
node_voice_anonymizer -->|"writes audio"| node_voice_audio
node_voice_audio -->|"transcribes anonymized audio"| node_whisper
node_voice_audio -.->|"supports combined trials"| node_trial_builder

click node_prepare_audio "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/prepare_utterance_audio.py"
click node_whisper "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/whisper_transcribe.py"
click node_prompt_generation "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/generate_paraphrase_prompts.py"
click node_response_conversion "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/paraphrase_responses_to_utterances.py"
click node_trial_builder "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/build_trials_from_utterances.py"
click node_matched_trials "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/match_trials.py"
click node_embedder "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/embed_trials_sluar.py"
click node_similarity "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/calculate_similarity_aligned.py"
click node_ldc_evaluation "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/evaluate_ldc_sluar.py"
click node_matched_evaluation "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/evaluate_matched_trials.py"
click node_base_profiles "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/create_xtts_base_profiles.py"
click node_profile_builder "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/build_pseudo_speaker_profiles.py"
click node_pseudo_profile "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/create_xtts_pseudo_profile.py"
click node_voice_anonymizer "https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/anonymize_batch_xtts.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_prepare_audio,node_utterance_wavs toneBlue
class node_base_profiles,node_profile_builder,node_pseudo_profile,node_voice_anonymizer,node_voice_audio,node_fisher toneAmber
class node_whisper,node_asr_text,node_prompt_generation,node_response_conversion,node_paraphrased_text toneMint
class node_trial_builder,node_matched_trials,node_trial_files,node_embedder,node_similarity,node_ldc_evaluation,node_matched_evaluation toneRose
class node_llm,node_xtts toneIndigo
```

## Components

### Audio preparation

- [Segment audio](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/prepare_utterance_audio.py): `scripts/prepare_utterance_audio.py`
- **Utterance WAVs**

### Voice anonymization

- [XTTS base profiles](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/create_xtts_base_profiles.py): `scripts/voice_anonymization/create_xtts_base_profiles.py`
- [Pseudo-profile builder](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/build_pseudo_speaker_profiles.py): `scripts/voice_anonymization/build_pseudo_speaker_profiles.py`
- [Pseudo-speaker profile](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/create_xtts_pseudo_profile.py): `scripts/voice_anonymization/create_xtts_pseudo_profile.py`
- [Batch voice anonymizer](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/voice_anonymization/anonymize_batch_xtts.py): `scripts/voice_anonymization/anonymize_batch_xtts.py`
- **Voice-anonymized audio**

### Content anonymization

- [Whisper transcription](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/whisper_transcribe.py): `scripts/content_anonymization/whisper_transcribe.py`
- **ASR utterances**
- [Paraphrase prompts](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/generate_paraphrase_prompts.py): `scripts/content_anonymization/generate_paraphrase_prompts.py`
- [Response conversion](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/paraphrase_responses_to_utterances.py): `scripts/content_anonymization/paraphrase_responses_to_utterances.py`
- **Anonymized text**

### Trials and evaluation

- [Trial construction](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/build_trials_from_utterances.py): `scripts/content_anonymization/build_trials_from_utterances.py`
- [Matched trials](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/match_trials.py): `scripts/content_anonymization/match_trials.py`
- **Trial files**
- [SLUAR embedding](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/embed_trials_sluar.py): `scripts/content_anonymization/embed_trials_sluar.py`
- [Aligned similarity](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/calculate_similarity_aligned.py): `scripts/content_anonymization/calculate_similarity_aligned.py`
- [LDC evaluation](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/evaluate_ldc_sluar.py): `scripts/content_anonymization/evaluate_ldc_sluar.py`
- [Matched evaluation](https://github.com/caggazzotti/long-form-speech-anonymization/blob/master/scripts/content_anonymization/evaluate_matched_trials.py): `scripts/content_anonymization/evaluate_matched_trials.py`

### Other components

- **Fisher data**
- **Paraphrase model**
- **XTTS synthesis**

## Connections

- Fisher data → Segment audio: provides audio (evidence: `README.md`)
- Segment audio → Utterance WAVs: writes segments (evidence: `scripts/prepare_utterance_audio.py`)
- Utterance WAVs → Whisper transcription: transcribes (evidence: `README.md`)
- Whisper transcription → ASR utterances: writes transcripts (evidence: `scripts/content_anonymization/whisper_transcribe.py`)
- ASR utterances → Paraphrase prompts: generates prompts (evidence: `scripts/content_anonymization/generate_paraphrase_prompts.py`)
- Paraphrase prompts → Paraphrase model: submits prompts
- Paraphrase model → Response conversion: returns responses
- Response conversion → Anonymized text: writes utterances (evidence: `scripts/content_anonymization/paraphrase_responses_to_utterances.py`)
- ASR utterances → Trial construction: builds trials (evidence: `README.md`)
- Anonymized text → Trial construction: builds trials (evidence: `README.md`)
- Trial construction → Trial files: writes trials (evidence: `scripts/content_anonymization/build_trials_from_utterances.py`)
- ASR utterances → Matched trials: pairs utterances (evidence: `scripts/content_anonymization/match_trials.py`)
- Anonymized text → Matched trials: pairs utterances (evidence: `scripts/content_anonymization/match_trials.py`)
- Matched trials → Trial files: writes matched trials (evidence: `README.md`)
- Trial files → SLUAR embedding: embeds trials (evidence: `scripts/content_anonymization/embed_trials_sluar.py`)
- SLUAR embedding → Aligned similarity: compares embeddings
- SLUAR embedding → LDC evaluation: evaluates baseline (evidence: `README.md`)
- SLUAR embedding → Matched evaluation: evaluates matched trials
- Fisher data → XTTS base profiles: reference audio
- XTTS base profiles → Pseudo-profile builder: builds profiles (evidence: `README.md`)
- XTTS base profiles → Pseudo-speaker profile: averages profiles (evidence: `scripts/voice_anonymization/create_xtts_pseudo_profile.py`)
- Pseudo-profile builder → Pseudo-speaker profile: creates per-speaker profiles (evidence: `README.md`)
- Pseudo-speaker profile → Batch voice anonymizer: loads profile (evidence: `scripts/voice_anonymization/anonymize_batch_xtts.py`)
- XTTS synthesis → Batch voice anonymizer: synthesizes speech (evidence: `scripts/voice_anonymization/anonymize_batch_xtts.py`)
- Batch voice anonymizer → Voice-anonymized audio: writes audio (evidence: `scripts/voice_anonymization/anonymize_batch_xtts.py`)
- Voice-anonymized audio → Whisper transcription: transcribes anonymized audio (evidence: `README.md`)
- Voice-anonymized audio → Trial construction: supports combined trials
