Old 02-13-2020, 11:36 AM   #1
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default script for show/ hide peaks in items ? interest ?

Would it be possible to write a script to toggle peak view in items ?
permeke is offline   Reply With Quote
Old 02-13-2020, 12:08 PM   #2
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

No script needed here. You can use Cycle action from SWS
Then through "step" put two action:

Peaks: Remove all peak cache files
----- Step -----
Peaks: Rebuild all peaks

This will work for all items.
Yanick is offline   Reply With Quote
Old 02-13-2020, 12:17 PM   #3
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

well yes it works but much slower than prefs >"display peaks for media items" which is logical as they need to be rebuild. Besides the midi notes in items are still visible.

So a script that toggles that pref would be needed I guess.
permeke is offline   Reply With Quote
Old 02-13-2020, 12:51 PM   #4
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Here try
PHP Code:
if reaper.SNM_GetIntConfigVar('showpeaks',0) == 19 then
  reaper
.SNM_SetIntConfigVar('showpeaks'18)
else
  
reaper.SNM_SetIntConfigVar('showpeaks'19)
end

  
reaper
.UpdateArrange() 
Yanick is offline   Reply With Quote
Old 02-13-2020, 12:59 PM   #5
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

hmm, the default configuration does not have the numbers that I have. It is probably more difficult here.
Yanick is offline   Reply With Quote
Old 02-13-2020, 01:01 PM   #6
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Another option
PHP Code:
if reaper.SNM_GetIntConfigVar('showpeaks'0) == 3 then
  reaper
.SNM_SetIntConfigVar('showpeaks'0)
else
  
reaper.SNM_SetIntConfigVar('showpeaks'3)
end

  
reaper
.UpdateArrange() 

Last edited by Yanick; 02-13-2020 at 01:08 PM.
Yanick is offline   Reply With Quote
Old 02-13-2020, 01:16 PM   #7
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

"showpeaks" seems to be a bitmasked value (I have values >= 512)...maybe this would work:
Code:
local showpeaks = reaper.SNM_GetIntConfigVar("showpeaks", -1)
local display_peaks = showpeaks&1 == 1
if display_peaks then
  reaper.SNM_SetIntConfigVar("showpeaks", showpeaks-1)
else
  reaper.SNM_SetIntConfigVar("showpeaks", showpeaks+1)
end
reaper.UpdateArrange()
spk77 is offline   Reply With Quote
Old 02-13-2020, 01:20 PM   #8
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Here the number in reaper.ini depends on the type of peaks. The spectrogram, normal, etc. Now I look more closely
Yanick is offline   Reply With Quote
Old 02-13-2020, 01:24 PM   #9
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Quote:
Originally Posted by spk77 View Post
"showpeaks" seems to be a bitmask (I have values >= 512)...maybe this would work:
Code:
local showpeaks = reaper.SNM_GetIntConfigVar("showpeaks", -1)
local display_peaks = showpeaks&1 == 1
if display_peaks then
  reaper.SNM_SetIntConfigVar("showpeaks", showpeaks-1)
else
  reaper.SNM_SetIntConfigVar("showpeaks", showpeaks+1)
end
reaper.UpdateArrange()
Oh, hi! I want to ask about your script
Script: spk77_Copy stretch markers from selected item to other items in group.eel
There you need to add the GetTakeStretchMarkerSlope function. But I do not really understand eel
Yanick is offline   Reply With Quote
Old 02-13-2020, 01:31 PM   #10
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Quote:
Originally Posted by spk77 View Post
"showpeaks" seems to be a bitmasked value (I have values >= 512)...maybe this would work
Yes, right! You are ahead of me
Yanick is offline   Reply With Quote
Old 02-13-2020, 01:34 PM   #11
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Yanick View Post
Oh, hi! I want to ask about your script
Script: spk77_Copy stretch markers from selected item to other items in group.eel
There you need to add the GetTakeStretchMarkerSlope function. But I do not really understand eel
Hi!
That's a really old script...I haven't done anything with EEL for a while, but I can take a look. (GetTakeStretchMarkerSlope is also new for me )
spk77 is offline   Reply With Quote
Old 02-13-2020, 01:39 PM   #12
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Quote:
Originally Posted by spk77 View Post
Hi!
That's a really old script...I haven't done anything with EEL for a while, but I can take a look. (GetTakeStretchMarkerSlope is also new for me )
I would be grateful It can be more accurately copy stretch markers
Yanick is offline   Reply With Quote
Old 02-13-2020, 02:05 PM   #13
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

