Stretch/shrink the whole audio track so that the selected section lasts exactly n measures
Apologies if this problem has been solved—I did not find a solution on the forums or manuals, only very old discussions (2011 I believe) noticing that it could not be done. In one of these discussions, Robin linked to a video that showed how to solve the reverse problem—how to change the tempo track to match a live musician playing with varying tempi throughout the audio track. I’d like to do the opposite and keep the tempo track fixed while stretching/shrinking the audio.
If I understood the OP’s wish, Seablade’s solution stretches from the start and doesn’t do exactly what the OP wants.
You should :
Use the range tool to select the arbitrary range
In the Selection Clock Right click > switch to “samples” and write down the duration length (let’s call it d1)
Using the Grid and Snapping, precisely select the n measures and write down the duration length (d2). (Can also be computed with the session’s sample rate and number of BPM, see “PS” below)
In edition mode, right click the region > Name_of_the_region > Properties, write down the duration (d3)
Maths : d4 (= target duration) = d3 x d2/d1
Using the stretch tool, stretch to the precise value of d4, that can be entered manually in the window that appear when stretching (the clock can be set to samples by right clicking it)
Place a sync point at the beginning of the range by placing the playhead, selecting the region and hitting the “v” key (too bad stretching removes sync points ! we could have done it easier at the beggining)
move the region so that the sync point snaps to the bar you want.
Sounds terribly complicated, but it should be easy to do.
PS. in 4/4, d2 = nb of measures x (BPM/60) x sample rate
I think the Seablade’s way solves that request, if audio has constant tempo inside.
as I understood the imported audio contains varying tempo and if we want to match the global session tempo - we need the “warp audio tool” and stretch inside the region. As I know for that task we must make some marks on the audio (at the beginning of strong beats) and drag them to the main grid lines. Ardour has no such possibility today (again AFAIK). Actually as I understood it is about quantize audio to the main tempo grid.