Convert WAV files to Mel spectrograms
Project description
wav2mel
Converts WAV audio [1] to Mel spectrograms for use in machine learning systems like Tacotron2.
This library contains portions of the copy-pasted code you see everywhere for WAV to Mel conversion.
[1] Or any audio format supported by librosa (which uses soundfile and audioread).
Installation
pip install wav2mel
Dependencies
- Python 3.6 or higher
- librosa, numpy, scipy, numba
Format
wav2mel
outputs numpy save data: one .npy
file each input file.
Usage
You can convert a single WAVE file from .wav
to a mel spectrogram (.npy
) as follows:
wav2mel < WAVE_FILE > NPY_FILE
Multiple WAVE files can also be converted and saved to a directory:
wav2mel --output-dir /path/to/mels WAVE_FILE [WAVE_FILE ...]
Each .npy
file will be named after the corresponding .wav
file.
See wav2mel --help
for more options (filter/hop/window length, sample rate, etc.).
With GNU Parallel
find /path/to/wavs -name '*.wav' -type f | parallel -X wav2mel --output-dir /path/to/mels
mel2wav (Griffin-Lim)
You can convert a mel spectrogram to WAV audio too using griffin-lim:
mel2wav < NPY_FILE > WAVE_FILE
or
mel2wav --output-dir /path/to/wavs NPY_FILE [NPY_FILE ...]
See mel2wav --help
for more options.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file wav2mel-0.3.0.tar.gz
.
File metadata
- Download URL: wav2mel-0.3.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | edcf5857d944fe455bfde33756fcb026206a30bf3763e6471fab78bcd76d2dd6 |
|
MD5 | 38e3a9b2f61791a6640671c8429171c4 |
|
BLAKE2b-256 | 2123662225310e6826c92fa013577c33f80c33dcb16075a197679e70cb6cbf3c |