Quote:
Originally Posted by Yanick View Post
Another option
PHP Code:
if reaper.SNM_GetIntConfigVar('showpeaks'0) == 3 then
  reaper
.SNM_SetIntConfigVar('showpeaks'0)
else
  
reaper.SNM_SetIntConfigVar('showpeaks'3)
end

  
reaper
.UpdateArrange() 

hey Yanick. Thanks for that but what now ? I'm a simple musician not a programmer.
Should I make a text file of this ? and what .xt to use ?

thanks
permeke is offline   Reply With Quote
Old 02-13-2020, 02:11 PM   #14
Yanick
Human being with feelings
 
Yanick's Avatar
 
Join Date: May 2018
Location: Moscow, Russia
Posts: 612
Default

Take the code from spk77
Then repeat as in the video
https://drive.google.com/file/d/1B7B...ew?usp=sharing
Yanick is offline   Reply With Quote
Old 02-13-2020, 02:21 PM   #15
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

hey ! , thank you both for that lightning fast support.
Will try that out .
permeke is offline   Reply With Quote
Old 02-13-2020, 02:56 PM   #16
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

It works !!!
Nice
permeke is offline   Reply With Quote
Old 02-14-2020, 12:40 AM   #17
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Here's another:

Toggle Display Peaks:
Code:
-- Toggle display peaks
 reaper.SNM_SetIntConfigVar("showpeaks", reaper.SNM_GetIntConfigVar("showpeaks", -666)~1) --Peaks bitwise NOT, flip bit
 
 reaper.UpdateArrange()
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 02-14-2020, 08:18 AM   #18
PelF
Human being with feelings
 
PelF's Avatar
 
Join Date: Mar 2013
Posts: 181
Default

What should I do to apply this script to only one selected item? Thank you very much..
PelF is offline   Reply With Quote
Old 02-14-2020, 09:12 AM   #19
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by PelF View Post
What should I do to apply this script to only one selected item? Thank you very much..
I don't think you can. The script is turning ON/OFF a "Display Peaks" checkbox buried in the preferences. It's a global checkbox. I don't know of (or think there is) a way to do it per item.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 02-14-2020, 09:21 AM   #20
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

Quote:
Originally Posted by PelF View Post
What should I do to apply this script to only one selected item? Thank you very much..
Why would you want it for just one item may I ask ?
permeke is offline   Reply With Quote
Old 02-14-2020, 10:25 AM   #21
PelF
Human being with feelings
 
PelF's Avatar
 
Join Date: Mar 2013
Posts: 181
Default

I use the "Set all selected video items to Ignore Audio" script from ReaPack, which turns off the audio in the video file. However, it cannot turn off display peaks. I would like to combine these two actions.
PelF is offline   Reply With Quote
Old 02-15-2020, 10:56 AM   #22
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by Thonex View Post
Here's another:

Toggle Display Peaks:
Code:
-- Toggle display peaks
 reaper.SNM_SetIntConfigVar("showpeaks", reaper.SNM_GetIntConfigVar("showpeaks", -666)~1) --Peaks bitwise NOT, flip bit
 
 reaper.UpdateArrange()
That's a better way to do it! I'm not good at manipulating bits
spk77 is offline   Reply With Quote
Old 02-15-2020, 11:58 AM   #23
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by Thonex View Post
Here's another:

Toggle Display Peaks:
Code:
-- Toggle display peaks
 reaper.SNM_SetIntConfigVar("showpeaks", reaper.SNM_GetIntConfigVar("showpeaks", -666)~1) --Peaks bitwise NOT, flip bit
 
 reaper.UpdateArrange()
Is it possible to toggle spectral peaks for selected item ?
todoublez is offline   Reply With Quote
Old 02-15-2020, 04:16 PM   #24
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by todoublez View Post
Is it possible to toggle spectral peaks for selected item ?
I don’t think so. See my post 5 posts above.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 02-16-2020, 08:11 AM   #25
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by Thonex View Post
I don’t think so. See my post 5 posts above.
:/ i see, thx for the info !
todoublez is offline   Reply With Quote
Old 05-21-2022, 10:17 AM   #26
vsgrt
Human being with feelings
 
Join Date: May 2017
Posts: 186
Default

Thanks a lot for this! Toggling peaks with a button is great.
vsgrt 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 07:26 AM.


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