tflibrosa
re-implementation of torch librosa for tensorflow. It is usefull if you want to compute Spectrogram on GPU for faster inference instead of using librosa.
Installation
pip install tflibrosa
Example
To do some inference on single sample, you can use python script in examples/ folder or use as follows:
import numpy as np
from tflibrosa import STFT, Spectrogram, LogmelFilterBank
import librosa
import tensorflow as tf
audio = np.random.uniform(0,1 ,(32000 * 5))
print(audio.shape)
sample_rate = 32000
n_fft = 2048
hop_size = 512
window = 'hann'
pad_mode = 'reflect'
mel_bins = 64
ref = 1.0
amin = 1e-10
fmin = 20
fmax = 16000
top_db = 80.0
center = True
dtype=None
spectrogram_extractor = Spectrogram(n_fft=n_fft, hop_length=hop_size,
win_length=n_fft, window=window, center=center, pad_mode=pad_mode,
freeze_parameters=True, dtype="float32")
# Logmel feature extractor
logmel_extractor = LogmelFilterBank(sr=sample_rate, n_fft=n_fft, is_log=True,
n_mels=mel_bins, fmin=fmin, fmax=fmax, ref=ref, amin=amin, top_db=top_db,
freeze_parameters=True, dtype="float32")
spectrogram = spectrogram_extractor(audio[None, :])
mel_spectrogram = logmel_extractor(spectrogram)
print(mel_spectrogram) # (batch size, num_channels, timestamps)
Acknowledgement
- librosa : https://librosa.org/doc/latest/index.html
- torchlibrosa : https://github.com/qiuqiangkong/torchlibrosa
Metadata
Release files for tflibrosa 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tflibrosa-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / tflibrosa-0.0.2-py3-none-any.whl
| Download URL | tflibrosa-0.0.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4739b19c3f3340e561e32a4b14e691fd8ef95fb01b7be98421672f64993cfe6
|
|
BLAKE2b-256 checksum How to use checksums |
f4e0a856218c836498b59d1f99c2fb0217cc49f45d5c850b5f4b27b636cbca96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.15
|
Security for tflibrosa 0.0.2
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.