Questions tagged [librosa]

librosa is a python package for music and audio analysis.

Following are some of the features of librosa

  • Load audio input
  • Compute mel-spectrogram, MFCC, delta features, chroma
  • Invert mel-spectrogram, MFCC or chroma back to waveform
  • Locate beat events
  • Compute beat-synchronous features
  • Display features
  • Save beat tracker output to a CSV file

For detailed information and examples, visit the librosa documentation.

See also the official Github page.

750 questions
7
votes
1 answer

ParameterError : data must be floating-point (librosa)

Refernce : https://github.com/librosa/librosa/blob/master/examples/LibROSA%20demo.ipynb Code : import librosa S = librosa.feature.melspectrogram(samples, sr=sample_rate, n_mels=128) log_S = librosa.power_to_db(S,…
Ashok Lathwal
  • 359
  • 1
  • 4
  • 12
7
votes
2 answers

python librosa package - How can I extract audio from spectrum

In case of vocal separation using Librosa, the vocal and background music can be plotted separately but I want to extract the audio from vocal part and the spectrum of vocal part is located in a variable named 'S_foreground' (please visit the above…
Saha Reno
  • 71
  • 1
  • 2
7
votes
2 answers

How to compare audio on similarity in Python?

I am using Python based audio library librosa to analyze musical audio tracks on note onset events. With this information I am slicing those tracks into several smaller, very short pieces / slices - all based in the note onset events. Having those…
Simon Kemper
  • 635
  • 1
  • 7
  • 16
6
votes
3 answers

Getting the frequencies associated with STFT in Librosa

When using librosa.stft() to calculate a spectrogram, how does one get back the associated frequency values? I am not interested in generating an image as in librosa.display.specshow, but rather I want to have those values in hand. y, sr =…
rocksNwaves
  • 5,331
  • 4
  • 38
  • 77
6
votes
1 answer

What is the conceptual purpose of librosa.amplitude_to_db?

I'm using the librosa library to get and filter spectrograms from audio data. I mostly understand the math behind generating a spectrogram: Get signal window signal for each window compute Fourier transform Create matrix whose columns are the…
rocksNwaves
  • 5,331
  • 4
  • 38
  • 77
6
votes
2 answers

Librosa read MP3 audio from URL

I am trying to read Mp3 audio from URL using Librosa. I understand that Librosa first uses PySoundFile to load the audio and if that fails it then uses audioread. I have the following code so far: import librosa import io from…
Singhal2
  • 450
  • 7
  • 22
6
votes
5 answers

ModuleNotFoundError: No module named 'librosa'

Currently I am working on voice recognition where I wanted to use Librosa library. I install librosa with the command on ubuntu: conda install -c conda-forge librosa But when I run the code I got the following error: import librosa …
Wwe Cena
  • 112
  • 1
  • 1
  • 7
6
votes
2 answers

Librosa raised OSError('sndfile library not found') in Docker

I'm trying to write the Dockerfile for a small python web project and there is something wrong with the dependencies. I've been doing some search on the internet and it said that Librosa library requires libsndfile to work properly so I tried to…
dangquanghuy107
  • 141
  • 1
  • 6
6
votes
1 answer

Can I convert spectrograms generated with librosa back to audio?

I converted some audio files to spectrograms and saved them to files using the following code: import os from matplotlib import pyplot as plt import librosa import librosa.display import IPython.display as ipd audio_fpath =…
Ramon Griffo
  • 333
  • 5
  • 14
6
votes
4 answers

AttributeError: cffi library '(pyModulesPath)\_soundfile_data\libsndfile64bit.dll' has no function, constant or global variable named 'sf_wchar_open'

When I try to use anything that's related to the module librosa, I get an error: Traceback (most recent call last): File "C:\Users\User1\Documents\test3.py", line 36, in x, Fs = librosa.load(fn_mp3, sr=None) File "C:\Program…
SF12 Study
  • 375
  • 4
  • 18
6
votes
3 answers

Converting Audio files between Pydub and Librosa

I'm trying to open a AudioFile in Librosa. Trim it, and then modify it using pydub. This is my code: sound = AudioSegment.from_file(filePath) samples = sound.get_array_of_samples() arr = np.array(samples) print(type(arr)) print(arr) # then modify…
Igor Q.
  • 686
  • 10
  • 21
6
votes
1 answer

why my 8kHz wav file's mel feature extracted differently in sr = 16kHz and 44.1kHz

I'm currently extracting mel features from my baby cry sound dataset and the wav files' sampling rate is 8kHz, 16bit, mono and about 7 sec. Mel-Spectogram when sr = 16000 Mel-Spectogram when sr = 44100 But as you can see, whenever I extract…
valentineday
  • 69
  • 1
  • 7
6
votes
2 answers

RuntimeError: cannot cache function '__jaccard': no locator available for file '/usr/local/lib/python3.7/site-packages/librosa/util/matching.py'

I am dockerising the flask application on windows10 machine.I get the below error after the docker run RuntimeError: cannot cache function '__jaccard': no locator available for file…
sn1234
  • 103
  • 1
  • 8
6
votes
1 answer

Librosa's fft and Scipy's fft are different?

Both Librosa and Scipy have the fft function, however, they give me a different spectrogram output even with the same signal input. Scipy I am trying to get the spectrogram with the following code import numpy as np …
Raven Cheuk
  • 2,903
  • 4
  • 27
  • 54
5
votes
1 answer

Python methods to reduce "breaks" or pauses in processes that should continuous, specifically audio?

I am attempting to edit a song as the song is playing. So far, I have successfully created a flow that does almost what I desire. I will share how it works and the problem that brought me here for advice. I take in a song as an array, y, and sample…
1 2
3
49 50