|
1 | | -# AudioSpectrum |
| 1 | +# AudioSpectrogram |
| 2 | + |
| 3 | +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. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Cross-platform support (Windows, macOS, Linux) |
| 8 | +- Drag-and-drop support on Windows |
| 9 | +- Multiple audio format support: WAV, MP3, FLAC, OGG, AAC, etc. |
| 10 | +- High-quality spectrogram generation using Turbo colormap |
| 11 | +- Automatic multi-channel audio processing (mixed to mono) |
| 12 | +- Precise time and frequency scales |
| 13 | +- Complete dB scale display (-120dB to 0dB) |
| 14 | +- Customizable FFT size and hop size |
| 15 | + |
| 16 | +## Sample Spectrogram |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +This is a sample spectrogram generated using our tool, showing OneRepublic's "Apologize" (44.1kHz sampling rate). The spectrogram clearly demonstrates: |
| 21 | + |
| 22 | +- Full frequency range (0-22.05kHz) |
| 23 | +- Clear time axis markers |
| 24 | +- Precise frequency scaling |
| 25 | +- Rich dynamic range display (-120dB to 0dB) |
| 26 | + |
| 27 | +## Requirements |
| 28 | + |
| 29 | +- Rust toolchain (recommended installation via [rustup](https://rustup.rs/)) |
| 30 | +- Cargo (Rust package manager, included with Rust) |
| 31 | +- System requires at least one monospace font: |
| 32 | + - Windows: Consolas |
| 33 | + - macOS: Monaco |
| 34 | + - Linux: DejaVu Sans Mono |
| 35 | + |
| 36 | +## Building |
| 37 | + |
| 38 | +1. Clone the repository: |
| 39 | + |
| 40 | +```bash |
| 41 | +git clone https://github.com/lmshao/AudioSpectrogram.git |
| 42 | +cd AudioSpectrogram |
| 43 | +``` |
| 44 | + |
| 45 | +2. Build the project: |
| 46 | + |
| 47 | +```bash |
| 48 | +cargo build --release |
| 49 | +``` |
| 50 | + |
| 51 | +The executable will be available in the `target/release` directory. |
| 52 | + |
| 53 | +## Usage |
| 54 | + |
| 55 | +Basic usage: |
| 56 | + |
| 57 | +```bash |
| 58 | +AudioSpectrogram -i input.mp3 |
| 59 | +``` |
| 60 | + |
| 61 | +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. |
| 62 | + |
| 63 | +Alternatively, specify the file directly in the command line: |
| 64 | + |
| 65 | +```bash |
| 66 | +AudioSpectrogram input.mp3 |
| 67 | +``` |
| 68 | + |
| 69 | +### Command Line Arguments |
| 70 | + |
| 71 | +- `-i, --input <FILE>`: Input audio file path |
| 72 | +- `-o, --output <FILE>`: Output image path (optional, defaults to input filename with .png extension) |
| 73 | +- `-f, --fft-size <SIZE>`: FFT size (optional, default: 4096) |
| 74 | +- `-p, --hop-size <SIZE>`: Hop size (optional, default: half of FFT size) |
| 75 | + |
| 76 | +### Examples |
| 77 | + |
| 78 | +1. Generate spectrogram with default parameters: |
| 79 | + |
| 80 | +```bash |
| 81 | +AudioSpectrogram -i music.flac |
| 82 | +``` |
| 83 | + |
| 84 | +2. Specify output filename: |
| 85 | + |
| 86 | +```bash |
| 87 | +AudioSpectrogram -i music.flac -o spectrum.png |
| 88 | +``` |
| 89 | + |
| 90 | +3. Custom FFT parameters: |
| 91 | + |
| 92 | +```bash |
| 93 | +AudioSpectrogram -i music.flac -f 8192 -p 2048 |
| 94 | +``` |
| 95 | + |
| 96 | +### Output Description |
| 97 | + |
| 98 | +The generated spectrogram includes: |
| 99 | + |
| 100 | +- Vertical axis: Frequency scale (kHz) |
| 101 | +- Horizontal axis: Time scale (min:sec) |
| 102 | +- Right side: dB scale (-120dB to 0dB) |
| 103 | +- Color mapping: Using Turbo colormap, red indicates high intensity, blue indicates low intensity |
| 104 | + |
| 105 | +## License |
| 106 | + |
| 107 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
0 commit comments