# patrick-costa1605/tiko_994 architecture

> Architecture diagram of the GitHub repository patrick-costa1605/tiko_994, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/patrick-costa1605/tiko_994
- Repository: https://github.com/patrick-costa1605/tiko_994

## Overview

This repository generates a hand-drawn, Portuguese-language scouting-history Reel from a JSON script, producing synchronized visuals, captions, voice, music, and effects before encoding an MP4. The main workflow is script blocks and scenes → speech and word timings (recorded or synthesized) → timed drawing and page transitions → audio mix and video export. The README documents both voice paths, transcription of changed recordings, and a separate deliverable check; those branches are included. Edges cite shown calls or README statements; unsampled render internals are not inferred beyond documented behavior.

Main entry points: [`src/render.py`](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py) (Render orchestrator), [`src/gravacao.py`](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/gravacao.py) (Recording alignment), [`src/voz.py`](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/voz.py) (Speech synthesis), [`src/transcrever.py`](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/transcrever.py) (Word transcription)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Script and scenes"]
  node_script["JSON script<br/>[como_surgiu.json]"]
  node_scene_art["Scene artwork<br/>[cenas.py]"]
  node_settings["Video settings<br/>[config.py]"]
end

subgraph group_rendering["Visual rendering"]
  node_renderer["Render orchestrator<br/>[render.py]"]
  node_drawing["Drawing primitives<br/>[desenho.py]"]
  node_video["Rendered Reel<br/>[render.py]"]
  node_caption_file["Caption text<br/>[render.py]"]
end

subgraph group_speech["Voice and timing"]
  node_speech_choice["Voice selection<br/>[render.py]"]
  node_tts["Speech synthesis<br/>[voz.py]"]
  node_recorded_voice["Recording alignment<br/>[gravacao.py]"]
  node_transcription["Word transcription<br/>[transcrever.py]"]
  node_word_times["Word timings<br/>[palavras.json]"]
  node_voice_recording["Recorded voice<br/>[voz_original.mp4]"]
  node_audio_cache[("Speech cache")]
end

subgraph group_sound["Audio production"]
  node_audio_tools["Audio processing<br/>[audio.py]"]
  node_music["Music adaptation<br/>[musica.py]"]
  node_music_track["Background track"]
end

subgraph group_delivery["Output checks"]
  node_checker["Reel verifier<br/>[verificar.py]"]
end

node_creator(("Video creator"))
node_ffmpeg["FFmpeg"]
node_edge_service["Edge TTS service"]

node_creator -->|"runs render"| node_renderer
node_creator -->|"transcribes recording"| node_transcription
node_creator -->|"checks output"| node_checker
node_script -->|"provides blocks"| node_renderer
node_scene_art -->|"provides scenes"| node_renderer
node_settings -->|"configures layout"| node_renderer
node_renderer -->|"renders artwork"| node_drawing
node_renderer -->|"builds voice timeline"| node_speech_choice
node_speech_choice -->|"uses recording path"| node_recorded_voice
node_speech_choice -->|"uses synthesis path"| node_tts
node_tts -->|"requests speech"| node_edge_service
node_tts -->|"reads or writes"| node_audio_cache
node_recorded_voice -->|"decodes recording"| node_voice_recording
node_recorded_voice -->|"aligns to timings"| node_word_times
node_transcription -->|"transcribes audio"| node_voice_recording
node_transcription -->|"writes timings"| node_word_times
node_recorded_voice -->|"processes voice"| node_audio_tools
node_renderer -->|"requests soundtrack"| node_music
node_music -->|"loads track"| node_music_track
node_music -->|"stretches audio"| node_audio_tools
node_renderer -->|"mixes audio"| node_audio_tools
node_renderer -->|"encodes output"| node_ffmpeg
node_renderer -->|"writes MP4"| node_video
node_renderer -->|"writes captions"| node_caption_file
node_checker -->|"rebuilds timeline"| node_renderer
node_checker -->|"checks encoding"| node_video

