Gin
Loading...
Searching...
No Matches
NoteDuration Class Reference

Musical note duration for tempo-synchronized timing. More...

#include <gin_noteduration.h>

Public Member Functions

 NoteDuration (const char *name="", float bars=0.0f, float note=0.0f)
const juce::String & getName () const
float toSeconds (juce::AudioPlayHead *playhead) const
float toSeconds (float bpm) const
float getBars ()
float getBeats ()

Static Public Member Functions

static const std::vector< NoteDuration > & getNoteDurations ()
static float toSeconds (juce::AudioPlayHead *playhead, float value)

Detailed Description

Musical note duration for tempo-synchronized timing.

NoteDuration represents musical time durations (whole notes, quarter notes, etc.) and provides conversion to seconds based on tempo from AudioPlayHead. This is useful for tempo-synced delays, LFOs, arpeggiators, and other time-based effects that need to follow the host DAW's tempo.

Key Features:

  • Standard musical note durations (whole, half, quarter, etc.)
  • Dotted and triplet variations
  • Tempo-synchronized conversion to seconds
  • Pre-defined list of common durations
  • Support for bars and beats

The class stores duration as bars and beats (quarter notes), then converts to seconds using the current tempo from the host's transport.

Usage:

// Get standard note durations
auto durations = NoteDuration::getNoteDurations();
// Contains: 1/64, 1/32, 1/16, 1/8, 1/4, 1/2, 1 bar, etc.
// Use with tempo sync
auto quarterNote = NoteDuration("1/4", 0.0f, 1.0f);
float seconds = quarterNote.toSeconds(audioPlayhead);
// At 120 BPM: returns 0.5 seconds
// For delay time
auto delayTime = NoteDuration::toSeconds(audioPlayhead, paramValue);
static const std::vector< NoteDuration > & getNoteDurations()
static float toSeconds(juce::AudioPlayHead *playhead, float value)
NoteDuration(const char *name="", float bars=0.0f, float note=0.0f)
See also
Parameter, StepLFO

Constructor & Destructor Documentation

◆ NoteDuration()

NoteDuration::NoteDuration ( const char * name = "",
float bars = 0.0f,
float note = 0.0f )

Member Function Documentation

◆ getNoteDurations()

const std::vector< NoteDuration > & NoteDuration::getNoteDurations ( )
static

◆ toSeconds() [1/3]

float NoteDuration::toSeconds ( juce::AudioPlayHead * playhead,
float value )
static

◆ getName()

const juce::String & NoteDuration::getName ( ) const

◆ toSeconds() [2/3]

float NoteDuration::toSeconds ( juce::AudioPlayHead * playhead) const

◆ toSeconds() [3/3]

float NoteDuration::toSeconds ( float bpm) const

◆ getBars()

float NoteDuration::getBars ( )

◆ getBeats()

float NoteDuration::getBeats ( )

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