Skip to main content

Piano transcription inference

This toolbox is a piano transcription inference package that can be easily installed. Users can transcribe their favorite piano recordings to MIDI files after installation. To see how the piano transcription system is trained, please visit: https://github.com/bytedance/piano_transcription.

Demos

Here is a demo of our piano transcription system: https://www.youtube.com/watch?v=5U-WL0QvKCg

Installation

The piano transcription system is developed with Python 3.7 and PyTorch 1.4.0 (Should work with other versions, but not fully tested). Install PyTorch following https://pytorch.org/. Users should have ffmpeg installed to transcribe mp3 files.

pip install piano_transcription_inference

Installation is finished!

Usage

Want to try it out but don't want to install anything? We have set up a Google Colab.

python3 example.py --audio_path='resources/cut_liszt.mp3' --output_midi_path='cut_liszt.mid' --cuda

This will download the pretrained model from https://zenodo.org/record/4034264.

Users could also execute the inference code line by line:

import librosa
from piano_transcription_inference import PianoTranscription, sample_rate

# Load audio
audio, _ = librosa.load(path=audio_path, sr=sample_rate, mono=True)

# Transcriptor
transcriptor = PianoTranscription(device='cuda', checkpoint_path=None)  # device: 'cuda' | 'cpu'

# Transcribe and write out to MIDI file
transcribed_dict = transcriptor.transcribe(audio, 'cut_liszt.mid')

Visualization of piano transcription

Demo. Lang Lang: Franz Liszt - Love Dream (Liebestraum) [audio] [transcribed_midi]

FAQs

This repo support Linux and Mac. Windows has not been tested.

If users met "audio.exceptions.NoBackendError", then check if ffmpeg is installed.

If users met the problem of "Killed". This is caused by there are not sufficient memory.

Applications

We have built a large-scale classical piano MIDI dataset https://github.com/bytedance/GiantMIDI-Piano using our piano transcription system.

Cite

[1] High-resolution Piano Transcription with Pedals by Regressing Onsets and Offsets Times, [To appear], 2020

Metadata

Release files for piano-transcription-inference 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for piano-transcription-inference 0.0.6
File Size Uploaded
piano_transcription_inference-0.0.6.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for piano-transcription-inference 0.0.6
File Interpreter ABI Platform
piano_transcription_inference-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 28.9 kB

Release files / piano_transcription_inference-0.0.6.tar.gz

Download URL piano_transcription_inference-0.0.6.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b6dd00f9b4bcacb6140725f03b4139a5e0f4acd35a69e492a5d1f734ecfbd231
BLAKE2b-256 checksum
How to use checksums
15d88b2d1f2f9dba01c122686e2b7910ced8dfe14fc246099d44607c6fa460f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release files / piano_transcription_inference-0.0.6-py3-none-any.whl

Download URL piano_transcription_inference-0.0.6-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64348200b700a0ee792aa62386803fb2a638e378b3835b9a7ccff4701f0612f5
BLAKE2b-256 checksum
How to use checksums
a0642360ab1eecf4c01a6c5d1bfb308f08a196236a559bcc135ca203e6742a5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

1 release file

0.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page