# piyushgarg-dev/stt-tts-pipeline-cohort architecture

> Architecture diagram of the GitHub repository piyushgarg-dev/stt-tts-pipeline-cohort, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/piyushgarg-dev/stt-tts-pipeline-cohort
- Repository: https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort

## Overview

A small browser-based voice assistant: it transcribes user speech, streams sentence-sized responses from OpenAI, and synthesizes and plays them aloud. Microphone-level barge-in interrupts playback. The only source file is script.js; index.html is present in the tree but its contents were not sampled, so page wiring is omitted.

Main entry points: [`script.js`](https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js) (Playback queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation"]
  node_main["Voice assistant<br/>[script.js]"]
  node_stream["Streaming response<br/>[script.js]"]
  node_llm["Text response<br/>[script.js]"]
end

subgraph group_audio["Audio"]
  node_speech["Speech recognition<br/>[script.js]"]
  node_barge["Barge-in monitor<br/>[script.js]"]
  node_playback["Playback queue<br/>[script.js]"]
end

node_user(("User"))
node_browser["Browser APIs"]
node_openai_responses["OpenAI Responses API"]
node_tts["OpenAI speech API"]

node_user -->|"speaks"| node_speech
node_main -->|"starts"| node_speech
node_speech -->|"transcribes"| node_main
node_main -->|"requests"| node_stream
node_stream -->|"streams from"| node_openai_responses
node_main -->|"speaks chunks"| node_playback
node_playback -->|"requests audio"| node_tts
node_tts -->|"returns audio"| node_playback
node_playback -->|"plays audio"| node_browser
node_user -->|"speaks"| node_barge
node_barge -->|"reads microphone"| node_browser
node_barge -->|"interrupts"| node_playback

click node_main "https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js"
click node_stream "https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js"
click node_llm "https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js"
click node_speech "https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js"
click node_barge "https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js"
click node_playback "https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js"

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_main,node_stream,node_llm,node_user,node_browser toneBlue
class node_speech,node_barge,node_playback toneAmber
class node_openai_responses,node_tts toneMint
```

## Components

### Conversation

- [Voice assistant](https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js): `script.js`
- [Streaming response](https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js): `script.js`
- [Text response](https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js): `script.js`

### Audio

- [Speech recognition](https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js): `script.js`
- [Barge-in monitor](https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js): `script.js`
- [Playback queue](https://github.com/piyushgarg-dev/stt-tts-pipeline-cohort/blob/main/script.js): `script.js`

### Other components

- **User**
- **Browser APIs**
- **OpenAI Responses API**
- **OpenAI speech API**

## Connections

- User → Speech recognition: speaks
- Voice assistant → Speech recognition: starts
- Speech recognition → Voice assistant: transcribes
- Voice assistant → Streaming response: requests
- Streaming response → OpenAI Responses API: streams from
- Voice assistant → Playback queue: speaks chunks
- Playback queue → OpenAI speech API: requests audio
- OpenAI speech API → Playback queue: returns audio
- Playback queue → Browser APIs: plays audio
- User → Barge-in monitor: speaks
- Barge-in monitor → Browser APIs: reads microphone
- Barge-in monitor → Playback queue: interrupts
