GithubHelp home page GithubHelp logo

pychorus's Introduction

Pychorus

Pychorus is an open source library to find choruses or interesting sections in pieces of music. The algorithm is largely based on a paper by Masataka Goto with some simplifications and modifications. There is room for improvement so feel free to contribute to the project.

Check out my blog post: https://towardsdatascience.com/finding-choruses-in-songs-with-python-a925165f94a8 for a full explanation on how the library works

Getting Started

You can install the codebase easily with

pip install pychorus

Sample execution

The most straightforward way to use the module is as follows:

from pychorus import find_and_output_chorus

chorus_start_sec = find_and_output_chorus("path/to/audio_file", "path/to/output_file", clip_length)

You can also clone the repo and use main.py as a command line tool like

python main.py path/to/audio_file --output_file=path/to/output_file

Creating the chromogram, time-time, and time-lag matrices

from pychorus import create_chroma
from pychorus.similarity_matrix import TimeTimeSimilarityMatrix, TimeLagSimilarityMatrix

chroma, _, sr, _ = create_chroma("path/to/audio_file")
time_time_similarity = TimeTimeSimilarityMatrix(chroma, sr)
time_lag_similarity = TimeLagSimilarityMatrix(chroma, sr)

# Visualize the results
time_time_similarity.display()
time_lag_similarity.display()

Planned improvements for v0.2

  • Detect choruses in music recorded without a metronome by looking for slightly crooked lines
  • API to return all choruses, not just one with the most matches
  • Add ability to output entire detected chorus, not just section of size clip_length

License

This project is licensed under the MIT License - see the LICENSE.md file for details

pychorus's People

Contributors

vivjay30 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.