IBeatTracker<T>

Interfaces · AiDotNet.Interfaces

Interface for beat tracking models that detect tempo and beat positions in audio.

Known implementations: MadmomBeatTracker<T>, Tempogram<T>

For Beginners

Beat tracking is like tapping your foot to music - finding the pulse.

How it works:

  1. Audio is analyzed for rhythmic events (drum hits, bass notes, etc.)
  2. Periodicity detection finds the most likely beat period
  3. Beat positions are refined to align with actual events

Common use cases:

  • Music tempo detection (“this song is 120 BPM”)
  • DJ software (beat matching between songs)
  • Music games (rhythm games like Guitar Hero)
  • Audio visualization (beat-synced lights)
  • Music production (quantizing to the beat)

Key concepts:

  • BPM (Beats Per Minute): The tempo or speed of the music
  • Downbeat: The first beat of a measure (often emphasized)
  • Beat phase: Where in the beat cycle we are

How It Works

Beat tracking analyzes audio to find the rhythmic pulse (beats) and estimate the tempo (beats per minute). This is fundamental to music information retrieval and enables beat-synchronized processing like auto-DJ mixing and rhythmic visualization.

Properties

Property Summary
double MaxBPM { get; } Gets the maximum detectable BPM.
double MinBPM { get; } Gets the minimum detectable BPM.
int SampleRate { get; } Gets the expected sample rate for input audio.

Methods

Method Summary
BeatTrackingResult<T> Track(Tensor<T> audio) Detects tempo and beat positions in audio.
DownbeatResult<T> DetectDownbeats(Tensor<T> audio, BeatTrackingResult<T> beatTrackingResult) Detects downbeat positions (first beat of each measure).
IReadOnlyList<TempoHypothesis<T>> GetTempoHypotheses(Tensor<T> audio, int numHypotheses) Gets multiple tempo hypotheses with confidence scores.
T EstimateTempo(Tensor<T> audio) Estimates tempo without detecting individual beat positions.
Task<BeatTrackingResult<T>> TrackAsync(Tensor<T> audio, CancellationToken cancellationToken) Detects tempo and beat positions asynchronously.
Tensor<T> ComputeOnsetStrength(Tensor<T> audio) Computes onset strength envelope for visualization or custom processing.