# lugodoy/conversando-por-voz architecture

> Architecture diagram of the GitHub repository lugodoy/conversando-por-voz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lugodoy/conversando-por-voz
- Repository: https://github.com/lugodoy/conversando-por-voz

## Overview

#### Purpose and Execution Model
This repository is a single Google Colab-oriented Python notebook implementing an interactive voice-to-voice generative-AI workflow. Its primary and only executable entry point is `conversando_por_voz.ipynb`; users upload it to Colab, configure a secret, and run cells sequentially.

#### User Audio Capture
The notebook captures microphone audio from the browser. This is a notebook/browser boundary: JavaScript handles browser microphone permission and recording, while Python receives the resulting audio for downstream processing. The Colab runtime is required for this interaction model.
- `conversando_por_voz.ipynb`

#### Speech-to-Text Stage
Recorded audio is passed to OpenAI Whisper for transcription into text. This stage converts an audio artifact into the textual user prompt consumed by the language-model stage.
- `conversando_por_voz.ipynb`

#### Generative Response Stage
The transcribed prompt is sent to Google Gemini through Google’s API. Access is gated by the `GOOGLE_API_KEY` secret configured in Colab Secrets; the key should remain outside notebook source and repository files. Gemini’s generated text becomes the canonical assistant response.
- `conversando_por_voz.ipynb`

#### Text Preparation and Text-to-Speech
The notebook performs text cleanup intended to improve spoken output, then sends the response text to gTTS to synthesize audio. This creates the final response audio presented back to the user.
- `conversando_por_voz.ipynb`

#### End-to-End Data Flow
Control is user-driven through ordered notebook cells: microphone recording → audio data/file → Whisper transcription → Gemini prompt/API response → cleaned response text → gTTS audio synthesis → browser playback. Each stage depends on output from the preceding cell, rather than a persistent service, API server, or application backend.
- `conversando_por_voz.ipynb`

#### Runtime and External Dependencies
Material infrastructure consists of a Google Colab Python 3.10+ environment and a browser with microphone access. External services/libraries are Whisper for STT, Google Gemini for inference, and gTTS for speech synthesis. There is no separate deployment, package structure, database, or server entry point.
- `README.md`
- `conversando_por_voz.ipynb`

Main entry points: [`conversando_por_voz.ipynb`](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb) (Google Gemini API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_colab["Colab Runtime"]
  node_notebook["Voice Conversation Notebook<br/>notebook entry point"]
  node_audio["Recorded Audio<br/>audio artifact"]
  node_colab_secrets["Colab Secrets<br/>secret store"]
  node_cleanup["Text Cleanup<br/>text preparation"]
end

subgraph group_ai["AI Processing"]
  node_whisper["Whisper Transcription<br/>speech-to-text"]
  node_prompt["User Prompt<br/>text artifact"]
  node_gemini["Google Gemini API<br/>generative inference"]
  node_response["Assistant Response<br/>generated text"]
  node_gtts["gTTS Synthesis<br/>text-to-speech"]
end

node_user(("User<br/>actor"))
node_browser["Browser Microphone<br/>browser capture"]
node_playback["Browser Playback<br/>audio output"]

node_user -->|"speaks"| node_browser
node_browser -->|"audio capture"| node_notebook
node_notebook -->|"receives"| node_audio
node_audio -->|"transcribe"| node_whisper
node_whisper -->|"produces"| node_prompt
node_prompt -->|"send prompt"| node_gemini
node_colab_secrets -.->|"GOOGLE_API_KEY"| node_gemini
node_gemini -->|"generates"| node_response
node_response -->|"clean text"| node_cleanup
node_cleanup -->|"synthesize"| node_gtts
node_gtts -->|"response audio"| node_playback
node_playback -->|"hears"| node_user

click node_browser "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_notebook "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_audio "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_whisper "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_prompt "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_colab_secrets "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_gemini "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_response "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_cleanup "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_gtts "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"
click node_playback "https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb"

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_notebook,node_audio,node_colab_secrets,node_cleanup toneBlue
class node_whisper,node_prompt,node_gemini,node_response,node_gtts toneAmber
class node_user,node_browser,node_playback toneNeutral
```

## Components

### Colab Runtime

Cells run sequentially in a Python 3.10+ Colab session.

- [Voice Conversation Notebook](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): notebook entry point · The repository's only executable workflow. · `conversando_por_voz.ipynb`
- [Recorded Audio](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): audio artifact · `conversando_por_voz.ipynb`
- [Colab Secrets](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): secret store · Supplies GOOGLE_API_KEY outside notebook source. · `conversando_por_voz.ipynb`
- [Text Cleanup](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): text preparation · Prepares generated text for natural spoken output. · `conversando_por_voz.ipynb`

### AI Processing

- [Whisper Transcription](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): speech-to-text · Converts recorded speech into a textual prompt. · `conversando_por_voz.ipynb`
- [User Prompt](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): text artifact · `conversando_por_voz.ipynb`
- [Google Gemini API](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): generative inference · Generates the canonical assistant response. · `conversando_por_voz.ipynb`
- [Assistant Response](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): generated text · `conversando_por_voz.ipynb`
- [gTTS Synthesis](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): text-to-speech · Synthesizes cleaned text into response audio. · `conversando_por_voz.ipynb`

### Other components

- **User**: actor
- [Browser Microphone](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): browser capture · Requests microphone access and records audio with JavaScript. · `conversando_por_voz.ipynb`
- [Browser Playback](https://github.com/lugodoy/conversando-por-voz/blob/main/conversando_por_voz.ipynb): audio output · Presents synthesized response audio to the user. · `conversando_por_voz.ipynb`

## Connections

- User → Browser Microphone: speaks
- Browser Microphone → Voice Conversation Notebook: audio capture
- Voice Conversation Notebook → Recorded Audio: receives
- Recorded Audio → Whisper Transcription: transcribe
- Whisper Transcription → User Prompt: produces
- User Prompt → Google Gemini API: send prompt
- Colab Secrets → Google Gemini API: GOOGLE_API_KEY
- Google Gemini API → Assistant Response: generates
- Assistant Response → Text Cleanup: clean text
- Text Cleanup → gTTS Synthesis: synthesize
- gTTS Synthesis → Browser Playback: response audio
- Browser Playback → User: hears
