Upgrade to Pro — share decks privately, control downloads, hide ads and more …

推しと始めるMIR

てーとく
February 13, 2020

 推しと始めるMIR

アイドルのファンになったことをきっかけに機械学習の分野の一つであるMIR(音楽情報検索)に入門したので、MIRについて紹介しつつ作ったものの話とかをゆるふわにしようと思います!

てーとく

February 13, 2020
Tweet

Other Decks in Programming

Transcript

  1. MIR

  2. import librosa >>> filepath = librosa.util.example_audio_file() >>> y, sr =

    librosa.load(filepath, offset=30, duration=5) >>> librosa.feature.mfcc(y=y, sr=sr) # MFCCͷऔಘ array([[ -5.229e+02, -4.944e+02, ..., -5.229e+02, -5.229e+02], [ 7.105e-15, 3.787e+01, ..., -7.105e-15, -7.105e-15], ..., [ 1.066e-14, -7.500e+00, ..., 1.421e-14, 1.421e-14], [ 3.109e-14, -5.058e+00, ..., 2.931e-14, 2.931e-14]])
  3. • Elias Pampalk et al., Proceedings of the ACM Multimedia

    2002 • ָۂྨࣅ౓Λࣗݾ૊৫ԽϚοϓ(SOM)Λ࢖ͬ ͯՄࢹԽ Content-based Organization and Visualization of Music Archives
  4. def minmax(pattern): return (pattern - pattern.min()) / (pattern.max() - pattern.min())

    # ࡶ def mathrock_index(pattern): pattern = pattern.sum(axis=0) pattern = minmax(pattern) * 100 pattern = np.diff(pattern) return np.percentile(pattern, q=90) def calc_lfp(filename): cent = CentSpectrum(win_length=2048, hop_length=512) D = librosa.amplitude_to_db(cent.proc(filename)) D_normalized = cent.normalize(D) lfp = LogarithmicFluctuationPattern(hop_length=256) return lfp.proc(D_normalized)
  5. { "danceability": 0.735, "energy": 0.578, "key": 5, "loudness": -11.84, "mode":

    0, "speechiness": 0.0461, "acousticness": 0.514, "instrumentalness": 0.0902, "liveness": 0.159, "valence": 0.624, "tempo": 98.002, "type": "audio_features", "id": "06AKEBrKUckW0KREUWRnvT", "uri": "spotify:track:06AKEBrKUckW0KREUWRnvT", "track_href": “https://api.spotify.com/v1/tracks/…", "analysis_url": “https://api.spotify.com/v1/audio-analysis/…”, "duration_ms": 255349, "time_signature": 4 }