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
2
votes
1 answer

Is my output of librosa MFCC correct? I think I get the wrong number of frames when using librosa MFCC

result=librosa.feature.mfcc(signal, 16000, n_mfcc=13, n_fft=2048, hop_length=400) result.shape() The signal is 1 second long with sampling rate of 16000, I compute 13 MFCC with 400 hop length. The output dimensions are (13,41). Why do I get 41…
Rasula
  • 47
  • 1
  • 5
2
votes
1 answer

How does librosa estimate tempo?

I've inputted artifically made music with 120 bpm into: y, sr = librosa.load(sys.argv[1]) tempo, beats = librosa.beat.beat_track(y,sr) print("Tempo 1:", tempo) first_beat_time, last_beat_time =…
ingwarus
  • 413
  • 2
  • 11
2
votes
1 answer

Not able to install librosa

I am not able to install librosa in Ubuntu 18.04. I have tried the following commands, all are failed. pip install librosa python3.8 -m pip install librosa sudo pip install librosa pip install -u librosa The below error I am getting: Failed…
David
  • 21
  • 1
  • 3
2
votes
0 answers

Create same mel-spectrogram on server (python) and client (javascript) with librosa/TensorFlow

I am currently working on a project where I need to create mel-spectrograms to classify WAV audio-files with a neuronal network. In order to have a valid input to train my network, I first have to convert these audio-files into a mel-spectrogram. To…
2
votes
1 answer

Average Amplitude (in dB) every second of audio file in Librosa

I want to get an average amplitude of the sound file for every second. For example the average amplitude of 0-1 sec,1-2 sec, and so on. I tried reducing the sample rate to 1 but the value drops to 0 in that case. import numpy as np import…
Lakshya Kumar
  • 65
  • 1
  • 8
2
votes
2 answers

audio file ds2 format to wav conversion in CentOS

I am trying to convert ds2 format audio file to wav in a python / c++ based solution. Basically, I want to read ds2 audio in Linux with any codec. I tried ffmpeg and pydub, but failed. Is there any other library or solution which can handle this…
ML85
  • 709
  • 7
  • 19
2
votes
1 answer

What are the components of the Mel mfcc

In looking at the output of this line of code: mfccs = librosa.feature.mfcc(y=librosa_audio, sr=librosa_sample_rate, n_mfcc=40) print("MFCC Shape = ", mfccs.shape) I get a response of MFCC Shape = (40,1876). What do these two numbers represent? I…
Joe
  • 357
  • 2
  • 10
  • 32
2
votes
1 answer

Remove offset in Sound Beeps Detection by librosa.onset.detect in Python

I am working on a sound to detect when the sound beep starts using librosa in Python. When I plot the detected time, it has some offset as shown with a red line in the figure. This offset changes if the interval between the beeps changes. Since I…
Masood Salik
  • 119
  • 1
  • 1
  • 10
2
votes
2 answers

Defference of wave.readframes() and librosa.load()

I am loading the wave file in both method wave.readframes() and librosa.load() import librosa import wave sample_wave = './data/mywave.wav' #open file and stft by librosa a, sr = librosa.load(sample_wave,sr=44100) print(len(a)) print(a) #open…
whitebear
  • 11,200
  • 24
  • 114
  • 237
2
votes
0 answers

Python beat interval tracking

Is there a way using Python to track the beat intervals of an instrument in a song? For example... 1+ 3+4. I have tried the following code... y, sr = librosa.load("Audio\sweetchild_guitar_intro.wav") onset_envelope =…
2
votes
0 answers

Possible to reconstruct audio only with spectrogram image?

So I'm creating some spectrograms with librosa to be saved as images, after which I intend to make modifications to the image directly (ie. add random noise, etc), then I would like to reconstruct the audio from that image. Anyway, some research led…
V Begha
  • 49
  • 1
2
votes
0 answers

How can I process OPUS format with Librosa?

I am trying to generate spectrograms by using Librosa. When I was working with the .wav format file it was working fine. But I changed the format to OPUS audio codec and tried to run the same file, it give me below error. X, sample_rate =…
adikh
  • 306
  • 2
  • 16
2
votes
2 answers

Audio signal split at word level boundary

I am working with audio file using webrtcvad and pydub. The split of any fragment is by silence of the sentence. Is there any way by which the split can be done at word level boundry condition? (after each spoken word)? If librosa/ffmpeg/pydub has…
ML85
  • 709
  • 7
  • 19
2
votes
1 answer

Time steps difference in spectrogram

I have an audio file of 10 seconds in length. If I generate the spectrogram using matplotlib, then I get a different number of timesteps as compared to the spectrogram generated by librosa. Here is the code: fs = 8000 nfft = 200 noverlap =…
enterML
  • 2,110
  • 4
  • 26
  • 38
2
votes
0 answers

The usage of Python Librosa package for audio - Remove human voice from background noise

I want to remove the human voice from the background noise. Does anyone know if it is possible using Librosa Python package? I am asking this because I saw the usage of librosa only to remove the vocals from accompanying instrumentation. Does it…
Edoardo
  • 657
  • 7
  • 24