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

librosa installation via pip failing

Python version is 3.4.2 (env) ishandutta2007@MacBook-Pro:~/Documents/Projects/my_proj$ pip install librosa Collecting librosa Collecting joblib>=0.12 (from librosa) Using cached …
ishandutta2007
  • 16,676
  • 16
  • 93
  • 129
3
votes
2 answers

Why spectrogram from librosa library have twice the time duration of the actual audio track?

I am using the following code to obtain Mel spectrogram from a recorded audio signal of about 30 s: spectrogram = librosa.feature.melspectrogram(y=self.RawSamples,sr=self.SamplingFrequency, n_mels=128, fmax=8000) if show: …
LiukPet
  • 93
  • 10
3
votes
1 answer

librosa load the sound file change its shape and file size

Let say I have sound file dog.wav as 32.0kb y, sr = librosa.load(os.path.join(train_data_path, label, fname)) librosa.output.write_wav('./input/train_test/'+label+'/AUG_'+fname,y,sr) I did nothing except just loading file and re-write it to…
kim code
  • 51
  • 5
3
votes
2 answers

Plotting audio from librosa in matplotlib

I am trying to plot the waveform of an audio file in Python. This is my code (I am using the Librosa library): import plot as plt def save_plot(filename): y, sr = librosa.load(filename) plt.plot(y, 'audio', 'time',…
pavlos163
  • 2,730
  • 4
  • 38
  • 82
3
votes
1 answer

Spectrograms generated using Librosa don't look consistent with Kaldi?

I generated spectrogram of a "seven" utterance using the "egs/tidigits" code from Kaldi, using 23 bins, 20kHz sampling rate, 25ms window, and 10ms shift. Spectrogram appears as below visualized via MATLAB imagesc function: I am experimenting with…
kashkar
  • 663
  • 1
  • 8
  • 22
2
votes
0 answers

loading pydub.AudioSegment into librosa using librosa.load

I have loaded and performed modifications to an audio clip using AudioSegment.from_mp3. I need to perform analysis on the clip and so I am attempting to load the file using librosa.load(). I know I could save the audio and then load it but it seems…
Lazzza
  • 21
  • 2
2
votes
2 answers

Correctly understanding amplitude of waveforms - in librosa or other libraries

I lack a background in acoustics, but need to work on a data-science project in acoustics. Please help me understand how to correctly interpret what amplitude of waveform represent, correctly set the metrics, and possibly set correct sampling rate…
user305883
  • 1,635
  • 2
  • 24
  • 48
2
votes
0 answers

ERROR: No .egg-info directory found in C:\Users\Shreya Gupta\AppData\Local\Temp\pip-pip-egg-info-uoj9me_o

Getting this error while installing librosa: ERROR: No .egg-info directory found in C:\Users\Shreya Gupta\AppData\Local\Temp\pip-pip-egg-info-uoj9me_o I have tried the following things: Upgrading the setup tools: pip install --upgrade setuptools…
Shreya Gupta
  • 97
  • 2
  • 8
2
votes
2 answers

Why is it showing 'guvectorize() missing 1 required positional argument: 'signature' ' for a package such as resampy

I was trying to import librosa which gave me multiple errors like the absence of audioread, resampy etc. I tried to install all these manually. It is still showing an error in…
Jahang
  • 31
  • 1
  • 2
2
votes
2 answers

Identifying the loudest part of an audio track and cropping (Librosa or torchaudio)

I've built a U-Net model to perform audio mixing of multitrack audio, for which I've used 20s clips of the audio tracks (converted into spectrograms) as input in training the model. However the training process is incredibly long, so I think it…
Brudalaxe
  • 191
  • 1
  • 8
2
votes
1 answer

How to display audio at the right side of matplotlib

The following code display the image and audio in the top-bottom style: Here is the test code: import librosa import matplotlib.pyplot as plt import IPython.display as ipd def plot_it(name, audio, sample_rate): plt.figure(figsize=(8, 1)) …
stackbiz
  • 1,136
  • 1
  • 5
  • 22
2
votes
1 answer

How can I count the number of people speaks in an audio file

I'm working on an audio project. My goal is to count the number of people who spokes in an audio file. We can consider that we already removed the noise from that audio.(for example, if there are two people talking in the audio the program can…
2
votes
0 answers

Inaccurate real-time audio FFT interpretation with Python

I'm trying to use Python to create a live music visualization. The libraries I'm using are SoundCard (for live audio capture) and Librosa (for short-time Fourier transform). However I suspect I'm not interpreting the audio data correctly. Looking at…
ghidra
  • 21
  • 3
2
votes
1 answer

torchaudio: Error opening '_sample_data\\steam.mp3': File contains data in an unknown format

I'm new to torch audio and i'm following the this tutorial step by step. I'm having a problem loading an mp3 audio using torchaudio.info(path). Here is my code: metadata = torchaudio.info(SAMPLE_MP3_PATH) print(metadata) Here is the error that i'm…
crispengari
  • 7,901
  • 7
  • 45
  • 53
2
votes
1 answer

Different sample rate SR for same wav file between librosa and tensorflow

I have one wav file which I resampled to 16.000 kHz with Audacity. Now I am trying to load the file with python with 2 different ways. import tensorflow as tf import librosa f = "path/to/wav/file/xxxx.wav" raw = tf.io.read_file(f) audio, sr =…
Tobi Lawful
  • 105
  • 1
  • 7