0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

librosaの基本処理

Last updated at Posted at 2021-01-02

librosaの基本処理

インポート

import librosa

データ読み込み

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

# yは振幅
# srはサンプリングレート

波形の描画

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

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

image.png

メルスペクトログラムの作成

y = librosa.feature.melspectrogram(y,n_mels=256)
# メル周波係数の計算

y = librosa.power_to_db(y).astype(np.float32)
# dB(デジベル、音圧)に変換

メルスペクトログラムの表示

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

ダウンロード.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?