Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

πŸš€ A cross-platform tool (Windows/macOS/Linux) for generating spectrograms from audio files.

License

Notifications You must be signed in to change notification settings

lmshao/AudioSpectrogram

Repository files navigation

AudioSpectrogram

AudioSpectrogram is a powerful audio spectrogram generator that supports various audio formats and produces high-quality spectrograms. Built with Rust, it offers cross-platform support and runs on Windows, macOS, and Linux.

Features

  • Cross-platform support (Windows, macOS, Linux)
  • Drag-and-drop support on Windows
  • Multiple audio format support: WAV, MP3, FLAC, OGG, AAC, etc.
  • High-quality spectrogram generation using Turbo colormap
  • Automatic multi-channel audio processing (mixed to mono)
  • Precise time and frequency scales
  • Complete dB scale display (-120dB to 0dB)
  • Customizable FFT size and hop size

Sample Spectrogram

Sample Spectrogram

This is a sample spectrogram generated using our tool, showing OneRepublic's "Apologize" (44.1kHz sampling rate). The spectrogram clearly demonstrates:

  • Full frequency range (0-22.05kHz)
  • Clear time axis markers
  • Precise frequency scaling
  • Rich dynamic range display (-120dB to 0dB)

Requirements

  • Rust toolchain (recommended installation via rustup)
  • Cargo (Rust package manager, included with Rust)
  • System requires at least one monospace font:
    • Windows: Consolas
    • macOS: Monaco
    • Linux: DejaVu Sans Mono

Building

  1. Clone the repository:
git clone https://github.com/lmshao/AudioSpectrogram.git
cd AudioSpectrogram
  1. Build the project:
cargo build --release

The executable will be available in the target/release directory.

Usage

Basic usage:

AudioSpectrogram -i input.mp3

On Windows, you can simply drag and drop an audio file onto the program icon, and it will automatically generate a spectrogram. This is the easiest way to use the program.

Alternatively, specify the file directly in the command line:

AudioSpectrogram input.mp3

Command Line Arguments

  • -i, --input <FILE>: Input audio file path
  • -o, --output <FILE>: Output image path (optional, defaults to input filename with .png extension)
  • -f, --fft-size <SIZE>: FFT size (optional, default: 4096)
  • -p, --hop-size <SIZE>: Hop size (optional, default: half of FFT size)

Examples

  1. Generate spectrogram with default parameters:
AudioSpectrogram -i music.flac
  1. Specify output filename:
AudioSpectrogram -i music.flac -o spectrum.png
  1. Custom FFT parameters:
AudioSpectrogram -i music.flac -f 8192 -p 2048

Output Description

The generated spectrogram includes:

  • Vertical axis: Frequency scale (kHz)
  • Horizontal axis: Time scale (min:sec)
  • Right side: dB scale (-120dB to 0dB)
  • Color mapping: Using Turbo colormap, red indicates high intensity, blue indicates low intensity

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

πŸš€ A cross-platform tool (Windows/macOS/Linux) for generating spectrograms from audio files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /