Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voice Data Collection App

A web application for collecting voice recordings to fine-tune Whisper speech recognition models. Extract random phrases from PDFs or pasted text, record yourself speaking them, and automatically save WAV files with a CSV manifest.

Features

  • Dual Input: Upload PDF files or paste text directly
  • Smart Phrase Extraction: Automatically extracts random 3-5 word phrases
  • Session-Based: Each recording session gets its own folder
  • Auto-Save: Recordings are saved immediately after each phrase
  • WAV Format: High-quality uncompressed audio for ML training
  • CSV Manifest: Automatic mapping of phrases to audio files
  • Keyboard Shortcuts: Space to record/stop, Enter for next phrase
  • Progress Tracking: Visual progress bar and history panel

Installation

# Clone or navigate to the project
cd VoiceApp

# Install dependencies with uv
uv sync

Usage

Start the Server

uv run uvicorn main:app --port 8000

Or run directly:

uv run python main.py

Record Voice Data

  1. Open http://localhost:8000 in your browser
  2. Enter a session name (e.g., my_voice_session)
  3. Choose input source:
    • Upload PDF: Drag & drop or click to select a PDF file
    • Paste Text: Switch to the text tab and paste your content
  4. Set the number of phrases to extract (default: 50)
  5. Click "Extract Phrases" to begin
  6. For each phrase:
    • Click Record (or press Space) to start recording
    • Speak the phrase clearly
    • Click Stop (or press Space) to stop
    • Preview the recording if needed
    • Click Next Phrase (or press Enter) to save and continue
    • Use Re-record if you want to try again
  7. Click Stop Session when finished (or complete all phrases)

Output

Each session creates a folder in data/<session_name>/ containing:

data/my_voice_session/
├── 001.wav
├── 002.wav
├── 003.wav
├── ...
└── manifest.csv

The manifest.csv file contains:

phrase,audio_file
"the quick brown",001.wav
"fox jumps over",002.wav
"the lazy dog",003.wav

Project Structure

VoiceApp/
├── app/
│   ├── __init__.py
│   ├── pdf_processor.py  # PDF text extraction & phrase generation
│   └── session.py        # Session management & file saving
├── static/
│   ├── index.html        # Main UI
│   ├── css/
│   │   └── styles.css    # Styling
│   └── js/
│       ├── app.js        # Main application logic
│       ├── recorder.js   # Audio recording module
│       └── wav-encoder.js # WAV format encoder
├── data/                 # Recording sessions (created at runtime)
├── main.py               # FastAPI server
├── pyproject.toml        # Project dependencies
└── README.md

API Endpoints

Method Endpoint Description
GET / Serve the web UI
GET /api/health Health check
POST /api/start-session Start a new recording session
POST /api/upload-pdf Upload PDF and extract phrases
POST /api/parse-text Parse pasted text and extract phrases
POST /api/save-recording Save a WAV recording
POST /api/end-session End session and save manifest
GET /api/session-info Get current session info

Keyboard Shortcuts

Key Action
Space Start/Stop recording
Enter Save and go to next phrase

Tech Stack

  • Backend: FastAPI, pdfplumber, uvicorn
  • Frontend: Vanilla JavaScript, Web Audio API, MediaRecorder API
  • Package Manager: uv

Requirements

  • Python 3.11+
  • Modern browser with microphone support (Chrome, Firefox, Edge)

Tips for Quality Recordings

  1. Use a quiet environment
  2. Speak clearly and at a natural pace
  3. Keep consistent distance from the microphone
  4. Use a good quality microphone if available
  5. Record in a room with minimal echo

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages