Skip to main content

Real-time audio waveform visualizer with voice-command stop

Project description

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
Linuxsudo 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

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

soundgraph-0.3.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

soundgraph-0.3.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file soundgraph-0.3.0.tar.gz.

File metadata

  • Download URL: soundgraph-0.3.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.9

File hashes

Hashes for soundgraph-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8661e8f40663567e2b0af7c3891f7f85096b94eb57d187c646e1eaba9a950251
MD5 e4a23a2054ba0cbb4c5354cfaf977dbd
BLAKE2b-256 480b8be3cc070c24f24b61d673f16430174941a6dacafb35046ed93122682bea

See more details on using hashes here.

File details

Details for the file soundgraph-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: soundgraph-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.9

File hashes

Hashes for soundgraph-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f398eecb89a88045bd23d1b1f33e360edca444282ad7c723ae241a31dc04ba7
MD5 e5fc4d4c5b78c2318aa93d39f963230c
BLAKE2b-256 249eb93d6ce51cd76586240b977b652cb7e06e4fbb58df50472b99e3d66f2e0f

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