NanoMaestro logo

NanoMaestro is a family of compact music-generation models designed to run continuously in real time on consumer CPUs. Choose NanoMaestro Light for the smallest download and fastest inference, or NanoMaestro Pro for greater musical capacity and consistency.

The model generates symbolic piano-note events, not audio. These events are rendered as piano sound by the playback system.

Try the web demo on Hugging Face Spaces. Inference runs entirely on your device through WebAssembly (WASM), allowing NanoMaestro to generate music directly on your device locally.

NanoMaestro music-generation pipeline

Model Classes

Model Parameters Embedding LSTM INT8 download Best for
NanoMaestro Light ~13.8M 128 2 x 1,024 hidden ~14 MB Fastest startup and broad device support
NanoMaestro Pro ~53.9M 256 2 x 2,048 hidden ~54 MB Higher musical quality and consistency

Download sizes refer to the dynamically quantized INT8 ONNX models. Each model must be used with its matching vocab.json; vocabulary token IDs are not interchangeable between releases.

Model Architecture

Both model classes are autoregressive event-token LSTMs with two recurrent layers, 0.1 dropout, and a linear vocabulary output head. Light uses a 128-dimensional embedding and 1,024 hidden units per layer. Pro expands these to a 256-dimensional embedding and 2,048 hidden units per layer. Both predict one musical event at a time while carrying their hidden and cell states forward for uninterrupted generation.

Training Pipeline

NanoMaestro Light was trained on approximately 496 million tokens from nearly 80,000 cleaned piano MIDI pieces. It used 256-token next-token-prediction windows with a rotating stride-16 offset.

NanoMaestro Pro was trained on approximately 2.52 billion tokens from 439,570 accepted pieces drawn from ARIA-MIDI Deduped, PDMX, GiantMIDI-Piano, ADL Piano MIDI, ASAP, and MAESTRO. Its piece-aware stateful pipeline carries recurrent state across consecutive 256-token chunks, balances piece lengths across training lanes, resets state at piece boundaries, and uses every target token in each epoch.

Both models use AdamW, cross-entropy loss, mixed-precision CUDA training, validation-loss checkpointing, ONNX export, and verified dynamic INT8 quantization.

Custom Event Tokenizer

MIDI timing is aligned to 64 positions per whole note, equivalent to 16 steps per quarter note, preserving rapid passages while regularizing small performance-timing variations. Each piece begins with boundary, tempo, and grid tokens; bar and position tokens place groups of notes in time; and every note is encoded as a pitch, duration, and one of eight velocity levels. Pitches are limited to the piano range of MIDI 21-108 and durations to 256 grid steps, retaining polyphony, dynamics, tempo, note lengths, and musical structure in a compact vocabulary.

Key Features

  • Real-time, continuous music generation
  • Runs locally on consumer CPUs
  • Fully client-side browser inference with WASM
  • Light and Pro model classes
  • Compact verified INT8 model downloads
  • Symbolic piano generation with real-time playback

Web Demo

Launch the NanoMaestro Realtime web demo. Inference runs locally in your browser.

The repository also contains the legacy v1 GrandMaestro Runtime Lab, a local technical demo for compound-event generation. It can benchmark the exported INT8 CPU model or the dedicated WebGPU streaming model and displays generation speed, latency percentiles, real-time headroom, buffer health, constraint repairs, and audio/runtime diagnostics. It is retained as a reference and is not compatible with the new GrandMaestro v2 tokenizer/model contract.

TODO

  • Release full local inference code
  • Release full training code
  • Release full tokenizer code
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Spaces using utkucoban/NanoMaestro-Realtime 2