﻿# Pop2Piano timing: generated MIDI tokens need the extracted beat grid

Preserve Pop2Piano beat metadata through MIDI decoding, and distinguish a generated piano arrangement from direct waveform generation or exact note transcription.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-pop2piano-beat-grid-midi-decoding/
Language: en

## Define the output task correctly

The [Pop2Piano paper](https://arxiv.org/abs/2211.00895) studies generating piano covers from pop audio. A generated arrangement is not the same task as transcribing every original instrument note exactly, and a MIDI arrangement is not itself a synthesized waveform. Make the desired output explicit before assessing a deployment. Musical plausibility, correspondence to the source, and the sound of a later piano renderer are related but different properties of the complete application result.

## Preserve rhythm preparation outputs

The [integration documentation](https://huggingface.co/docs/transformers/model_doc/pop2piano) describes extracting beat times and derived beat-step structures alongside the spectral model input. These rhythm outputs remain relevant after the transformer generates event identifiers. A wrapper that retains only spectral features and drops other processor fields may complete neural inference while losing information needed to place notes correctly in time. The preparation object is therefore more than a temporary tensor container that can be discarded once generation starts.

## Follow event tokens into MIDI time

The [tokenizer implementation](https://raw.githubusercontent.com/huggingface/transformers/main/src/transformers/models/pop2piano/tokenization_pop2piano.py) interprets note, velocity, time, and special-event token types and maps note positions through beat-step information when creating MIDI notes. Raw token positions are not directly seconds. Substituting a constant tempo without reproducing the intended mapping changes the arrangement's timing, even if every event identifier is valid. Preserve the source-specific rhythm metadata associated with each generated sequence, especially when processing multiple recordings in a batch.

## Diagnose a tempo-drift failure

Consider a source song whose tempo changes or whose rhythm extractor produces an unexpected grid. If generated notes drift against the source, inspect beat preparation and event-to-time conversion separately from note selection. Save the generated event sequence and the grid used to decode it. This separates a rhythm-mapping problem from an arrangement-quality issue. Listening to a rendered piano file alone can hide which stage introduced the mismatch, particularly when a renderer adds its own playback settings.

## Evaluate arrangement and rendering independently

Keep source preparation, beat metadata, checkpoint, event tokens, MIDI file, and optional synthesizer configuration in the record. Guides to [tensor axes](/journal/tensor-axes-batch-sequence-hidden/) and [inference evaluation](/journal/inference-benchmark-method/) support structured checks. Validate timing and note validity before judging the timbre of an external renderer. A complete Pop2Piano integration preserves symbolic musical meaning and source-aware timing rather than treating generated integers as ordinary text or handing them directly to an audio codec decoder.
