Skip to content

Sequences, streaming data, robotics, and scientific extensions · Entry index · SEQ009 · Model

MT3: Multi-Task Multitrack Music Transcription

A supervised sequence-to-sequence system transcribing polyphonic audio into symbolic note events across multiple instrument tracks.

Explained here Component demo, not a trained model CodeSplash's own run

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's own run
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review, but on a different version of the code. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

A supervised sequence-to-sequence system transcribing polyphonic audio into symbolic note events across multiple instrument tracks. A common event vocabulary permits joint training over datasets with different instrumentation. It predicts a structured musical representation; it is neither a sound synthesizer nor proof that a unique score generated a recording.

Question / hypotheses

Which instrument, pitch, onset, and offset events best explain an audio segment? Evaluate transcription correctness and consistency under a declared event-matching protocol. The model itself supplies no significance-test null hypothesis.

Architecture / computational structure

An audio encoder summarizes time-frequency features, while a Transformer-style decoder emits a unified symbolic event sequence. Instrument identifiers, pitch events, and timing information share the sequence representation. Event serialization and the handling of notes crossing segment boundaries are consequential parts of the computational system.

Assumptions

Audio and event labels must be synchronized, with compatible instrument and timing conventions. Training labels may omit expressive details or overlapping sources. Generalization depends on instrument, recording, style, polyphony, and annotation coverage; splitting overlapping excerpts from the same performance can strongly inflate accuracy.

Formula / computational definition

For audio features aa and target event sequence e1:Le_{1:L}, L=−∑j=1Llog⁡pθ(ej∣e<j,a)\mathcal L=-\sum_{j=1}^{L}\log p_\theta(e_j\mid e_{<j},a). An event sequence encodes timing changes and instrument/note state. Token likelihood is a training surrogate; note-level precision and recall require reconstructing events and matching their timing.

Parameters and notation

Learned parameters: acoustic encoder, autoregressive event decoder, input projections, and token embeddings. Hyperparameters: spectrogram settings, segment duration, event resolution, vocabulary conventions, model width/depth, and decoding strategy. Finer timing tokens increase sequence length and may increase decoding cost and timing ambiguity.

Fitting, fine-tuning, and adaptation

Fit with aligned audio/event supervision. For a new instrument corpus, align the event ontology first, then adapt embeddings/output layers and relevant encoder blocks using small learning rates and held-out performances. Monitor rare instruments and note offsets separately; a lower token loss can coexist with poorer reconstructed note continuity.

How to use and calibrate

Report onset-only and onset-plus-offset note metrics with explicit tolerances and instrument matching. Compare per-instrument and macro-averaged results, inspect short/overlapping notes, and test recordings outside the training timbres. If scoring significance, resample complete pieces or performers rather than correlated frames.

Example application

Transcribe a synthetic two-instrument recording and visualize the estimated piano rolls beside known note events, including a repeated note and overlapping sustained note.

Interpretation / pitfalls

Watch out

Python: use the authors’ MT3 code and documented feature/event pipeline. R: reticulate for model inference and native event scoring/plots. The paired example computes event-token cross-entropy only; it contains no acoustic encoder, trained transcriber, or guaranteed valid event decoder.

Python and R code examples (dependencies/validation)

Python uses NumPy and the shared mse helper when called; base R uses the shared helper when called. Validation: Python component executed; R companion reviewed, not executed. Scope: the specific component described above, not the full model or its training.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — synthetic mathematical component, not a full-model implementation

Shared setup for this chapter
import numpy as np

def mse(a,b):
    a,b=np.asarray(a),np.asarray(b)
    if a.shape!=b.shape or a.size==0:
        raise ValueError("MSE needs nonempty equal shapes")
    return float(np.mean((a-b)**2))
prob=np.array([[.7,.2,.1],[.1,.8,.1],[.2,.2,.6]]); target=np.array([0,1,2])
result=float(-np.log(prob[np.arange(3),target]).mean())
print(result)
R

Component demo, not a trained model — synthetic mathematical component, not a full-model implementation

Shared setup for this chapter
mse <- function(a,b) {
  stopifnot(length(a)>0L, identical(dim(a),dim(b)), length(a)==length(b))
  mean((a-b)^2)
}
prob <- rbind(c(.7,.2,.1),c(.1,.8,.1),c(.2,.2,.6)); target <- c(1L,2L,3L)
result <- -mean(log(prob[cbind(seq_len(3),target)]))
print(result)

Sources

From the CodeSplash reference, entry SEQ009.