|
|
|
05-19-2012, 08:12 AM
|
#1
|
Mobile
Join Date: Jan 2006
Location: London & São Paulo. Hardcore commercial REAPERite
Posts: 1,669
|
Adding a new tempo / time signature marker in Python
Ok - I give in!
Can anyone advise how to add Time Sig and/or tempo markers (with the optional 'gradual transition') in ReaScript?
For some reason this one has got me stuck!
Cheers!
__________________
Proudly using REAPER exclusively for...
* Media and event music composition & production, sound design + auto-processing at Qsonics.com
* Broadcast branding, promos, education & training and narration voice-overs at DrewWhite.com
|
|
|
05-21-2012, 12:04 PM
|
#2
|
Human being with feelings
Join Date: Feb 2012
Posts: 26
|
I would like to know the answer too! I am working on a C++ plugin and I need to add tempo markers. If there is a way to do in scripts, there should be a way to do in c++ too!
Quote:
Originally Posted by drew
Ok - I give in!
Can anyone advise how to add Time Sig and/or tempo markers (with the optional 'gradual transition') in ReaScript?
For some reason this one has got me stuck!
Cheers!
|
|
|
|
05-21-2012, 01:15 PM
|
#3
|
-blänk-
Join Date: Jun 2008
Posts: 11,359
|
Interesting. I could imagine an approach would be to edit the envelope state of the master track's tempo envelope. Here is what the WIKI sais how a tempo envelope state chunk looks like (look at the descriptions for the lines starting with "PT ..."
From the WIKI: http://wiki.cockos.com/wiki/index.ph...tEnvelopeState:
Code:
TEMPOENVEX
These are on the master track; they store tempo change information.
<TEMPOENVEX
ACT 1
VIS 1 0 1.000000
LANEHEIGHT 0 0
ARM 0
DEFSHAPE 1
PT 16.800000000000 100.0000000000 1 524294 // 1st value: location on timeline
// 2nd value: bpm
// 3rd value: If 1, square shape (no linear increase in tempo to next pt). if 0, increase
// tempo linearly to next tempo pt
// 4th value: time signature, first 3 digits are denominator, last 3 are numerator
// denom: 8388 = 128th, 4194 = 64th, 2097 = 32nd, 1048 = 16th,
524 = 8th, 262 = quarter, 131 = half, 65 = whole
// num: starts at different value for each denom, then increments as numerator increments
// In above order, starts from: 609; 305; 153; 577; 289; 145; 073; 537
PT 27.600000000000 140.0000000000 1 262148
>
I can't say I understand how exactly the 4th value of a PT line encodes the time sig from that description, but it should make sense with some thinking .
I also couldn't tell you how to get to the pointer of the tempo envelope or the master track in the first place, never tried to do any scripting towards the master track yet. I hope someone else has an idea, or there is a totally different approach altogether.
|
|
|
05-22-2012, 07:43 AM
|
#5
|
Human being with feelings
Join Date: Jun 2006
Posts: 1,167
|
Basically, all you do is this:
Code:
# Get Master track pointer:
trkptr = RPR_CSurf_TrackFromID(0,0)
# Get Envelope Pointer:
envptr = RPR_GetTrackEnvelopeByName( trkptr, 'Tempo map' )
# Get Envelope Data:
envstate = RPR_GetSetEnvelopeState(envptr, "", maxlen)
# Now do simple string manipulations to rebuild the envelope data
# Then update it like this:
RPR_GetSetEnvelopeState(envptr, NEWenvstate, maxlen)
RPR_UpdateTimeline()
I'd love to see what y'all come up with. I'm a tempo-map hound, apparently.
|
|
|
05-22-2012, 03:41 PM
|
#6
|
-blänk-
Join Date: Jun 2008
Posts: 11,359
|
Check out the latest pre
4.23pre11 has
+ API: added function to insert tempo/time signature changes
Might make some stuff way easier .
|
|
|
05-22-2012, 05:59 PM
|
#7
|
Mobile
Join Date: Jan 2006
Location: London & São Paulo. Hardcore commercial REAPERite
Posts: 1,669
|
Youn - that's a great help.. really going to enjoy using (and learning from) that script! Thanks so much.
gofer - that's amazing timing, isn't it?? It's almost as if someone is reading what people write :O
{thanks Cockos!}
__________________
Proudly using REAPER exclusively for...
* Media and event music composition & production, sound design + auto-processing at Qsonics.com
* Broadcast branding, promos, education & training and narration voice-overs at DrewWhite.com
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:35 AM.
|