Basic processing of librosa

Basic processing of librosa

import

import librosa

Data read

y,sr = librosa.load(file, sr=None)

#y is the amplitude
#sr is the sampling rate

Waveform drawing

fig, ax = plt.subplots(figsize = (16, 2))
fig.suptitle('Sound Waves', fontsize=16)

librosa.display.waveplot(y = y, color = "b")

image.png

Creating a mel spectrogram

y = librosa.feature.melspectrogram(y,n_mels=256)
#Calculation of Mel frequency coefficient

y = librosa.power_to_db(y).astype(np.float32)
# dB(Decibel, sound pressure)Conversion to

Display of mel spectrogram

plt.figure(figsize=(12, 4))
librosa.display.specshow(y)
plt.title('mel power spectrogram')
plt.colorbar(format='%02.0f dB')
plt.tight_layout()

ダウンロード.png

Recommended Posts

Basic processing of librosa
Basic operation of pandas
Basic usage of flask-classy
Basic operation of Pandas
Basic usage of SQLAlchemy
Basic knowledge of Python
Super basic usage of pytest
Basic usage of PySimple GUI
Parallel processing with Parallel of scikit-learn
Basic flow of anomaly detection
Post processing of python (NG)
XPath Basics (1) -Basic Concept of XPath
Basic usage of Pandas Summary
One-liner basic graph of HoloViews
Basic usage of Python f-string
Basic knowledge of Linux and basic commands
Summary of basic implementation by PyTorch
One-liner processing of quagmire memory (CSV)
About the basic type of Go
100 Language Processing Knock-59: Analysis of S-expressions
Basic grammar of Python3 system (dictionary)
About color halftone processing of images
Summary of multi-process processing of script language
Basic study of OpenCV with Python
Basics of binarized image processing with Python
[Linux] Review of frequently used basic commands 2
Answers and impressions of 100 language processing knocks-Part 1
SLICECAP: Split parallel processing of PCAP files
100 Language Processing Knock-91: Preparation of Analogy Data
100 Language Processing Knock-44: Visualization of Dependent Tree
(Java, JavaScript, Python) Comparison of string processing
Language processing 100 knocks-22: Extraction of category names
Answers and impressions of 100 language processing knocks-Part 2
100 Language Processing Knock-26: Removal of emphasized markup
Basic writing of various programming languages (self-memo)
Grayscale by matrix-Reinventor of Python image processing-
Basic usage of Btrfs on Arch Linux
Change processing by user input of dialog
Basic grammar of Python3 system (character string)
[Linux] Review of frequently used basic commands
Drawing with Matrix-Reinventor of Python Image Processing-
Python Basic Course (at the end of 15)
Basic level performance evaluation of programming languages
Example of efficient data processing with PANDAS
Status of each Python processing system in 2020
Matrix Convolution Filtering-Reinventor of Python Image Processing-