Skip to content

Real-time audio visualization and analysis in Python. Includes a PyQtGraph live viewer (waveform, FFT, spectrogram) and a one-shot recorder that saves a WAV and analysis plots using sounddevice, librosa, and matplotlib.

Notifications You must be signed in to change notification settings

Alex44lel/Audio-Analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Audio Analyzer

Small, focused tools to record audio from your microphone and visualize it as a waveform, FFT spectrum, and spectrogram. Includes:

  • A live, low-latency viewer built with PyQtGraph.
  • A one-shot recorder that saves a WAV and an analysis image.
image

Files:

Quick start

  1. Create and activate a virtual environment (optional, recommended):

  2. Install dependencies:

python -m pip install -r requirements.txt
  1. Give your terminal/app microphone permission (OS-dependent).

How to run

Live viewer (recommended)

Shows waveform, FFT, and spectrogram in real-time. Use the docked spin box to change sampling rate.

python live_audio_to_chart.py

What you’ll see:

  • Waveform (top)
    • Time range: last 1 second (modifiable).
    • Y range: [-0.05, 0.05] (audio from sounddevice is normalized to [-1, 1]) (modifiable).
  • FFT Spectrum (middle)
    • Hann window applied to the 1-second buffer.
    • Frequency axis limited to 0–6 kHz (modifiable) for readability.
  • Spectrogram (bottom)
    • STFT size: 1024 (Hann window) (modifiable).
    • Scrolls left to right using a fixed-width image buffer.
    • Colormap: inferno, levels in dB [-80, 0].

Controls:

  • “Sampling rate (Hz)” spin box: 2000–96000 Hz. The app restarts the input stream when this changes.

Script: live_audio_to_chart.py

One-shot analysis (records 1 second)

Records 1 second at 44.1 kHz mono, writes a WAV, and saves charts (waveform, FFT, STFT spectrogram, Mel spectrogram) to an image.

python audio_to_charts.py

Outputs:

  • recording.wav — 16-bit PCM.
  • audio_analisis.png — figure with 4 panels:
    • Waveform
    • DFT (magnitude spectrum)
    • STFT Spectrogram (n_fft=1024, hop_length=512)
    • Mel Spectrogram (64 mels, HTK scale)

Script: audio_to_charts.py

About

Real-time audio visualization and analysis in Python. Includes a PyQtGraph live viewer (waveform, FFT, spectrogram) and a one-shot recorder that saves a WAV and analysis plots using sounddevice, librosa, and matplotlib.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages