Skip to main content

Ultra-fast and very well fitted solo Piano music transformer

Project description

Monster Piano Transformer

Ultra-fast and very well fitted solo Piano music transformer

Monster-Piano-Logo


In the heart of a grand piano black and blue,  
A fuzzy monster with eyes of yellow hue,  
Its fingers dance upon the ivory keys,  
Weaving melodies that soothe and please.  

Musical notes float like leaves on breeze,  
Harmony fills the air with gentle ease,  
Each key stroke a word in a song unsung,  
A symphony of joy that sets the heart alight, free and light.  

The monster plays with such delight,  
Lost in the rhythm, lost in the light,  
Its fur a blur as it moves with grace,  
A pianist born from a whimsical place.  

Monster Piano, a title it bears,  
A fusion of art and melodic airs,  
Where creativity and music blend,  
In this magical concert that never ends.  

Let the monster's music fill the air,  
And wash away our every care,  
For in its song, we find repose,  
And in its rhythm, our spirits glow.

Install

pip install monsterpianotransformer

(Optional) FluidSynth for MIDI to Audio functinality

Ubuntu or Debian
sudo apt-get install fluidsynth
Windows (with Chocolatey)
choco install fluidsynth

Gradio app

# pip package includes a demo Gradio app without audio support

# Please refer to monsterpianotransformer/gradio/app_full.py
# for a full version with fluidsynth audio support

monsterpianotransformer-gradio

Quick-start use example

# Import Monster Piano Transformer as mpt
import monsterpianotransformer as mpt

# Load desired Monster Piano Transformer model
# There are several to choose from...
model = mpt.load_model()

# Get sample seed MIDI path
sample_midi_path = mpt.get_sample_midi_files()[6][1]

# Load seed MIDI
input_tokens = mpt.midi_to_tokens(sample_midi_path, model_with_velocity=False)

# Generate seed MIDI continuation
output_tokens = mpt.generate(model, input_tokens, 600, return_prime=True)

# Save output batch 0 to MIDI
mpt.tokens_to_midi(output_tokens[0], model_with_velocity=False)

Main features use examples

Long auto-continuation generation

# Import Monster Piano Transformer as mpt
import monsterpianotransformer as mpt

# Load desired Monster Piano Transformer model
# There are several to choose from...
model = mpt.load_model()

# Get sample seed MIDI path
sample_midi_path = mpt.get_sample_midi_files()[6][1]

# Load seed MIDI
input_tokens = mpt.midi_to_tokens(sample_midi_path, model_with_velocity=False)

# Generate long seed MIDI auto-continuation
output_tokens = mpt.generate_long(model, input_tokens, return_prime=True)

# Save output batch 0 to MIDI
mpt.tokens_to_midi(output_tokens[0], model_with_velocity=False)

Pitches inpainting

# Import Monster Piano Transformer as mpt
import monsterpianotransformer as mpt

# Load desired Monster Piano Transformer model
# There are several to choose from...
model = mpt.load_model()

# Get sample seed MIDI path
sample_midi_path = mpt.get_sample_midi_files()[6][1]

# Load seed MIDI
input_tokens = mpt.midi_to_tokens(sample_midi_path, model_with_velocity=False)

# Inpaint pitches
output_tokens = mpt.inpaint_pitches(model, input_tokens)

# Save output to MIDI
mpt.tokens_to_midi(output_tokens, model_with_velocity=False)

Simple velocities inpainting

# Import Monster Piano Transformer as mpt
import monsterpianotransformer as mpt

# Load desired Monster Piano Transformer model
# There are several to choose from...
model = mpt.load_model(model_name='with velocity - 3 epochs')

# Get sample seed MIDI path
sample_midi_path = mpt.get_sample_midi_files()[6][1]

# Load seed MIDI
input_tokens = mpt.midi_to_tokens(sample_midi_path, model_with_velocity=True)

# Inpaint velocities
output_tokens = mpt.inpaint_velocities_simple(model, input_tokens)

# Save output to MIDI
mpt.tokens_to_midi(output_tokens, model_with_velocity=True)

Seq2Seq velocities inpainting

# Import Monster Piano Transformer as mpt
import monsterpianotransformer as mpt

# Load desired Monster Piano Transformer model
# There are several to choose from...
model = mpt.load_model(model_name='velocity inpainting - 2 epochs')

# Get sample seed MIDI path
sample_midi_path = mpt.get_sample_midi_files()[6][1]

# Load seed MIDI
input_tokens = mpt.midi_to_tokens(sample_midi_path, model_with_velocity=True)

# Inpaint velocities
output_tokens = mpt.inpaint_velocities_seq2seq(model, input_tokens, verbose=True)

# Save output to MIDI
mpt.tokens_to_midi(output_tokens, model_with_velocity=True)

Timings inpainting

# Import Monster Piano Transformer as mpt
import monsterpianotransformer as mpt

# Load desired Monster Piano Transformer model
# There are several to choose from...
model = mpt.load_model('timings inpainting - 2 epochs')

# Get sample seed MIDI path
sample_midi_path = mpt.get_sample_midi_files()[6][1]

# Load seed MIDI
input_tokens = mpt.midi_to_tokens(sample_midi_path)

# Inpaint timings
output_tokens = mpt.inpaint_timings(model, input_tokens)

# Save output to MIDI
mpt.tokens_to_midi(output_tokens)

Bridge inpainting

# Import Monster Piano Transformer as mpt
import monsterpianotransformer as mpt

# Load desired Monster Piano Transformer model
# There are several to choose from...
model = mpt.load_model('bridge inpainting - 2 epochs')

# Get sample seed MIDI path
sample_midi_path = mpt.get_sample_midi_files()[11][1]

# Load seed MIDI
input_tokens = mpt.midi_to_tokens(sample_midi_path)

# Inpaint bridge
output_tokens = mpt.inpaint_bridge(model, input_tokens)

# Save output to MIDI
mpt.tokens_to_midi(output_tokens)

Single chord generation

# Import Monster Piano Transformer as mpt
import monsterpianotransformer as mpt

# Load desired Monster Piano Transformer model
# There are several to choose from...
model = mpt.load_model()

# Generate single chord
chord_tokens = mpt.generate_chord(model)

Project Los Angeles

Tegridy Code 2025

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monsterpianotransformer-25.1.66.tar.gz (735.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

monsterpianotransformer-25.1.66-py3-none-any.whl (746.7 kB view details)

Uploaded Python 3

File details

Details for the file monsterpianotransformer-25.1.66.tar.gz.

File metadata

File hashes

Hashes for monsterpianotransformer-25.1.66.tar.gz
Algorithm Hash digest
SHA256 f6ac4133d98171e9f8b1ab2a677f65079a74d1e624700d21f99c46dffc8ca994
MD5 3edb2f2a1d0874978ce8a04b0727395b
BLAKE2b-256 b81c3e9a1ed134da26a73f9d7a31fe39c65c2cda57835d8117a72205aa53b78d

See more details on using hashes here.

File details

Details for the file monsterpianotransformer-25.1.66-py3-none-any.whl.

File metadata

File hashes

Hashes for monsterpianotransformer-25.1.66-py3-none-any.whl
Algorithm Hash digest
SHA256 26ceaf52f5b06e456423d193b53c32fb74250761ec4017f494f5a4593e6b5612
MD5 053fd26d6a0a8ce2f04191236d2e2be3
BLAKE2b-256 bb00ade56e396d6c07e27bb445d279b5189f6e3831a250812455b453881c9cf9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page