Loading...
Searching...
No Matches

Detailed Description

Beat Tracker: listens to an audio input (a mic on a drummer, a click, a DJ feed) and produces a clock: tempo, beat phase, beat/downbeat pulses and a confidence signal, shaped to drive the timeline's tempo, Speed and position.

Classes

struct  ins
 
struct  ui
 

Public Types

enum class  clock_filter { dll_2nd_order , dll_3rd_order }
 
enum class  source_mode { audio , events , audio_and_events }
 
using band_mode = btrk::spectral_flux_odf::band_mode
 
using tick = halp::tick_flicks
 

Public Member Functions

 halp_meta (name, "Beat Tracker") halp_meta(author
 
ossia team halp_meta (c_name, "avnd_beat_tracker") halp_meta(category
 
ossia team Timing Audio halp_meta (description, "Audio beat tracker / tempo follower: onset detection, tempo " "estimation and a phase-locked clock with confidence monitoring.") halp_meta(manual_url
 
void prepare (halp::setup s)
 
void apply_bpm_range ()
 
void reconfigure_if_needed ()
 
void on_tap ()
 
void on_resync ()
 
void on_nudge (int direction)
 
void on_octave (double factor)
 
void seed_estimator_from_period (double period_seconds)
 
void operator() (halp::tick_flicks tk)
 
void handle_transport_hint (const halp::tick_flicks &tk)
 
void on_odf_frame (double odf_v, int64_t end_sample, double rate, double block_start, int frames)
 
std::pair< double, double > period_bounds () const
 
double event_hang () const
 
void process_events (double rate, double block_start, int frames)
 
void emit_beats (double rate, double block_start, int frames)
 
void update_outputs (const halp::tick_flicks &tk, double block_dt)
 

Public Attributes

ossia team Timing Audio https: halp_meta(uuid
 
struct avnd_tools::BeatTracker::ins inputs
 
struct { 
 
      tempo 
 
      speed 
 
      phase 
 
      bar_phase 
 
      beat_index 
 
      next_beat 
 
      confidence 
 
      false 
 
      beat 
 
      downbeat 
 
      onset 
 
outputs 
 
btrk::spectral_flux_odf m_odf
 
btrk::tempo_estimator m_est
 
btrk::cumulative_tracker m_ct
 
btrk::beat_dll m_dll
 
btrk::confidence_monitor m_mon
 
btrk::tap_tempo m_tap
 
ossia::moving_average_filter< double, 16 > m_detrend
 
ossia::one_pole_filter< double > m_tempo_display
 
std::vector< float > m_mono
 
double m_rate {}
 
int64_t m_samples {}
 
double m_now {}
 
double m_odf_hist [3] {}
 
int m_odf_hist_n {}
 
int64_t m_last_onset_frame {-1000}
 
double m_silence_time {1e9}
 
bool m_gate_open {false}
 
btrk::event_estimator m_ev
 
double m_last_event_time {-1e9}
 
int m_cfg_source {-1}
 
double m_elevated_until {-1.}
 
int m_locked_count {}
 
bool m_is_locked {}
 
double m_tempo_hist [tempo_hist_n] {}
 
int m_tempo_hist_pos {}
 
int m_tempo_hist_len {}
 
double m_tempo_accum_t {}
 
double m_tempo_rel_sd {1.}
 
bool m_seeded {}
 
double m_prev_transport_tempo {-1.}
 
double m_last_emitted_tempo {-1.}
 
int64_t m_downbeat_origin {}
 
int64_t m_last_emitted_beat {-1}
 
double m_speed_trim {}
 
float m_cfg_min_bpm {-1.f}
 
float m_cfg_max_bpm {-1.f}
 
bool m_cfg_limit {true}
 
int m_cfg_band {-1}
 
halp::setup setup
 

Static Public Attributes

static constexpr int tempo_hist_n = 64
 
static constexpr double sync_adjustment_cap = 0.05
 
static constexpr double sync_delta_cap = 0.02
 
static constexpr double sync_error_deadband = 0.01
 
static constexpr double sync_p_gain = 0.7
 

Member Enumeration Documentation

◆ source_mode

Where beat evidence comes from. In Events mode the onset detector and the whole audio chain are bypassed: the estimator and the DLL do not care whether a beat time came from spectral flux or from an OSC message.

Member Function Documentation

◆ event_hang()

double avnd_tools::BeatTracker::event_hang ( ) const
inline

How long an event source may stay silent before it counts as lost. Must exceed the longest plausible gap between messages, otherwise a slow event rate would drop out between its own beats.

◆ period_bounds()

std::pair< double, double > avnd_tools::BeatTracker::period_bounds ( ) const
inline

The user BPM range as beat periods, matching what reconfigure_if_needed hands the audio estimator. "Limit BPM range" off widens to 40-240 rather than removing the bound entirely: without any bound a single spurious interval can pull the estimate anywhere.

◆ process_events()

void avnd_tools::BeatTracker::process_events ( double  rate,
double  block_start,
int  frames 
)
inline

Drive the clock straight from discrete events. Each trigger is a beat (or a subdivision of one); the DLL is told the beat time and folds the phase error itself, exactly as it does for an audio-derived beat.


The documentation for this struct was generated from the following file: