I thought you had it set to fit a tempo map (i just tried it with as tempo change not map) but it's just using the tempo at the start point for whole item not following the varying tempo.
I'm not sure how you are inserting the media item sections so not sure the best way to solve the issue.
You have:
Main_OnCommand(42374, 0) -- Item properties: Set item rate from user-supplied source media tempo/bpm...
Main_OnCommand(42375, 0) -- Item properties: Set item timebase to beats (auto-stretch at tempo changes)
SetMediaItemInfo_Value( sel_item, "C_BEATATTACHMODE", 1 )
SetMediaItemInfo_Value( sel_item, "C_AUTOSTRETCH", 1 )
In the SGU import script:
below
function main2()
I have a function to stretch the item end to the track position:
function stretch_item_to_pos(xpos)
Open SGU in Reaper ![[Linked Image - Only viewable when logged in]](https://www.pgmusic.com/forums/ubbthreads.php?ubb=download&Number=26458&filename=VST6-Tempo-Map-Fit-Issue.png)