tempo_net

Classes

TempoNet([n_mels, sample_rate, hop_length, ...])

Lightweight CNN that maps a raw waveform to a single BPM value.

class TempoNet(n_mels=128, sample_rate=22050, hop_length=512, dropout=0.3, n_outputs=1)[source]

Bases: Module

Lightweight CNN that maps a raw waveform to a single BPM value.

Internally applies a log-mel spectrogram transform before the CNN.

Input: (B, 1, T) Output: (B,)

Parameters:
  • n_mels (int) – Number of mel filterbanks.

  • sample_rate (int) – Audio sample rate, used to build the mel transform.

  • hop_length (int) – Hop length for the mel transform.

  • dropout (float) – Dropout probability in the regression head.

  • n_outputs (int) – Output dimension. 1 for scalar regression; > 1 for classification over tempo bins (returns logits without softmax).

forward(wav)[source]
Parameters:

wav (Tensor)

Return type:

Tensor