drumscript.notation_generator.helpers.round_to_nearest_subdivision

round_to_nearest_subdivision(time_in_beats: float, subdivision: int) float[source]

Rounds a time value (in beats) to the nearest specified rhythmic subdivision.

Parameters:
  • time_in_beats (float) – Time in beats.

  • subdivision (int) – Subdivision grid (e.g., 16).

Returns:

Quantized time in beats.

Return type:

float