Where are you getting the "bpm" and "ppqn" values from, and is "BTime" floating-point or integer?

Btw, how far apart are BASSMIDI and your calculation?

BTime is float.

bpm I use follow code

CrrTempo = BASS_MIDI_StreamGetEvent(BASS_FX_TempoGetSource(chan), 0, MIDI_EVENT_TEMPO)

bpm = 60000000 / CrrTempo

and ppqn I get from the MIDI file by using this code

Open FileName For Binary As #1

TxtString = Space(LOF(1))

Get #1, , TxtString

Close #1

Dim isLyric As Boolean

isLyric = False

MidiType = Val("&H" & Hex(Asc(Mid(TxtString, 9, 1))) & Hex(Asc(Mid(TxtString, 10, 1))))

NrTracks = Val("&H" & Hex(Asc(Mid(TxtString, 11, 1))) & Hex(Asc(Mid(TxtString, 12, 1))))

k = InStr(1, TxtString, Chr(&HFF) & Chr(&H51))

If k <> 0 Then

n1 = Hex(Asc(Mid(TxtString, k + 3, 1)))

n2 = Hex(Asc(Mid(TxtString, k + 4, 1)))

n3 = Hex(Asc(Mid(TxtString, k + 5, 1)))

If Len(n1) = 1 Then n1 = "0" & n1

If Len(n2) = 1 Then n2 = "0" & n2

If Len(n3) = 1 Then n3 = "0" & n3

t1 = Hex(Asc(Mid(TxtString, 13, 1)))

t2 = Hex(Asc(Mid(TxtString, 14, 1)))

If Len(t1) = 1 Then t1 = "0" & t1

If Len(t2) = 1 Then t2 = "0" & t2

Timebase = CDec("&H" & t1 & t2) / 4

Resolution = CDec("&H" & t1 & t2)

bpm = Format(60000000 / CDec("&H" & n1 & n2 & n3), "0.00")

Quarter = (ppqn / Timebase) / 4000

End If

Here is the example of your tick and my tick. It not constant.

Your tick My tick

820 1963.647

1702 4294.664

2637 6764.91

4005 10359.372

4702 12187.555

**Ian may be I miss understand. The value that I calculate is MIDI delta time.**

How can I convert from tick position to delta time?