Skip to main content

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.

Metadata

Release files for wav2mel 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wav2mel 0.3.0
File Size Uploaded Provenance Actions
wav2mel-0.3.0.tar.gz 7.2 kB Without provenance Details for wav2mel-0.3.0.tar.gz

Release files / wav2mel-0.3.0.tar.gz

Download URL wav2mel-0.3.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
edcf5857d944fe455bfde33756fcb026206a30bf3763e6471fab78bcd76d2dd6
BLAKE2b-256 checksum
How to use checksums
2123662225310e6826c92fa013577c33f80c33dcb16075a197679e70cb6cbf3c
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for wav2mel 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page