Crates.io | fft-analyzer |
lib.rs | fft-analyzer |
version | 0.1.3 |
source | src |
created_at | 2024-11-18 10:27:43.78711 |
updated_at | 2024-11-21 02:27:22.993592 |
description | A Rust program that reads a .wav file, performs an FFT, and generates a PNG plot of the frequency spectrum. |
homepage | |
repository | |
max_upload_size | |
id | 1452074 |
size | 1,664,112 |
This Rust program reads a .wav audio file, performs a Fast Fourier Transform (FFT) on the audio data, and generates a .png plot of the frequency spectrum. The included audio file, waves.wav, is a recording of ocean waves, which is rich in diverse frequencies. The resulting FFT plot helps visualize the frequency content of the audio.
Reads .wav files and extracts audio samples. Performs FFT to analyze the frequency spectrum. Plots the magnitude of frequencies in decibels (dB) using the plotters crate. Saves the plot as an image (fft_output.png).
##Prerequisites To run this project, you'll need: Rust (latest stable version). If you don't have Rust installed, you can download it from rust-lang.org. The following Rust crates: hound for reading .wav files. rustfft for performing the FFT. plotters for generating plots.
Clone the repository and navigate into the project directory:
git clone <repository-url>
cd fft-analyzer
Install the required dependencies:
cargo build
Once the dependencies are installed, run the program using:
cargo run
The program will:
If you wish to analyze a different .wav file, replace the existing waves.wav file in the project directory with your own. Ensure that the new file has the same name (waves.wav) or modify the source code to use a different file name.
The Cargo.toml file includes the following dependencies:
[dependencies]
hound = "3.4"
rustfft = "6.1"
plotters = "0.3.1"
This project is licensed under the MIT License
Rust community and documentation Crate maintainers for hound, rustfft, and plotters
bensatlantik