SlideShare a Scribd company logo
1 of 24
Download to read offline
実信号マザーウェーブレット
  を用いたスネア音の検出
2020.06.26
@tommy_tomtoru
今回のモチベーション
もっとちゃんとスネアの音聞いた方が良いっすよ
ある日の練習
Profile
@tommy_tomtoru
鉄道屋 ⇨ WEB屋 ⇨ 音屋
今年4月から音を主に扱う会社で異常検知なぞやっとります
Career
23℃ってバンドやってます。
どこかでみかけたら聴いてくださいませ
Band
GitHub上の
https://github.com/tomtoru/rmw_for_snare_sound_detection
にソースをアップしています。
音源などはそちらで確認してください!
Basic Knowledge
フーリエ変換 :もとの波形を単純な波 (正弦波)の和に分解する
Basic Knowledge
フーリエ変換
フーリエ変換フーリエ逆変換
:もとの波形を単純な波 (正弦波)の和に分解する
Basic Knowledge
短時間フーリエ変換
任意の窓幅を設定し、もとの波形に対して窓をずらしながらフーリエ変換を行う
Basic Knowledge
短時間フーリエ変換
任意の窓幅を設定し、もとの波形に対して窓をずらしながらフーリエ変換を行う
周波数の時間変化を解析できる
Basic Knowledge
短時間フーリエ変換
任意の窓幅を設定し、もとの波形に対して窓をずらしながらフーリエ変換を行う
窓幅大 → 周波数の解析精度:高 時間軸の解析粒度:粗い
窓幅小 → 周波数の解析精度:低 時間軸の解析粒度:細かい
*上記に加え窓の移動幅も考慮する
周波数の時間変化を解析できる
窓幅 大
窓幅 小
Basic Knowledge
ウェーブレット変換
任意の波 = マザーウェーブレット
:もとの波形を任意の波の和に分解する
マザーウェーブレットの例
拡大縮小し様々な幅を持たせたマザーウェーブレットを
時間軸上でシフトさせながら元の信号と掛け合わせる
× スケール:大
スケール:小
スイープ音(10Hz~1000Hz)
etc..
Basic Knowledge
ウェーブレット変換
任意の波 = マザーウェーブレット
:もとの波形を任意の波の和に分解する
マザーウェーブレットの例
拡大縮小し様々な幅を持たせたマザーウェーブレットを
時間軸上でシフトさせながら元の信号と掛け合わせる
× スケール:大
スケール:小
高周波成分
低周波成分
スイープ音(10Hz~1000Hz)
etc..
Basic Knowledge
ウェーブレット変換 :もとの波形を任意の波の和に分解する
スカログラム
拡大縮小し様々な幅を持たせたマザーウェーブレットを
時間軸上でシフトさせながら元の信号と掛け合わせる
× スケール:大
スケール:小
高周波成分
低周波成分
スイープ音(10Hz~1000Hz)
本題
実信号マザーウェーブレット
Real Signal Mother Wavelet
Task
「実信号マザーウェーブレットおよびその異常信号検出への応用」
https://ci.nii.ac.jp/naid/130004236409
「実信号マザーウェーブレットを用いた人工内耳装用児の母音の検出と評価」
https://ci.nii.ac.jp/naid/130000070096
既往の研究
検出したい信号からマザーウェーブレットを構成 し、ウェーブレット変換を行うことで信号検出に活用できる
ドラムのスネア音からマザーウェーブレットを構成し、
楽曲の中でスネア音が鳴っている箇所を検出する
Construction
「実信号マザーウェーブレットおよびその異常信号検出への応用」で定義されている
“複素数実信号マザーウェーブレット”の構成手順に則って以下の操作を行う
【構築の手順】
1. 実信号から特徴的な部分を切り出す
2. 窓関数をかけて実数RMW    を得る
3.       となるように正規化する
4.    をフーリエ変換し周波数スペクトル   を得る
5. ヒルベルト変換を行う
6. 逆フーリエ変換を行って複素数CRMW        を得る
^
Construction
1. 実信号から特徴的な部分を切り出す
今回使うスネア音
スネア音(0.02~0.04 sec)
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import IPython.display as ipd
import librosa
fs = 44100
snare_data, sr = librosa.load('/data/snare.mp3', sr=fs)
start = int(0.02*fs)
end = int(0.04*fs)
cut_snare_data = snare_data[start:end]
fig, axs = plt.subplots(2, 1, figsize=(20, 8))
axs = axs.ravel()
xs = np.arange(0, len(cut_snare_data)) / fs
axs[0].plot(xs, cut_snare_data)
axs[1].specgram(cut_snare_data, Fs=fs)
fig.show()
ipd.Audio(cut_snare_data, rate=fs)
Construction
2. 窓関数をかけて実数 RMW    を得る
実信号、ハニング窓、RMW
han_win = np.hanning(len(cut_snare_data))
psi_r_t = cut_snare_data*han_win
fig, axs = plt.subplots(3, 1, figsize=(16, 12))
axs = axs.ravel()
xs = np.arange(0, len(data_han)) / fs
axs[0].plot(xs, cut_snare_data)
axs[1].plot(xs, han_win)
axs[2].plot(xs, psi_r_t)
fig.show()
ipd.Audio(data_han, rate=fs)
Construction
3. となるように正規化する
正規化前-正規化後
psi_r_t = psi_r_t * (1/np.sqrt(np.sum(psi_r_t**2)))
fig, axs = plt.subplots(2, 1, figsize=(16, 8))
axs = axs.ravel()
xs = np.arange(0, len(psi_r_t)) / fs
axs[0].plot(xs, psi_r_t)
fig.show()
Construction
4~6.フーリエ変換、ヒルベルト変換、フーリエ逆変換
psi_r_f = np.fft.fft(psi_r_t_norm)
N = len(psi_r_t_norm)
freq = np.fft.fftfreq(N, d=1/fs)
cond1_i = np.where(freq > 0)
cond2_i = np.where(freq == 0)
cond3_i = np.where(freq < 0)
psi_r_f_ = np.zeros(len(psi_r_f))
psi_r_f_[cond1_i] = 2*psi_r_f[cond1_i]
psi_r_f_[cond2_i] = psi_r_f[cond2_i]
psi_r_f_[cond3_i] = 0
crmw = np.fft.ifft(psi_r_f_)
fig, axs = plt.subplots(2, 2, figsize=(16, 20))
axs = axs.ravel()
xs = np.arange(0, len(crmw)) / fs
axs[0, 0].plot(freq, psi_r_f)
axs[1, 0].plot(freq, psi_r_f_)
axs[0, 1].plot(xs, crmw.real)
axs[1, 1].plot(xs, crmw.imag)
fig.show()
ヒルベルト変換前-後 CRMW 実数部-虚数部
【ヒルベルト変換】
Validation
自分のバンドの音源で検証
Validation
data, _ = librosa.load(‘data/my_band.wav’, sr=44100, offset=0, duration=5)
data_crmw = np.convlove(data, crmw, mode=’same’)**2
Validation
上から順に: 元信号、wavelet変換(30スケールの5番目)、 実信号ウェーブレット
Validation
上から順に: 元信号、wavelet変換(30スケールの5番目)、 実信号ウェーブレット
Summary
・ノイズ(他の楽器音)に対して割と頑健にスネアを検出できる
・連打時にうまく検出できない
 ▫スネアの鳴り方(叩き方)が微妙に変わっている?
   ▪自分のバンド音源のスネアをスローで聞くと
    確かに右手左手で鳴り方が微妙に違う様な気配はある
・スネアのチューニングやセッティングが違うものには当然ながら精度が落ちる
 →同論文で説明されている RMWの構築に複数の信号の平均を用いる手法 (A-RMW)が効果的かも
実信号ウェーブレットに対しての所感

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

実信号マザーウェーブレットを用いたスネア音の検出