# deifius/lorem_ipsum_plainchant architecture

> Architecture diagram of the GitHub repository deifius/lorem_ipsum_plainchant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deifius/lorem_ipsum_plainchant
- Repository: https://github.com/deifius/lorem_ipsum_plainchant

## Overview

Based on your file tree and the README, this project is focused on converting lorem ipsum texts into “fake‐ass plain chant” – essentially a digital audio synthesis pipeline that uses text-to-speech (via festvox text2wave) and alters the audio with PureData patches for harmonies. In other words, the system takes text (or text fragments) and converts them into synthesized vocal chants using both Python and PureData as the processing engines.

##### Main Components
- Text Generation & Source Material: The lorem_gen.py script is likely the driver that produces or manipulates lorem ipsum text. Additionally, the “living_word” directory contains many text files (e.g., “Adipisci.txt”, “Aliquam.txt”, etc.) and at least one audio file, which serve as the repository or input corpus – the “living word” that will be used in the chanting process.
- Text-to-Speech (TTS) Synthesis: Although not directly included as code, the README mentions “festvox text2wave.” This external tool converts text into raw audio. Represent it as an external TTS engine being called by the system.
- Audio Processing & Harmonization: There are two PureData patch files – phase_vocoder.pd and word_singer.pd. The phase vocoder likely handles pitch/tempo modifications or other modulations, and word_singer.pd adds harmonies or transforms the synthesized voice into a chant-like pattern.
- Testing & Artifacts: Files such as test.txt and test.wav indicate that there is a validation step or examples of input and expected output.

##### Relationships and Interactions
- Data/Control Flow: Begin with the text generation component (via lorem_gen.py) that produces the lorem ipsum or selects from the “living_word” resources.
- The generated text is then fed into the festvox text2wave process (represented as an external synthesis engine) to produce a base wave file.
- Next, the generated audio is processed through the PureData patches. You might have a sequential flow:
– The raw audio goes into phase_vocoder.pd for pitch/tempo modulation.
– Then it flows into word_singer.pd which applies harmonies and “chant” effects.
- Finally, the processed audio (e.g., test.wav) is output for validation or further use.

##### Important Architectural Patterns
- Pipeline Architecture: The system is built as a sequential processing pipeline where each component (text generation, TTS synthesis, digital signal processing) is a stage in transforming input (text) into the output (chant audio).
- Separation of Concerns: Python (for generating and coordinating the text/TTS flow) is kept separate from the PureData patches (which focus on audio processing). Additionally, the text/audio repository (living_word) is isolated as a set of input resources.
- Integration of External Tools: The design involves leveraging external synthesis software (festvox text2wave) along with custom processing patches.

##### Key Points & Summary
- Be as detailed as possible to capture every architectural layer:
- Input and repository management (text files in living_word, lorem_gen.py).
- Conversion from text to audio through an external tool (festvox text2wave).
- Audio processing stages in PureData (phase_vocoder and word_singer patches).
- That the architecture is a pipeline that takes textual input and sequentially transforms it into harmonized chanting audio.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Text Generation & Source Subgraph
    subgraph "Text Generation & Source"
        A["lorem_gen.py: Generates lorem ipsum text"]:::python
        B["living_word: Repository of text files"]:::python
    end

    %% External TTS Engine
    C["festvox text2wave (External TTS)"]:::external

    %% Audio Processing Components
    D["phase_vocoder.pd: Audio processing for modulation"]:::puredata
    E["word_singer.pd: Audio processing for harmonization"]:::puredata

    %% Testing / Validation Subgraph
    subgraph "Testing / Validation"
        F1["test.txt: Sample text for testing"]:::testing
        F2["test.wav: Expected output audio"]:::testing
    end

    %% Flow Connections
    A -- "Text" --> C
    B -- "Corpus" --> C
    C -- "Synthesized Audio" --> D
    D -- "Processed Audio" --> E
    E -- "Final Audio" --> F2
    A -- "Sample Input" --> F1

    %% Click Events
    click A "https://github.com/deifius/lorem_ipsum_plainchant/blob/main/lorem_gen.py"
    click B "https://github.com/deifius/lorem_ipsum_plainchant/tree/main/living_word"
    click D "https://github.com/deifius/lorem_ipsum_plainchant/blob/main/phase_vocoder.pd"
    click E "https://github.com/deifius/lorem_ipsum_plainchant/blob/main/word_singer.pd"
    click F1 "https://github.com/deifius/lorem_ipsum_plainchant/blob/main/test.txt"
    click F2 "https://github.com/deifius/lorem_ipsum_plainchant/blob/main/test.wav"

    %% Styles
    classDef python fill:#a8e6cf, stroke:#333, stroke-width:2px;
    classDef puredata fill:#dcedc1, stroke:#333, stroke-width:2px;
    classDef external fill:#ffd3b6, stroke:#333, stroke-width:2px, stroke-dasharray: 5,5;
    classDef testing fill:#ffaaa5, stroke:#333, stroke-width:2px;
```