click node_script "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/guioes/como_surgiu.json"
click node_scene_art "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/cenas.py"
click node_settings "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/config.py"
click node_renderer "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py"
click node_drawing "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/desenho.py"
click node_speech_choice "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py"
click node_tts "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/voz.py"
click node_recorded_voice "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/gravacao.py"
click node_transcription "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/transcrever.py"
click node_word_times "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/assets/gravacao/palavras.json"
click node_audio_tools "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/audio.py"
click node_music "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/musica.py"
click node_music_track "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/assets/musica/bombinsound-happy-ukulele-512480.mp3"
click node_voice_recording "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/assets/gravacao/voz_original.mp4"
click node_audio_cache "https://github.com/patrick-costa1605/tiko_994/tree/ccr-57851348-3ivrg5/assets/audio_cache"
click node_video "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py"
click node_caption_file "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py"
click node_checker "https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/verificar.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_script,node_scene_art,node_settings toneBlue
class node_renderer,node_drawing,node_video,node_caption_file toneAmber
class node_speech_choice,node_tts,node_recorded_voice,node_transcription,node_word_times,node_voice_recording,node_audio_cache toneMint
class node_audio_tools,node_music,node_music_track toneRose
class node_checker,node_creator,node_ffmpeg,node_edge_service toneIndigo
```

## Components

### Script and scenes

- [JSON script](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/guioes/como_surgiu.json): `guioes/como_surgiu.json`
- [Scene artwork](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/cenas.py): `src/cenas.py`
- [Video settings](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/config.py): `src/config.py`

### Visual rendering

- [Render orchestrator](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py): `src/render.py`
- [Drawing primitives](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/desenho.py): `src/desenho.py`
- [Rendered Reel](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py): `src/render.py`
- [Caption text](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py): `src/render.py`

### Voice and timing

- [Voice selection](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/render.py): `src/render.py`
- [Speech synthesis](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/voz.py): `src/voz.py`
- [Recording alignment](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/gravacao.py): `src/gravacao.py`
- [Word transcription](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/transcrever.py): `src/transcrever.py`
- [Word timings](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/assets/gravacao/palavras.json): `assets/gravacao/palavras.json`
- [Recorded voice](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/assets/gravacao/voz_original.mp4): `assets/gravacao/voz_original.mp4`
- [Speech cache](https://github.com/patrick-costa1605/tiko_994/tree/ccr-57851348-3ivrg5/assets/audio_cache): `assets/audio_cache`

### Audio production

- [Audio processing](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/audio.py): `src/audio.py`
- [Music adaptation](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/musica.py): `src/musica.py`
- [Background track](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/assets/musica/bombinsound-happy-ukulele-512480.mp3): `assets/musica/bombinsound-happy-ukulele-512480.mp3`

### Output checks

- [Reel verifier](https://github.com/patrick-costa1605/tiko_994/blob/ccr-57851348-3ivrg5/src/verificar.py): `src/verificar.py`

### Other components

- **Video creator**
- **FFmpeg**
- **Edge TTS service**

## Connections

- Video creator → Render orchestrator: runs render (evidence: `README.md`)
- Video creator → Word transcription: transcribes recording (evidence: `README.md`)
- Video creator → Reel verifier: checks output (evidence: `README.md`)
- JSON script → Render orchestrator: provides blocks (evidence: `README.md`)
- Scene artwork → Render orchestrator: provides scenes (evidence: `README.md`)
- Video settings → Render orchestrator: configures layout (evidence: `src/render.py`)
- Render orchestrator → Drawing primitives: renders artwork (evidence: `src/render.py`)
- Render orchestrator → Voice selection: builds voice timeline (evidence: `src/render.py`)
- Voice selection → Recording alignment: uses recording path (evidence: `src/render.py`)
- Voice selection → Speech synthesis: uses synthesis path (evidence: `src/render.py`)
- Speech synthesis → Edge TTS service: requests speech (evidence: `src/voz.py`)
- Speech synthesis → Speech cache: reads or writes (evidence: `src/voz.py`)
- Recording alignment → Recorded voice: decodes recording (evidence: `src/gravacao.py`)
- Recording alignment → Word timings: aligns to timings (evidence: `src/gravacao.py`)
- Word transcription → Recorded voice: transcribes audio (evidence: `src/transcrever.py`)
- Word transcription → Word timings: writes timings (evidence: `src/transcrever.py`)
- Recording alignment → Audio processing: processes voice (evidence: `src/gravacao.py`)
- Render orchestrator → Music adaptation: requests soundtrack (evidence: `src/render.py`)
- Music adaptation → Background track: loads track (evidence: `src/musica.py`)
- Music adaptation → Audio processing: stretches audio (evidence: `src/musica.py`)
- Render orchestrator → Audio processing: mixes audio (evidence: `README.md`)
- Render orchestrator → FFmpeg: encodes output (evidence: `README.md`)
- Render orchestrator → Rendered Reel: writes MP4 (evidence: `README.md`)
- Render orchestrator → Caption text: writes captions (evidence: `README.md`)
- Reel verifier → Render orchestrator: rebuilds timeline (evidence: `src/verificar.py`)
- Reel verifier → Rendered Reel: checks encoding (evidence: `README.md`)
