|
|
|
12-01-2020, 09:19 AM
|
#1
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
req: API:runAction(in the next 16th/8th/bar)
Originally title was: "req: API:reaper.GoToRegion( in the next 16th/8th/bar)"
Changed to current since it might be more widely useful.
we have this API:
reaper.GoToRegion(ReaProject proj, integer region_index, boolean use_timeline_order)
which does:
Seek to region after current region finishes playing (smooth seek).
request: A way that in this api we can just do the same but for Seek to region:
- in the next 16th note
- in the next 8th note
- in the next bar
- in the next two bars
- immediately
benefit: extra musical timing option for live performance, instead of the fixed region length
edit: after some discussion in this thread possibly would be a good alternative and more flexible if we could run an action following the same principle:
runAction(ActionID, "immediately")
runAction(ActionID, "in the next 16th note")
runAction(ActionID, "in the next 8th note")
runAction(ActionID, "in the next 4th")
runAction(ActionID, "in the next half note")
runAction(ActionID, "in the next bar")
runAction(ActionID, "in the next two bars")
possibly:
runAction(ActionID, "in the end of current region")
__________________
🙏🏻
Last edited by deeb; 01-13-2022 at 11:57 PM.
|
|
|
12-30-2020, 02:00 AM
|
#2
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Maybe not clear but this enables an Ableton live way of performing (without multiple starting play back positions) but still would be amazing to do performances and record on the fly without being constrained with fixed structures, since we could change to new section musically however we feel.
Would be amazing 2021 start like this.
__________________
🙏🏻
|
|
|
02-17-2021, 09:52 AM
|
#3
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
bump trigger! this is supper useful for live/djing/looper style coff coff for you too justin!
__________________
🙏🏻
|
|
|
02-20-2021, 05:40 AM
|
#4
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
Yeah this is doable. The only problem is that you can’t be more precise than 33ms so depending on you tempo, you may feel some changes.
Also 16th or 8ths are risky as you need enough triggering time for it to work.
|
|
|
02-20-2021, 07:03 AM
|
#5
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by lexaproductions
Yeah this is doable. The only problem is that you can’t be more precise than 33ms so depending on you tempo, you may feel some changes.
Also 16th or 8ths are risky as you need enough triggering time for it to work.
|
Thank you lexaproductions for your input!
if done natively it can’t be more precise than 33ms? you mean for fast triggering things that will quickly happen like 16th or 8ths?
Ableton has something similar to this i guess and is precise! missing tempo (even sligthly) is a no no no i think ...!
__________________
🙏🏻
|
|
|
02-20-2021, 07:21 AM
|
#6
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
Yeah. Reaper's internal smooth seek function is very tight. But as far as I know, it only works on regions and or bars. Don't think you can use it on eight and 16ths.
|
|
|
02-21-2021, 07:14 PM
|
#7
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
Try these and let me know if it works. Like I said, Only Region and Bar are very tight. The others are hit and miss... I still use the defer method for stuff that is non critical. Works great.
This is the example for Bar Smooth Seek. They're all the same script, only the "seek_mode" parameter changes for each seeking value.
Code:
--------------------------------------
----------|| HEADER ||----------------
--------------------------------------
--[[
* ReaScript Name: SmoothSeek.lua
* Description: Smooth seeking to edit cursor regardless of the Setting in the preferences->Seeking page
* Instructions: Make copies of this script and set the "seek_mode" parameter accordingly to what you want it to do.
* Author: Alex Paquette
* Licence: GPL v3
* Extensions Needed: SWS|S&M - JS_API
* Version: 1.0
--]]
-----------------------------------------------------------
---------|| INIT ||----------------------------------------
-----------------------------------------------------------
local reaper, gfx, string, table, math = reaper, gfx, string, table, math
---------|| parameter ||-----------------------------------
local padding = 0
local seek_mode = 1 -- Seek after target finishes --> 0:Region 1:Bar, 2:1/4, 3:1/8, 4:1/16, 5:1/3
-----------------------------------------------------------
---------|| FUNCTIONS ||-----------------------------------
-----------------------------------------------------------
function GetBoundaries(time, proj)
proj = proj or 0
local bar = {}
local _, msr = reaper.TimeMap2_timeToBeats(proj, time)
local beat_qn = reaper.TimeMap2_timeToQN(proj,time)
local curbeat_time = reaper.TimeMap2_QNToTime(proj,beat_qn)
bar.nextbeat = reaper.TimeMap2_QNToTime(proj,beat_qn+1)
bar.nexteight = ((bar.nextbeat - curbeat_time)/2)+curbeat_time
bar.nextsixteenth = ((bar.nextbeat - curbeat_time)/4)+curbeat_time
bar.nexttriplet = ((bar.nextbeat - curbeat_time)/3)+curbeat_time
return bar
end
---------------------------------------------
function Seek_Native(mode)
local targetTime = reaper.GetCursorPosition()
local currState = reaper.SNM_GetIntConfigVar('smoothseek', -1)
if mode == 0 then mode = 3 end
reaper.SNM_SetIntConfigVar('smoothseek', mode) -- Change the Smooth Seek Setting...
reaper.SetEditCurPos(targetTime, true, true)
reaper.SNM_SetIntConfigVar('smoothseek', currState) -- Put it back to what it was
end
---------------------------------------------
function Seek_WithDeferLoop(mode) -- 2:1/4, 3:1/8, 4:1/16, 5:1/3
local playpos = reaper.GetPlayPosition()
local infos = GetBoundaries(playpos+padding)
local timingAdjust = reaper.GetOutputLatency()+0.08
local division
if mode == 2 then division = infos.nextbeat
elseif mode == 3 then division = infos.nexteight
elseif mode == 4 then division = infos.nextsixteenth
elseif mode == 5 then division = infos.nexttriplet
end
local targetTime = division-playpos+reaper.time_precise()
local isClickMuted = false
-- Polling loop function
local function Loop()
if reaper.GetPlayState() == 0 then return end -- if stopped while running abort without doing anything.
local t = reaper.time_precise()
if t - targetTime+timingAdjust > 0.0001 then -- if arrived at target
reaper.OnPlayButton()
return
end
reaper.defer(function() Loop() end)
end
-- Call polling loop function
Loop()
end
-----------------------------------------------------------
---------|| RUN FUNCTION ||--------------------------------
-----------------------------------------------------------
local function run()
if reaper.GetPlayState() ~= 1 then return end
if seek_mode < 2 then
Seek_Native(seek_mode)
else
Seek_WithDeferLoop(seek_mode) -- to seek according to other values. Not very precise...
end
end
-----------------------------------------------------------
---------|| RUNTIME ||-------------------------------------
-----------------------------------------------------------
run()
reaper.defer(function() end)
|
|
|
02-22-2021, 07:03 AM
|
#8
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Uau! thank you so much ! i'll try it as soon as possible!
Also manny interesting stuff in here! Thank you!
__________________
🙏🏻
|
|
|
02-22-2021, 08:02 AM
|
#9
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
I still didn't spend much time understanding the script, so i am not sure what it is doing.
With 0 - region: seems smooth but sometimes a glitch on the one
with 1 - bar: seems smooth too but sometimes a glitch on the one
with 2 - seems like the math might be wrong (seems it's waiting literally 1 beat and then change, instead of changing on the next beat)
I still didn't took enough time looking on the code.
You are on mac?
__________________
🙏🏻
Last edited by deeb; 02-22-2021 at 10:12 AM.
|
|
|
02-22-2021, 07:59 PM
|
#10
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
I am on Mac yes.
The glitch on the one might come from the MEdia buffer size and the pre buffer % settings. I have a very old Macbook Pro 2012 with an old OS and it works great.
For the other ones, I think it is not accurate because of the defer refresh rate that is only 30Hz. But I might be wrong on that.
Last edited by lexaproductions; 02-22-2021 at 10:32 PM.
|
|
|
02-23-2021, 01:28 AM
|
#11
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
i am on mac too, catalina. With 30 ms was clearly better then 200!
this was my buffer settings:
this is the only buffer ("request block size") setting that i know. The other i will have to look - MEdia buffer size and the pre buffer % .
Which buffer size you experimented with?
I wonder if is possible to query this buffer size by API! maybe something could be done on the math!!
__________________
🙏🏻
|
|
|
05-05-2021, 09:57 PM
|
#12
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
b u m p !
__________________
🙏🏻
|
|
|
05-06-2021, 01:18 AM
|
#13
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
Try this:
Code:
--------------------------------------
----------|| HEADER ||----------------
--------------------------------------
--[[
* ReaScript Name: SmoothSeek.lua
* Description: Smooth seeking to edit cursor regardless of the Setting in the preferences->Seeking page
* Instructions: Make copies of this script and set the "seek_mode" parameter accordingly to what you want it to do.
* Author: Alex Paquette
* Licence: GPL v3
* Extensions Needed: SWS|S&M - JS_API
* Version: 1.0
--]]
-----------------------------------------------------------
---------|| INIT ||----------------------------------------
-----------------------------------------------------------
local reaper, gfx, string, table, math = reaper, gfx, string, table, math
---------|| parameter ||-----------------------------------
local padding = 0
local seek_mode = 3 -- Seek after target finishes --> 0:Region 1:Bar, 2:1/4, 3:1/8, 4:1/16, 5:1/3
-----------------------------------------------------------
---------|| FUNCTIONS ||-----------------------------------
-----------------------------------------------------------
function Truncate(number, decimals)
local output = 0
decimals = decimals or 0
local integer = math.floor(number)
local power = 10^decimals
local truncated = math.floor(number * power) / power
output = truncated
local diff = number - integer
if diff == 0 then output = integer end
return output
end
function GetBoundaries(time, proj)
proj = proj or 0
local bar = {}
local msr
_, msr, _,fullbeat = reaper.TimeMap2_timeToBeats(proj, time)
local curbeat_qn = Truncate(fullbeat)
local curbeat_time = reaper.TimeMap2_QNToTime(proj,curbeat_qn)
bar.fullbeat = curbeat_qn
bar.nextbeat_time = reaper.TimeMap2_QNToTime(proj,curbeat_qn+1)
bar.nexteight_time = ((bar.nextbeat_time - curbeat_time)/2)+curbeat_time
bar.nextsixteenth_time = ((bar.nextbeat_time - curbeat_time)/4)+curbeat_time
bar.nexttriplet_time = ((bar.nextbeat_time - curbeat_time)/3)+curbeat_time
return bar
end
---------------------------------------------
function Seek_Native(mode)
local targetTime = reaper.GetCursorPosition()
local currState = reaper.SNM_GetIntConfigVar('smoothseek', -1)
if mode == 0 then mode = 3 end
reaper.SNM_SetIntConfigVar('smoothseek', mode) -- Change the Smooth Seek Setting...
reaper.SetEditCurPos(targetTime, true, true)
reaper.SNM_SetIntConfigVar('smoothseek', currState) -- Put it back to what it was
end
---------------------------------------------
function Seek_WithDeferLoop(mode) -- 2:1/4, 3:1/8, 4:1/16, 5:1/3
local playpos = reaper.GetPlayPosition()
local infos = GetBoundaries(playpos+padding)
local timingAdjust = reaper.GetOutputLatency()+0.08
local division
if mode == 2 then division = infos.nextbeat_time
elseif mode == 3 then division = infos.nexteight_time
elseif mode == 4 then division = infos.nextsixteenth_time
elseif mode == 5 then division = infos.nexttriplet_time
end
local targetTime = division-playpos+reaper.time_precise()
local isClickMuted = false
-- Polling loop function
local function Loop()
if reaper.GetPlayState() == 0 then return end -- if stopped while running abort without doing anything.
local t = reaper.time_precise()
if t - targetTime+timingAdjust > 0.0001 then -- if arrived at target
reaper.OnPlayButton()
return
end
reaper.defer(function() Loop() end)
end
-- Call polling loop function
Loop()
end
-----------------------------------------------------------
---------|| RUN FUNCTION ||--------------------------------
-----------------------------------------------------------
local function run()
if reaper.GetPlayState() ~= 1 then return end
if seek_mode < 2 then
Seek_Native(seek_mode)
else
Seek_WithDeferLoop(seek_mode) -- to seek according to other values. Not very precise...
end
end
-----------------------------------------------------------
---------|| RUNTIME ||-------------------------------------
-----------------------------------------------------------
run()
reaper.defer(function() end)
|
|
|
05-06-2021, 09:06 AM
|
#14
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
thank you again lexaproductions and a lot! very interesting thing here!
I created a new project , loaded a loop and i was making a live by changing edit cursor! It's actually a very nice live feeling !
1st) i tried With 600 ms buffer and worked very nice seeking to next bar.
2nd) then i tried with:30 ms some times the audio stops and red starts appearing in the transport blinking like when buffer is not enough to process what is being requested
3rd) then same happened with 50 ms
4th) then i tried with: 60ms and audio didn't drop off but had small interferences/glitch on the transitions
I must tell that is impressive tho and a very nice live feeling! but maybe it is too much to ask for a script anything under 100 ms? probably with heavier project it will get worst. What is your experience?
__________________
🙏🏻
Last edited by deeb; 05-06-2021 at 09:31 AM.
|
|
|
05-06-2021, 04:14 PM
|
#15
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
I must be honest, I did not try this thoroughly.
For playback stuff, I only use the rock-solid native smooth seek with measures.
For various non time-critical stuff, I use this defer trick a lot.
I PRAY for Cockos to add a > run next action on next measure natively in the API somewhere, but this will do for now.
Glad you like it!
|
|
|
05-06-2021, 10:24 PM
|
#16
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by lexaproductions
I PRAY for Cockos to add a > run next action on next measure natively in the API somewhere, but this will do for now.
|
I trust you on this! actually i like the "Smooth seeking to edit cursor" concept more then my request, because it's more flexible for using in programming. Regions as i requested might be easier to be useful without programming anything. Having yours easily we have all.
But maybe your proposing/praying action would be enough and even more flexible
Run next action:
- immediately
- in the next 16th note
- in the next 8th note
- in the next 4th
- in the next half note
- in the next bar
- in the next two bars
Did they ever referred to this or is there any request for this?
Quote:
Originally Posted by lexaproductions
Glad you like it!
|
I really do ! I don't think i will be using it because it's unstable with the glitches and audio drop outs that i told, and i love the 30ms buffer! I Do love the concept and PRAY the same as you from now on!
__________________
🙏🏻
|
|
|
05-06-2021, 10:47 PM
|
#17
|
Human being with feelings
Join Date: Jan 2013
Posts: 1,126
|
I use these defer actions to close windows in sync with the tempo and to smooth seek into other songs. It works pretty well allows me to do clean Segways and stuff like that.
It's been pretty reliable through the years.
|
|
|
05-06-2021, 11:06 PM
|
#18
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by lexaproductions
I use these defer actions to close windows in sync with the tempo and to smooth seek into other songs. It works pretty well allows me to do clean Segways and stuff like that.
It's been pretty reliable through the years.
|
Interesting ! it seems a bit far from my reality ! At this point i would like to be able to do live recording or playing by setting new positions in the time line according to a musical measure.
For what i requested and the most flexible way to have it supported by reaper would be?:
Quote:
Originally Posted by deeb
Run next action:
- immediately
- in the next 16th note
- in the next 8th note
- in the next 4th
- in the next half note
- in the next bar
- in the next two bars
|
It would be enough and very flexible with custom actions / scripting, no?
example:
-- Script Pseudo Code --
Code:
function doSomething()
-- do Something Like Clean Up Next Region or whatever
end
function goToNextRegion()
-- move Play Cursor To Next Region
end
doSomething()
reaper.runAction(goToNextRegion, "bar")
Also you didn't answer to this "Did they ever referred to this or is there any request for this?"?
__________________
🙏🏻
Last edited by deeb; 05-06-2021 at 11:19 PM.
|
|
|
04-06-2022, 02:29 AM
|
#19
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
b u m p !
Live/Recording performance please !
__________________
🙏🏻
|
|
|
09-08-2022, 08:40 AM
|
#20
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Hope hope
__________________
🙏🏻
|
|
|
10-13-2022, 12:33 PM
|
#21
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Just a thought: you could use SWS's ActionMarker to make it precise.
You add the action marker in the bar of your choice which runs your action.
You remove it again right after it had been run.
Maybe this works a little better?
|
|
|
10-13-2022, 01:37 PM
|
#22
|
Human being with feelings
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
|
SWS marker actions are no more precise than a ReaScript: they share the same 30ms timer like reaper.defer.
|
|
|
10-16-2022, 01:09 AM
|
#23
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Thank you guys for the insights. It would be good if the latency was sincronized with audio buffer latency no?
@cockos: would it be possible? How beautiful stuff could be done for live stuff with this?
Clip launchers, live loopers, live performance and live recording systems.
@mesopotine: when I have time I’ll test that out. Thanks. I would like to actually work with 30 ms so maybe I could have some luck with it.
__________________
🙏🏻
|
|
|
11-12-2022, 03:46 PM
|
#24
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
|
Programming actions to be triggered seems very useful !!
|
|
|
11-12-2022, 10:04 PM
|
#25
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
|
I just think the api shouldnt use the grid but instead QN or Time in seconds, you can just get the value of the next Nth grid, so that would be much more flexible
|
|
|
11-13-2022, 03:32 AM
|
#26
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
In regards of the original request: this wouldn't be guaranteed. Even if you could set such an action, actions are run in the main-thread. That means, if another action is still running(due needing too long to finish up), it may block Reaper's main thread until long after the bar has been reached.
And I think, the 30/sec-problem also persists with such a feature.
You would need to let the action be run in the audio-thread instead, but this would be a bad idea altogether.
So I think, it's probably not possible, I think. From a Reaper-how it's designed-point of view.
Though it would be nice to have, imho.
|
|
|
06-11-2023, 11:20 PM
|
#27
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by Meo-Ada Mespotine
In regards of the original request: this wouldn't be guaranteed. Even if you could set such an action, actions are run in the main-thread. That means, if another action is still running(due needing too long to finish up), it may block Reaper's main thread until long after the bar has been reached.
And I think, the 30/sec-problem also persists with such a feature.
You would need to let the action be run in the audio-thread instead, but this would be a bad idea altogether.
So I think, it's probably not possible, I think. From a Reaper-how it's designed-point of view.
Though it would be nice to have, imho.
|
Ableton does the Original request made by me "req: API:reaper.GoToRegion(in the next 16th/8th/bar)". Reaper can also I think. Personally I am most interested is for recording and playing and transition between regions/markers live and accurate. Other actions would have their own independent thread which would not interfere with the accurate timing of the transitions.
Coff Coff : justin?
__________________
🙏🏻
Last edited by deeb; 06-11-2023 at 11:39 PM.
|
|
|
06-12-2023, 04:49 AM
|
#28
|
Human being with feelings
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
|
My ReaGoTo script may interest you https://youtu.be/mwXdwAlXXuU
But it have some nitpicks that I talk in this video https://youtu.be/KWM4EhEz8aY.
Most of the problems could be better handled if the smooth seek bugs ( https://forum.cockos.com/showthread.php?t=273432 ) were resolved
what this thread is asking is cool and I would like, but as Mespotine said this is probably not possible on the devs side/REAPER current development. So if correcting smooth seek bugs can be realistic I would adapt my scripts to work better with it.
Currently the main bugs with smooth seek that would vastly help in this topic is "Not triggering at the right moment", "breaking REAPER timeline loops", "smooth seek at marker being triggered at measures".
|
|
|
06-12-2023, 06:06 AM
|
#29
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,813
|
Quote:
Originally Posted by daniellumertz
My ReaGoTo script may interest you https://youtu.be/mwXdwAlXXuU
But it have some nitpicks that I talk in this video https://youtu.be/KWM4EhEz8aY.
Most of the problems could be better handled if the smooth seek bugs ( https://forum.cockos.com/showthread.php?t=273432 ) were resolved
what this thread is asking is cool and I would like, but as Mespotine said this is probably not possible on the devs side/REAPER current development. So if correcting smooth seek bugs can be realistic I would adapt my scripts to work better with it.
Currently the main bugs with smooth seek that would vastly help in this topic is "Not triggering at the right moment", "breaking REAPER timeline loops", "smooth seek at marker being triggered at measures".
|
thank you for your insights and efforts which are quite amazing. I don't know what ableton uses , but it works, that's why is so much used in live context. timeline is a an abstract thing which can be build on the fly somehow. current state of reaper does not allow for sure, but for sure they can do whatever they want to , if they want.
__________________
🙏🏻
|
|
|
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 05:32 AM.
|