Skip to main content

Tools for obtaining speech representations along the speechspectrum.

Project description

🗣️ SpeechSpectrum

SpeechSpectrum provides a lightweight Python package for generating transcript representations along a linguistic fidelity spectrum—from verbatim transcripts to enhanced and compressed forms such as bullet points. The repository contains all code, notebooks, and the static site used in the accompanying user study.

⚙️ Requirements

  • Python 3.8+
  • openai
  • OpenAI API credentials (API key + organization/project IDs)

📦 Installation

  • Via PyPI:
    pip install speechspectrum
    
  • From source (this repository):
    git clone https://github.com/mariateleki/SpeechSpectrum.git
    pip install -e .
    

🚀 Example Usage (also see notebooks/SpeechSpectrum_Tool.ipynb)

from speechspectrum import Client

client = Client(
    openai_api_key="sk-...",
    openai_org_id="org_...",      # pass "" if your account does not use orgs
    openai_project_id="proj_..."  # pass "" if your account does not require it
)

# Optional: begin from an audio file
# verbatim = client.audio_to_verbatim("path/to/audio.wav").text

MEDICAL_EXAMPLE = {
    "verbatim": (
        "Okay, so, um, the patient came in today and, uh, she was "
        "complaining of, you know, chest pain that's been going on for about, "
        "let's see, um, three days now. And, uh, she said it gets worse when she, "
        "when she breathes deeply or, or coughs. So I, I examined her and found "
        "some, uh, some tenderness in the, the inter – intercostal muscles on the "
        "right side. Her vital signs were, um, let me think, blood pressure was "
        "one-twenty over eighty, heart rate was, was seventy-two, and temperature "
        "was normal at, uh, ninety-eight point six. I'm thinking this is probably, "
        "you know, costochon – costochondritis rather than anything, anything more "
        "serious like a cardiac event."
    ),
    "non-verbatim": "",
    "enhanced": "",
    "bullet-points": ""
}

# Execute the pipeline on the medical example (or replace MEDICAL_EXAMPLE['verbatim']
# with audio_verbatim above to process an observed recording)
MEDICAL_EXAMPLE["non-verbatim"] = client.verbatim_to_nonverbatim(MEDICAL_EXAMPLE["verbatim"])
MEDICAL_EXAMPLE["enhanced"] = client.nonverbatim_to_enhanced(MEDICAL_EXAMPLE["non-verbatim"])
MEDICAL_EXAMPLE["bullet-points"] = client.enhanced_to_bulletpoints(MEDICAL_EXAMPLE["enhanced"])

print("Verbatim:", MEDICAL_EXAMPLE["verbatim"])
print("Non-verbatim:", MEDICAL_EXAMPLE["non-verbatim"])
print("Enhanced:", MEDICAL_EXAMPLE["enhanced"])
print("Bullet points:", MEDICAL_EXAMPLE["bullet-points"])

📂 Repository Structure

  • src/speechspectrum/ — Source code for our Python package, using gpt-4o-transcribe (audio → verbatim) and gpt-5.1 (downstream text transformations).
  • notebooks/SpeechSpectrum_Tool.ipynb — Shows end-to-end transcript pipeline with results used in the website + user study.
  • docs/ — Static website served at https://speechspectrum.org.
  • notebooks/run_llm_experiment.ipynb — Executes the persona-based prompting study modeling preference distributions across fidelity levels.
  • notebooks/get_figs_and_sig_tests.ipynb — Reproduces statistical analyses and figure generation from the study outputs.

🌐 Demo Website

The static demonstration resides in docs/. The site is published via GitHub Pages at https://speechspectrum.org.

🧭 Usage Principles and Ethical Considerations

SpeechSpectrum is designed to support user agency and transparency in transcript generation. Key principles for responsible use include:

  • Context-dependent fidelity: Different tasks require different levels of detail. Select fidelity settings based on the informational and situational needs of the domain.

  • Transformations are interpretive: Cleaning, enhancing, or summarizing transcripts alters meaning. These operations can suppress uncertainty cues or standardize informal or dialectal speech.

  • Linguistic representation matters: Post-processing can unintentionally erase identity markers or stylistic features. Exercise care when working with marginalized or diverse speech communities.

  • Disfluencies are informative: Filled pauses, hesitations, and repairs can carry semantic or pragmatic value. Preserve or remove them thoughtfully, especially in high-stakes contexts.

  • Protect speaker privacy: Audio and transcripts may encode sensitive information. Collect and process data with consent and in accordance with relevant privacy requirements.

  • Use LLM preference modeling cautiously: LLM personas tend to overgeneralize or exaggerate role-based preferences. Empirical user data should guide design decisions.

  • Maintain transparency: When sharing outputs, disclose the fidelity level used and any post-processing applied so downstream users can interpret transcripts appropriately.

📚 Citation

@inproceedings{choi2025speechspectrum,
  title     = {SpeechSpectrum: A Framework for Speech-to-Text Representation Along the Linguistic Fidelity Spectrum},
  author    = {Choi, Anna Seo Gyeong and Teleki, Maria and Miguel del Rio and Corey Miller and James Caverlee and Allison Koenecke},
  booktitle = {-},
  year      = {2025}
}

📜 License

MIT, see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speechspectrum-1.0.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speechspectrum-1.0.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file speechspectrum-1.0.1.tar.gz.

File metadata

  • Download URL: speechspectrum-1.0.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for speechspectrum-1.0.1.tar.gz
Algorithm Hash digest
SHA256 20dd427f37dc4121d702689ac1b5774e83d52efec3fe8dc1b78a96b715046bd3
MD5 6c630349d513f0368641602c26533980
BLAKE2b-256 55cbbe22a58cc8a55713ec0e1cba063b79c8d7d8aca4d51b09ae46e4db9df976

See more details on using hashes here.

File details

Details for the file speechspectrum-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: speechspectrum-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for speechspectrum-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c25c92c2f760fa3f829194f682b143c573503fb8fca260cd5eb662b97bca7201
MD5 f70fccc8b8040d4ef8b2b9b8965ca0d7
BLAKE2b-256 432ac9f690ce72d694ff1b19c2a40884983c0c55a6343c51396aa8ed60313a92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page