Old 07-09-2020, 08:04 AM   #1
GameAudioRvlzzr
Human being with feelings
 
GameAudioRvlzzr's Avatar
 
Join Date: Apr 2016
Location: Stuttgart, Germany
Posts: 217
Default Master Playrate lower than 0.2?

Hi!

In Lua, i want to set the master playrate to say 0.05.
When i try, it seems it just gets set to 0.2 instead, as if this was the lowest value it could have.

However, i know it's possible to get Reaper to play slower, by double clicking the playrate knob and entering a lower value into the text field manually.

But i want to do that from script.
Anyone know how?
Thank you
Micha
GameAudioRvlzzr is offline   Reply With Quote
Old 07-09-2020, 03:23 PM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Code:
playrate=0.04

reaper.SNM_SetDoubleConfigVar("playrate", playrate)
sets the playrate to any playrate you want between 0.04 and 4.0, but it will not update the number displayed in the slider.

It could be set to 0.01 til 0.03 as well, but then you have weird sound while playback and preserve pitch is unchecked.

Edit: you can set it even faster than 4.0. I've tried 200. Interesting...
1200 seems to kill Reaper performancewise XD
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 07-09-2020 at 03:34 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-09-2020, 03:26 PM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

For completeness: you can also set the preserving pitch in audio items when changing master-rate-setting, which can be accessed via rightclick on the playrate-slider:


Preserve pitch:
Code:
reaper.SNM_SetIntConfigVar("audioprshift", 1)

Don't preserve pitch
Code:
reaper.SNM_SetIntConfigVar("audioprshift", 0)
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-09-2020, 05:44 PM   #4
tdc
Human being with feelings
 
Join Date: Oct 2019
Location: Sydney
Posts: 471
Default

Is it possible to have a negative playback value?

Its a great trick, to refresh your ears, to flip the tape on a multitrack machine over and listen to a mix backwards. The perceived balance of percussive vs sustained elements shifts dramatically and you can hear how the bulk of the track is sitting.
tdc is offline   Reply With Quote
Old 07-09-2020, 06:36 PM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Easiest answer, try it

Edit:
Doesn't work with the approach above, but you can try that one:

Quote:
-- Meo-Ada Mespotine - play project backwards
-- 10th of July 2020
-- licensed under MIT-license

Playrate=1 -- set this to the rate of your choice; 1 for normal playrate

Scrub=reaper.SNM_GetIntConfigVar("scrubmode", -999)
if Scrub&1==0 then reaper.SNM_SetIntConfigVar("scrubmode", Scrub+1) unscrub=true end

function PlayBackwards()
reaper.MoveEditCursor(-0.03*Playrate, false)
if reaper.GetCursorPosition()>0 then reaper.defer(PlayBackwards) end
end


function atexit()
if unscrub==true then
Scrub2=reaper.SNM_GetIntConfigVar("scrubmode", -999)
reaper.SNM_SetIntConfigVar("scrubmode", Scrub2-1)
end
end

reaper.atexit(atexit)

PlayBackwards()
It will use the scrub-mode-feature of Reaper and move the editcursor backwards and the scrubbing feature actually plays it.
Set the variable Playrate to the backward playrate of your choice; 1 for normal playrate.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 07-09-2020 at 07:02 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-10-2020, 05:05 AM   #6
tdc
Human being with feelings
 
Join Date: Oct 2019
Location: Sydney
Posts: 471
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Easiest answer, try it

Edit:
Doesn't work with the approach above, but you can try that one:
Way too funny!

How do I get this to become art of Reaper? I gather its LUA and I need to save it some where?
tdc is offline   Reply With Quote
Old 07-10-2020, 06:52 AM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Yes, create a new Lua-script in the actionlist, paste it in there, save it via Ctrl+S/Cmd+S and then you can use it as every other action.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-10-2020, 07:03 AM   #8
tdc
Human being with feelings
 
Join Date: Oct 2019
Location: Sydney
Posts: 471
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
Yes, create a new Lua-script in the actionlist, paste it in there, save it via Ctrl+S/Cmd+S and then you can use it as every other action.
Thanks - getting this error.
Code:
MPL_ReversePlayback.lua:7: attempt to call a nil value (field 'SNM_GetIntConfigVar')
tdc is offline   Reply With Quote
Old 07-10-2020, 07:13 AM   #9
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Do you have SWS installed?

http://sws-extension.org/download/pre-release/

(And the name of the script shouldn't start with mpl, as I'm not mpl )
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine 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 11:54 PM.


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