Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 01-27-2022, 06:01 AM   #1
VladaK
Human being with feelings
 
Join Date: Jan 2022
Posts: 3
Default What is the real meaning of SOURCE BPM and how to set it in script?

Hi,
I have strat to use Reaper befor few days and I'm doing a script, which prepares fade in/out and tempo gradual transitions between media items to help me to make smooth transitions (image in the attachement). But I
- don't understand the relation between playback rate, source bpm and tempo/time signature.
- don't know, how to set the source bpm in the script

The core steps of the script are:
1. for the selected item media - find all items in any track, which overlaps the selected one.
2. set the fades in/out for the selected item (it depends on overlapped area and works with multiple overlapping and partial/complete overlapping)
3. ask user for the tempo of the selected item
4. set the source bpm of the selected item to the tempo (I havent found the function to set the source bpm yet, which I can use in the script).
5. set the selected item timebase to "Beats (auto-stretch at tempo changes)"
6. Add 4 tempo/time signatures markers:
beginning and end of the item = actual tempo
after fade in and before fade out = the tempo of the selected item

The internal time signatures and the source bpm are equal, so I suppose, the media plays in correct tempo. But it doesn't.
I have tryied to correct the tempo
- time/tempo signature for the whole item = 121 bpm
- source bpm = 121
- playback rate = 1
- different item timebase
But it seems, that the relation between source bpm and playback rate is different, than I suppose and I was not able to correct it.

I have found other solution for my script, but a little bit more complicated. But I would like to understand:
- What is the relation between source bpm, item playback rate and time/tempo marker?
- Is the source bpm a real value for the source bpm and its original length?
- Is there a function to set the source bpm?

Thank you for your answeres, ideas, questions!

Vlada
Attached Images
File Type: jpg reaper.jpg (48.1 KB, 50 views)

Last edited by VladaK; 01-27-2022 at 06:03 AM. Reason: add the attachment notification
VladaK is offline   Reply With Quote
Old 01-27-2022, 06:09 AM   #2
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,815
Default

The source BPM that is displayed when you set the playback rate in the item properties dialog is a calculation based on the item length, item playback rate, and project tempo envelope. When you input a new value, the item length and playback rate are adjusted based on the number. The source BPM doesn't persist as an attribute of the media item.
schwa is offline   Reply With Quote
Old 01-27-2022, 08:03 AM   #3
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

@Schwa: could you give us the math formula, or better expose it as a reascript function?

Something like:
CalculateTakePlayRateFromBPM( take, source_bpm )

Edit: This function does the job -> GetTempoMatchPlayRate
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 01-28-2022 at 08:32 AM.
amagalma is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.