tinygroove

tinygroove is a small generator of house drum one-shots: kicks, claps, hats and percussion. The part that ships has 5.3M parameters and runs in a browser tab, where it makes a pack of sixteen drums in about a second. It was distilled from a large text-to-audio model, Stable Audio 3, and contains no samples.

Two bars, every hit generated by the model.

Parameters 5,258,163 (generator 4,238,992 + decoder 1,019,171)
Output 1 second, mono, 44.1 kHz
Drum types 16
Conditioning drum type; 172 prompt words (27 genres, 22 drum machines); decay, brightness, pitch
Teacher Stable Audio 3 small-sfx
Training data 48,741 one-second clips rendered by the teacher
Training 85 + 19 minutes on one H100
License MIT

Files

File Size Contents
onnx/flow.onnx 17.0 MB The generator: one denoising step. float32, opset 17
onnx/decoder.onnx 5.2 MB Sound code to waveform. float32, opset 17
tinygroove-flow.pt 17.0 MB Generator, PyTorch weights (best held-out EMA)
tinygroove-ae.pt 7.7 MB Autoencoder, PyTorch weights: the decoder plus the 0.74M encoder used in training
config.json Drum types, prompt words, latent scale, knob ranges
example.py Generation with numpy and onnxruntime only
samples/ The audio on this page

SHA256:

  • onnx/flow.onnx: 280de3ec7aef6d1087cad128881f75dfab661a13f50fb553a2287963d71041bd
  • onnx/decoder.onnx: d7d1e42a9a30a8a8d1adde73690929d48cd4ee4be1678f9bcfac588f0ed16a95
  • tinygroove-flow.pt: c800148e31b84579b2dd78df8c5b1484db6a21d39d572e11471293f197e9d3f3
  • tinygroove-ae.pt: 44fa16b7f01a1576ecde72886029e186887f041f02e7b61f37ba5c6e422fad68

Samples

Each row is one starting noise asked for in four genres, so the sounds along a row are related. Each genre also sets decay and brightness, as on the demo page.

classic Chicago house deep house tech house warehouse rave
Kick
Clap
Snare
Closed hat
Open hat
Rim
Conga
Crash

Usage

ONNX

pip install numpy onnxruntime
hf download totomanov/tinygroove --local-dir tinygroove
python tinygroove/example.py

example.py is one function:

from example import drum, save      # run from inside the downloaded folder

save("kick.wav", drum("kick", genre="deep house", decay=0.75, brightness=0.5))
save("hat.wav", drum("hat_closed", genre="tech house", machine="TR-909", seed=1))
Argument Default Meaning
category One of the 16 drum types in config.json
genre, machine none A genre or drum machine from tags in config.json, without its prefix
decay, brightness, pitch model decides 0 to 1, across what was normal for that drum in the training data
seed 0 The starting noise. The same seed with a different request gives a related sound
steps 16 Denoising steps
guidance 2.2 How strictly the request is followed

Drum types: bongo, clap, clave, conga, cowbell, crash, hat_closed, hat_open, kick, ride, rim, shaker, snap, snare, tambourine, tom.

The two graphs, if you write your own loop:

flow.onnx input Type Shape Meaning
x float32 [B, 32, 16] The sound code so far; starts as unit noise
t float32 [B] Progress, 0 (noise) to 1 (sound)
cat int64 [B] Drum type index; 16 means not given
tags int64 [B, 4] Prompt word indices; pad with 172
knobs float32 [B, 3] Decay, brightness, pitch in standardized units (see knob_range)
kmask float32 [B, 3] 1 where a knob is given, 0 where the model decides

It returns v [B, 32, 16], the direction to move in: x += v / steps. For guidance, run the request and an empty request together and use empty + guidance * (request - empty). decoder.onnx takes z [B, 32, 16], which is x * latent_scale clipped to -1..1, and returns wave [B, 44032]. The decoder can peak above 1.0, so scale before saving 16-bit audio. Both graphs match the PyTorch model to about 2e-5 and run in onnxruntime-web, on WebGPU or WebAssembly.

PyTorch

The model classes and the full pipeline are in the code repository; tinygroove-flow.pt and tinygroove-ae.pt are the files it reads as runs/flow_v1/flow.pt and runs/ae_v2/ae.pt.

Model

A sound is 32 tokens of 16 numbers. The tokens are spread unevenly over the second: about 3 ms each at the attack and about 100 ms each in the tail, because a drum's attack carries most of its character.

The decoder is a small transformer and convolution stack that predicts a complex spectrogram (magnitude and phase), turned into a waveform by one inverse STFT. It was trained as half of an autoencoder with a multi-resolution spectral loss weighted toward the attack, plus an adversarial loss.

The generator is a 5-block transformer (width 224) trained with flow matching to turn noise into a sound code. The drum type, the prompt words and the three knobs each steer it, and each can be left out: they were dropped at random in training, which also provides the empty request used for guidance.

Training data

A prompt grid over 16 drum types was rendered with Stable Audio 3 small-sfx: 50,004 clips of one second. Each prompt combined a drum type with words from a vocabulary of 221 candidates, each tested beforehand by rendering the same seed with and without the word; 172 survived. A gate removed clipped, silent and double-hit clips, leaving 48,741. Decay, brightness and pitch were measured on each clip and used as the knob labels.

Evaluation

On 64 generated sounds per drum type, asked for by type only:

Lands in the requested drum type 100% (judged by a classifier on the sound code)
Passes the training-data gate 93.3% (the teacher: 97.5%). Nearly all failures are clipping, which peak normalisation removes
Variety within a drum type 0.85 of the teacher's
Knob asked against knob measured correlation 0.96 decay, 0.996 brightness, 0.97 pitch
Nearest training sound as far as for held-out real sounds (median distance 10.2 against 11.1)

Limitations

  • The cowbells are not good.
  • Kicks carry less sub-bass than a real 808.
  • One second of mono; sixteen drum types; house and its neighbours only.
  • Prompt words are a fixed list, not free text.
  • The effect of individual prompt words has been checked by ear only, not measured.
Downloads last month
28
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support