Skip to main content

SoundGraph

PyPI version Python License: MIT

SoundGraph is a Python package that visualizes your microphone audio as a live waveform in real-time.

Make noise → see the wave. Say "stop" (or close the window) → exits cleanly.


Installation

pip install SoundGraph

macOS — install PortAudio first: brew install portaudio
Linux — sudo apt-get install portaudio19-dev python3-pyaudio


Quick Start

import soundgraph

soundgraph.start()

That's it.


Features

Feature Description
Visualization modes Waveform, frequency spectrum, or both side-by-side
Color themes dark, light, neon
Live dB meter Real-time decibel level bar at the bottom
Record to WAV Save your session to a file while visualizing
Device selection Pick any connected microphone by index
Voice stop Say "stop" to exit hands-free

Usage

Python API

import soundgraph

# Waveform + spectrum side-by-side, neon theme
soundgraph.start(mode='both', theme='neon')

# Record while visualizing
soundgraph.start(record=True, output='session.wav')

# List available input devices, then use one
soundgraph.list_devices()
soundgraph.start(device=2)

# All options
soundgraph.start(
    mode='both',           # 'waveform' | 'spectrum' | 'both'
    theme='dark',          # 'dark' | 'light' | 'neon'
    record=True,           # save to WAV
    output='out.wav',      # custom output path
    device=0,              # input device index
    sample_rate=44100,     # Hz
    chunk=2048,            # frames per update
    phrase_seconds=1.5,    # seconds per recognition attempt
)

Command Line

soundgraph                              # default waveform, dark theme
soundgraph --mode both --theme neon     # spectrum + waveform, neon
soundgraph --record --output out.wav    # record while visualizing
soundgraph --list-devices               # print available mics
soundgraph --device 2                   # use mic at index 2

All flags:

--mode, -m       waveform | spectrum | both   (default: waveform)
--theme, -t      dark | light | neon          (default: dark)
--record, -r     Record session to WAV
--output, -o     Output WAV path              (default: auto-named)
--device, -d     Input device index
--list-devices   List available input devices and exit
--rate           Sample rate in Hz            (default: 44100)
--chunk          Frames per update            (default: 2048)
--phrase-seconds Seconds per recognition      (default: 1.5)
--verbose, -v    Debug logging
--version        Show version

How It Works

Microphone
    │
    ▼
PyAudio stream (single handle)
    │
    ├──► viz_queue    → Matplotlib animation   (main thread)
    ├──► speech_queue → VoiceCommandListener   (background thread)
    └──► record_queue → AudioRecorder          (background thread, if --record)

The waveform colour shifts from blue → red as your volume increases.
The dB meter at the bottom turns green → yellow → red as level rises.


Requirements

Package Purpose
pyaudio Live microphone capture
numpy PCM byte → number conversion
matplotlib Animated waveform / spectrum plot
SpeechRecognition Voice "stop" command detection

Contributing

  1. Fork → git checkout -b feature/my-feature
  2. Make changes, add tests in tests/
  3. pytest tests/ -v — all tests must pass
  4. Pull request → github.com/bappy-3/sound-graph

License

MIT © Al Mustafiz Bappy

Metadata

Release files for SoundGraph 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SoundGraph 0.3.0
File Size Uploaded
soundgraph-0.3.0.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SoundGraph 0.3.0
File Interpreter ABI Platform
soundgraph-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.7 kB

Release files / soundgraph-0.3.0.tar.gz

Download URL soundgraph-0.3.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8661e8f40663567e2b0af7c3891f7f85096b94eb57d187c646e1eaba9a950251
BLAKE2b-256 checksum
How to use checksums
480b8be3cc070c24f24b61d673f16430174941a6dacafb35046ed93122682bea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.9

Release files / soundgraph-0.3.0-py3-none-any.whl

Download URL soundgraph-0.3.0-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f398eecb89a88045bd23d1b1f33e360edca444282ad7c723ae241a31dc04ba7
BLAKE2b-256 checksum
How to use checksums
249eb93d6ce51cd76586240b977b652cb7e06e4fbb58df50472b99e3d66f2e0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page