Music Analysis and Visualization

前端 未结 3 1198
一个人的身影
一个人的身影 2021-01-30 07:26

I\'m interested in programming a music visualizer in Python.

The first problem is how to get the information from the music? Like volume, frequency, rpm, etc. And from w

3条回答
  •  心在旅途
    2021-01-30 08:10

    Another tool for this is librosa. It offers Beat tracking to get bpm, in addition to default operations. According to the tutorial, for beat tracking:

    import librosa
    audio_path = librosa.util.example_audio_file()
    # or uncomment the line below and point it at your favorite song:
    # audio_path = '/path/to/your/favorite/song.mp3'
    y, sr = librosa.load(audio_path)
    y_percussive = librosa.effects.hpss(y)
    tempo, beats = librosa.beat.beat_track(y=y_percussive, sr=sr)
    

    As @dionyziz also said, the

    beats will be in frames. You can convert them to actual time using

    librosa.frames_to_time(beats)
    

    I have not tried this.

提交回复
热议问题