Giter Club home page Giter Club logo

midi-internship's Introduction

Data-Science Internship @ Piano For AI: MIDI Analytics

MIDI

Don't worry if MIDI format is something strange to you. It is a very powerful protocol, and there are myriad things you can do with it. We are doing something very specific in relation to piano music. To get a better understanding about how to work with MIDI in this project, see MIDI.

MIDI Data

Here's a Hugging Face Dataset that should be used for algorithm development.

from datasets import load_dataset

dataset = load_dataset("roszcz/internship-midi-data-science", split="train")

This dataset contains sample data from the Piano For AI project. Each record in the dataset is a 1-2h recording of a practice session from various musicians.

Most of the tasks below require only the notes column, which for every record holds a list of events describing the pianists actions on the keyboard (which note was played, with what force/velocity, for how long, when).

To read this data into a pandas data frame:

import pandas as pd

record = dataset[0]
df = pd.DataFrame(record["notes"])
print(df.head())

To do this with our internal MIDI library:

import fortepyan as ff

record = dataset[137]
piece = ff.MidiPiece.from_huggingface(record)
print(piece.df.head())

Data Science Internship Challenge

Objectives

Difficulty level: easy

Speed

  1. For a given record, create a chart of time vs. speed.
    • If the record is longer than 120 seconds, use minutes as the time unit.
    • Use "notes played per second" as the speed unit.
  2. Create a chart showing the number of notes pressed at the same time. Experiment with different thresholds.

Chords

  1. For a given record, create a chart of time vs. the number of chords played.
  2. Based on chord detection developed for 1., crate a table with the number of occurances of chords.
    • Try to use chorder to assign names to detected notes.

Using solutions you developed, review this dataset: https://huggingface.co/datasets/roszcz/maestro-v1, and find:

  1. A piece with the fastest 15 seconds of music
  2. A piece where a single chord is repeated the most (each piece will have a different chord)

Difficulty level: medium

N-grams

See https://en.wikipedia.org/wiki/N-gram for theoretical background. Use only pitch for tokenization.

  1. For a given record, find the most popular 2-grams, 3-grams, and 4-grams.
    • Use 12 tokens corresponding to the 12 tones of an octave. Treat pitches an octave apart as the same token.
    • Use 88 tokens corresponding to the 88 keys of the piano.
  2. Find n-grams based on note distance instead of pitch
    • Note distance is the time between start for note a and the start of the next note b (it's not duration).
    • Experiment with different numbers of tokens used to quantize the note distance. Choose one value and make a case for it.

Difficulty level: hard

Sequence Similarity

  1. Given a sequence of notes, find similar sequences inside all available records. Sort by similarity.
    • Propose at least 2 different similarity metrics to compare sequences.

Solution presentation

Fork this repository to your account and work on your solutions there. When you are ready open a Pull Request to this repository. Use the Pull Request description to present the results. We will provide feedback and a code review in an iterative process - you can update your code after opening the PR as much as you need.

Here are some basic guidelines:

  1. Make your presentation clear.
  2. Use matplotlib to create charts.
  3. Write code that is PEP8 compliant, readable, and sparks joy.
  4. Join the Piano For AI discord channel to ask questions or discuss the project.
  5. Don't feel obliged to solve everything, even a single algorithm is enough to open a PR.
  6. Results from your presentation should be easy to reproduce with the code you are commiting.
  7. Do not commit matplotlib figures as files - instead, embed images within your Pull Request descriptions.

Development environment setup

Use python 3.9+

pip install -r requirements

Code Style

This repository uses pre-commit hooks with forced python formatting (black, flake8, and isort):

pip install pre-commit
pre-commit install

Whenever you execute git commit the files altered / added within the commit will be checked and corrected. black and isort can modify files locally - if that happens you have to git add them again. You might also be prompted to introduce some fixes manually.

To run the hooks against all files without running git commit:

pre-commit run --all-files

midi-internship's People

Contributors

roszcz avatar randat9 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.