BASS_ATTRIB_MIDI_PPQN attribute


The Pulses Per Quarter Note (or ticks per beat) value of a MIDI stream.

BASS_ChannelGetAttribute(
    HSTREAM handle,
    BASS_ATTRIB_MIDI_PPQN,
    float *ppqn
);

Parameters

handleThe MIDI stream handle.
ppqnThe PPQN value.

Remarks

This attribute is the number of ticks per beat. It is read-only except for MIDI streams created with BASS_MIDI_StreamCreate.

Example

Get the currnet position of a MIDI stream in beats.
float ppqn;
BASS_ChannelGetAttribute(handle, BASS_ATTRIB_MIDI_PPQN, &ppqn); // get PPQN value
QWORD tick = BASS_ChannelGetPosition(handle, BASS_POS_MIDI_TICK); // get tick position
DWORD beat = tick / ppqn; // translate it to beats

See also

BASS_ChannelGetAttribute