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
5
votes
2 answers

Librosa cannot load from BytesIO

I am currently trying to create a large dataset for deep learning consisting of a lot of compressed mp3 files stored together so I dont have 100k files that I have to load individually. x = b'' with open("file1.mp3", "rb") as f: x +=…
Jonathan R
  • 3,652
  • 3
  • 22
  • 40
5
votes
1 answer

Understanding the shape of spectrograms and n_mels

I am going through these two librosa docs: melspectrogram and stft. I am working on datasets of audio of variable lengths, but I don't quite get the shapes. For example: (waveform, sample_rate) = librosa.load('audio_file') spectrogram =…
swe87
  • 129
  • 1
  • 3
  • 13
5
votes
3 answers

How can I turn off Numba DEBUG messages in a Python project?

I'm working on a Python project with the Librosa sound editing library, which makes use of Numba. Every time I call a Librosa function (in this case, pitch_shift), my PyCharm console window spits out literally thousands of lines of DEBUG messages,…
sdr
  • 51
  • 3
5
votes
2 answers

Split audio on timestamps librosa

I have an audio file and I want to split it every 2 seconds. Is there a way to do this with librosa? So if I had a 60 seconds file, I would split it into 30 two second files.
5
votes
1 answer

Sound feature attributeError: 'rmse'

In using librosa.feature.rmse for sound feature extraction, I have the following: import librosa import numpy as np wav_file = "C://TEM//tem//CantinaBand3.wav" y, sr = librosa.load(wav_file) chroma_stft = librosa.feature.chroma_stft(y=y,…
Mark K
  • 8,767
  • 14
  • 58
  • 118
5
votes
1 answer

Return value of librosa.effect.Split is strange

As titled, the result of this function is not logical and I don't understand what the function is doing. For example, here is some reproducible code: #load sample audio filename = librosa.util.example_audio_file() audio, sr =…
BarCodeReader
  • 327
  • 2
  • 12
5
votes
1 answer

Librosa: Cannot provide window function for mfcc on Windows

I'm currently experimenting with librosa to reproduce an scientific approach (deep learning) that used PRAAT to extract the MFCCs of audio files. I'm not that experienced with phonetics/acoustics and I had a lot of issues understanding PRAAT - so I…
Keanri
  • 96
  • 9
5
votes
1 answer

Librosa Constant Q Transform (CQT) contains defects at the beginning and ending of the spectrogram

Consider the following code import numpy as np import matplotlib.pyplot as plt from librosa import cqt s = np.linspace(0,1,44100) x = np.sin(2*np.pi*1000*s) fmin=500 cq_lib = cqt(x,sr=44100, fmin=fmin,…
Raven Cheuk
  • 2,903
  • 4
  • 27
  • 54
5
votes
1 answer

Librosa to get basic parameters of audio

In getting basic parameters of an audio file, by Wave: import wave data = wave.open('c:\\sample.wav', mode = 'rb') params = data.getparams() print params It returns: (1, 2, 4000, 160000, 'NONE', 'not compressed') That's for: nchannels=1,…
Mark K
  • 8,767
  • 14
  • 58
  • 118
5
votes
1 answer

pyaudio bytes data to librosa floating point time series

when audio is recording using pyaudio with paInt16, it gives me 16 bits integer represented as two bytes. With some studying, I concluded that it must be # between -32768 to 32767. I saved audio as wav file and load it back with librosa.core.load. I…
Brandon Lee
  • 695
  • 1
  • 10
  • 22
5
votes
2 answers

Can't import soundfile

I'm using Anaconda and I'm trying to import soundfile/pysoundfile. I installed the package by running conda install -c conda-forge pysoundfile and I think it succeeded because when I run conda list it shows up: pyopenssl …
J.D
  • 425
  • 4
  • 8
  • 19
5
votes
1 answer

MFCC and delta coeffients in 3 kinds of python libraries

I recently do my homework about MFCC, and I can't figure out some differences between using these libraries. The 3 libraries I use are: python_speech_features SpeechPy LibROSA samplerate = 16000 NFFT = 512 NCEPT = 13 1st Part: Mel filter…
Bill Sun
  • 51
  • 1
  • 3
5
votes
1 answer

Python | librosa: how to extract human voice from an audio wav file?

Given a wav file (mono 16KHz sampling rate) of an audio recording of a human talking, is there a way to extract just the voice, thereby filtering out most mechanical and background noise? I'm trying to use librosa package in Python 3.6 for this, but…
Oleg Melnikov
  • 3,080
  • 3
  • 34
  • 65
5
votes
5 answers

librosa can't open .wav created by librosa?

i'm trying to use librosa to generate some data by cutting 1s pieces from some .wav file with a duration of 60s. This part works, i create all my files and i can also listen to them via any player, but if i try to open them with librosa.load i…
Gionata Benelli
  • 357
  • 1
  • 3
  • 20
5
votes
5 answers

running librosa & numba on raspberry pi 3

I am trying to run librosa on my raspberry pi 3. After hours of searching through the internet I was finally able to install it but it still throws an error when I try to import it. First, I had problems to install the dependency llvmlite. I…
Ronja Jösch
  • 53
  • 1
  • 1
  • 4