|
|
|
06-14-2016, 08:06 AM
|
#1
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Lua: Save VST Preset to preset.ini file
Save preset for last touched VST or JS.
The script saves the FX current state as a preset with a new name to a fx-preset.ini file
====
====
Save_FX_Preset
Last edited by eugen2777; 06-24-2016 at 03:59 PM.
Reason: Update
|
|
|
06-14-2016, 10:45 AM
|
#2
|
Human being with feelings
Join Date: Nov 2015
Location: Germany
Posts: 1,015
|
eugen, you're so cool!! Thanks
|
|
|
06-15-2016, 04:22 PM
|
#3
|
Human being with feelings
Join Date: Mar 2013
Posts: 515
|
This is great!! I was thinking about trying to write something like this a few weeks ago but no time. My idea was to convert internal VST presets into reaper presets with one click.
Very nice!!!
Thanks eugen.
__________________
"After silence, that which comes nearest to expressing the inexpressible is music", Aldous Huxley
|
|
|
06-17-2016, 06:16 PM
|
#4
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Decoding function is fully updated, now it works 7-8 times faster, very fast.
The rest of the script will be updated later
|
|
|
06-24-2016, 07:58 AM
|
#5
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Some updates.
JSFX support added.
Last edited by eugen2777; 06-24-2016 at 04:13 PM.
|
|
|
10-03-2019, 02:30 AM
|
#6
|
Human being with feelings
Join Date: May 2019
Location: Los Angeles / God forbid…
Posts: 191
|
Would it be possible to automatically save the preset name to the plugin's original preset name ?
Getting it to work in conjunction with X-Raym's «rename tracks with first VSTi and its preset name» would make templating sooo quick and easy
|
|
|
10-03-2019, 04:54 PM
|
#7
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
I made a mod of this script for saving preset. Not shared publicly yet. PM me if needed.
@eugen2777
I hope you will come back soon !
EDIT: link of my mod is here : https://gist.github.com/X-Raym/448e8...b520ca12ddc698
Last edited by X-Raym; 01-04-2021 at 04:33 PM.
|
|
|
10-04-2019, 04:23 AM
|
#8
|
Human being with feelings
Join Date: Dec 2007
Location: Germany
Posts: 253
|
X-Raym,
yes I would be interested as well!
BR,
HoJo
PS: Sending you a PM
|
|
|
10-09-2019, 03:49 AM
|
#9
|
Human being with feelings
Join Date: Feb 2017
Posts: 305
|
I'm sorry but while I've been dreeming of a native ABC snapshots and see at this script I've got a idea:
Will it be hard to create to one save patches only in current project folder or do new project folder in presets at lest?
|
|
|
10-09-2019, 04:39 AM
|
#10
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@Ivann
There is no presets folder management (as far as I know) and all presets are stored in the same file (one per FX). the best you can is Prefix your presets I guess.
|
|
|
10-10-2019, 02:12 AM
|
#11
|
Human being with feelings
Join Date: Feb 2017
Posts: 305
|
Quote:
Originally Posted by X-Raym
@Ivann
There is no presets folder management (as far as I know) and all presets are stored in the same file (one per FX). the best you can is Prefix your presets I guess.
|
Yeah, a prefix with a project name would be not so bad I suppose.
How can I do that?
|
|
|
10-10-2019, 02:34 AM
|
#12
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Custom mod is the only way :P
|
|
|
12-02-2020, 12:08 PM
|
#13
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
I am trying to run the x-raym version of this script, and I'm getting:
Save_VST_Preset_Action.lua:83: attempt to index a nil value (local 'Preset_Chunk')
I have an fx window open... when the function is called, I'm printing to the console, and get this:
fxnum = 0,name = Lead Bass
So it's finding the effect and preset.
Thoughts?
I can post the code here, if x-raym doesn't mind, but since he didn't originally, I'm checking in case there was a reason...
Edit: enabling this message:
reaper.ShowConsoleMsg("\n\n"..fxnum.."\n"..FX_Chun k.."\n")
it prints:
<VST "VSTi: Reaktor 6 (Native Instruments GmbH) (2->
doesn't seem like the full chunk??
|
|
|
12-03-2020, 04:38 AM
|
#14
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
@woodslanding
Pretty sure the ">" character in the VST names breaks the parsing on this VST chunk.
Code:
VST: Reaktor5 (x86) (Native Instruments GmbH) (2->8ch)
You can either fine tune the pattern matching, or make a more complex way to parse FX chink (using line per line method).
Another temp fix would be to just made a search and replace of this particular FX name, then do the parsing, then restore it back to its initial name.
|
|
|
12-06-2020, 11:42 AM
|
#15
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
I guess I have to ask: can anybody explain how to fine tune this pattern matching? I can't really get my head around how one would know that the '>' doesn't end the chunk....
Printing out the chunk, it looks like the data is not initially plain text, so maybe there is a way to parse out the lines before conversion?
Code:
AAAgAAAAAQAAAAIAAAABAAAAAQAAAAEAAAABAAAApQAAAAAAAACZBQAAAQAAACAAAAABAAAAAgAAAAEAAAABAAAAAQAAAAEAAAAIAQAAAAAAAJoFAAABAAAAIAAAAAEAAAACAAAAAQAAAAEAAAABAAAA
...etc,etc (boring)
AAAAAAD/////AAAAAIeHh8AEAAAAAQAAAAUAAAAAAAAAAQAAAAAA
AAAAAAAAAAAAAAEAAAACAAAAAQ==
AFNob3dkb3duABAAAAA=
>
PRESETNAME Showdown
FLOATPOS 24 28 916 769
FXID {C70F3593-89C3-4FEC-BC9F-109B66DE7732}
WAK 0 0
BYPASS 0 0 0
<JS "ReaTeam JSFX/Utility/mschnell_MIDI Volume Control.jsfx"
...etc--start of next fx....
I notice the > is on a line by itself. Does anyone know if that's something we can count on??? If so, I guess i could just get lines until a line = '>'. I think I can handle that much pattern matching
I'll see if I can figure that out.... I still would need to get the chunk BEFORE converting it, right?
|
|
|
12-06-2020, 11:54 AM
|
#16
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Okay, so somewhere between these two console printouts, the data changes from gobblety-gook to text, but I can't figure out where... all it is doing is matching things, right?
Code:
local ret, Track_Chunk = reaper.GetTrackStateChunk(track,"",false)
reaper.ShowConsoleMsg(Track_Chunk)
--SHOWS: all the muck from the post above.
--Does NOT start with plain text
--but DOES have '>' on a line by itself at the end of that data
------------------------------------
-- Find FX_Chunk(use fxnum) --------
------------------------------------
local s, e = Track_Chunk:find("<FXCHAIN")
-- find VST(or JS) chunk
for i=1, fxnum+1 do
s, e = Track_Chunk:find("<%u+%s.->", e)
end
local FX_Type = string.match(Track_Chunk:sub(s+1,s+3), "%u+")
if not(FX_Type=="VST" or FX_Type=="JS") then return end
local FX_Chunk = Track_Chunk:match("%b<>", s)
reaper.ShowConsoleMsg("\n\n"..fxnum.."\n"..FX_Chunk.."\n")
--SHOWS: 1 /n <VST "VSTi: Reaktor5 (Native Instruments GmbH) (2->
|
|
|
12-07-2020, 11:25 AM
|
#17
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Okay, I have a feeling Ultraschall has addressed all this in her fxchunk handling stuff. I am going diving into her docs.... I'll keep y'all posted.
|
|
|
01-04-2021, 04:35 PM
|
#18
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
Not sur if it is still relevant but the mode I made at this time was this one: https://gist.github.com/X-Raym/448e8...b520ca12ddc698
Not tested since months, but maybe it works.
I may put it in reateam repo at some point to make it more public.
|
|
|
01-04-2021, 05:07 PM
|
#19
|
Human being with feelings
Join Date: Jun 2020
Posts: 48
|
Thank you for sharing X-Raym, this will be very useful to me.
|
|
|
01-05-2021, 02:01 PM
|
#20
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Save Preset: Ultraschall version
Okay, here is the lean mean all the work done behind the scenes version of save vst preset. Just the core functionality. Posting it here in case someone else needs it. To reiterate, Eugen's original code failed on parsing a '>' in the reaktor VST name, so I looked for an answer in the ultraschall methods.
This is just the base code, swap out for the Save_VST_Preset method in Xraym's code, if you use reaktor, or have other parsing issues. Also, I'm pretty sure this only works for vsts, so further work would be needed to save jsfx.
EDIT: well, if you have big files, this is extremely slow, so I am looking into that. Also, please note you will need to install the ultraschall api.
cheers,
-e
Code:
--[[ PRESET FILE FORMAT:
Filename presets/vst-VST_DLL_NAME
[General]
NbPresets=N
[PresetN]
Data =
Data_1 =
Name =
Len =
]]
dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")
local function get_CtrlSum(HEX)
local Sum = 0
for i=1, #HEX, 2 do Sum = Sum + tonumber( HEX:sub(i,i+1), 16) end
return string.sub( string.format("%X", Sum), -2, -1 )
end
function WritePreset(trackNum, fxNum, presetName, vstName)
--get track data
local found, data = ultraschall.GetTrackStateChunk_Tracknumber(trackNum)
if not found then MSG('Track chunk not found: ',trackNum, fxNum) end
data = ultraschall.GetFXStateChunk(data)
data = ultraschall.GetFXFromFXStateChunk(data, fxNum + 1) --ultraschall fx are 1-based
data = ultraschall.GetFXSettingsString_FXLines(data)
data = ultraschall.Base64_Decoder(data)
data = ultraschall.ConvertAscii2Hex(data)
--MSG('data',data)
--local data = getPresetHex(chanNum, fxNum)
--prepare for writing file
local presetFile = reaper.GetResourcePath()..'/presets/vst-'..vstName..'.ini'
MSG('path = ', presetFile)
local presetCount, key, section
if reaper.file_exists(presetFile) then
ultraschall.GetIniFileValue()
_, presetCount = reaper.BR_Win32_GetPrivateProfileString("General", "NbPresets", "", presetFile)
section = 'Preset'..math.tointeger(presetCount)
else section, presetCount = 'Preset0', 1
end
--Update/write number of presets
presetCount = math.tointeger(presetCount + 1)
ultraschall.SetIniFileValue('General', 'NbPresets', presetCount, presetFile)
local presetLength = #data
local stringPos = 1
for i = 1, math.ceil(presetLength/32768) do
if i == 1 then key = 'Data' else key = 'Data_'..(i - 1) end
local chunk = data:sub(stringPos, stringPos + 32767)
local sum = get_CtrlSum(chunk)
ultraschall.SetIniFileValue(section, key, chunk..sum, presetFile)
stringPos = stringPos + 32768
end
ultraschall.SetIniFileValue(section,'Name', presetName, presetFile)
ultraschall.SetIniFileValue(section,'Len', presetLength//2, presetFile)
end
Last edited by woodslanding; 01-06-2021 at 09:57 AM.
|
|
|
01-06-2021, 11:56 AM
|
#21
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Well, I figured out a way to change the parsing in Eugen's script to work with Reaktor, but with the large reaktor ensemble I am storing presets for (27 blocks of data) Eugen's method seems to be even slower.... I am taking the opportunity to write this while I attempt to save a single preset.
Edit: and coming back to edit it while it's still saving.
So I am feeling the need to find a way to do this without using track chunks. I guess when you use the menu, the script dies at the point it waits for user input for the preset name. Wish there were separate 'save' and 'save as' buttons for the rpl's.
I may look into saving fxbs. I guess they are binary data. Not sure if that would be faster or not.
|
|
|
01-06-2021, 12:10 PM
|
#22
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Curiouser and Curiouser.
Reaper writes out this large data file in a fraction of a second, but more importantly, it does not seem to match what's in the track chunk.
Reaper writes out 71 blocks of data (data - data70) but the track chunk only contains 27 of these, according to ultraschall's method. I gave up on Eugen's after 15 minutes. Maybe I'll double-check that his doesn't give a different size result over the lunch hour.
Okay, Eugen's method does save prism snaps in about 15 seconds, so it is working....
Not sure why the ensemble 'photon' requires 35x the data of 'prism'!
But after many hours of messing around, it's looking like I'm back to saving presets manually with the little + button
Any suggestions welcomed!
|
|
|
01-06-2021, 12:15 PM
|
#23
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
SIGH!
Seems that even natively created rpls can't recall the state of a reaktor ensemble correctly.
Note to self: test these things before embarking on a script idea.
Edit: Maybe I did test it... now it is working natively. That at least is a relief, since I discovered that different reaktor ensembles have different fxb formats.
Last edited by woodslanding; 01-06-2021 at 12:20 PM.
|
|
|
01-06-2021, 08:08 PM
|
#24
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
Alright, so I figured out how to save and load trackFXchunk data to a file without any kind of encoding, which goes quite fast.
Unfortunately, this chunk of data is not enough, despite its substantial size, to reload the reaktor ensemble. It wil load the correct preset to an existing ensemble, but not restore the ensemble.
Native reaper-generated rpls will.
SO bummed.
|
|
|
03-07-2024, 05:30 AM
|
#25
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,132
|
A good use case for the script is saving config of a plugin which failed to load
|
|
|
03-07-2024, 06:00 AM
|
#26
|
Human being with feelings
Join Date: Jun 2006
Location: UK
Posts: 3,210
|
Quote:
Originally Posted by Spacemen Tree
This is great!! I was thinking about trying to write something like this a few weeks ago but no time. My idea was to convert internal VST presets into reaper presets with one click.
Very nice!!!
Thanks eugen.
|
this would be useful
|
|
|
03-07-2024, 09:06 AM
|
#27
|
Human being with feelings
Join Date: Jan 2008
Location: Vancouver, BC
Posts: 3,792
|
Really cool!
What I'd love is something like this that would allow you to quickly browse through embedded plugin presets that don't populate Reaper's menu and save them as Reaper presets but the original preset name.
For plugin presets that are individually saved in a folder, it's possible you could point the script to the folder and it would read the file name. This is mostly for when you want to batch re-save them all.
Keyboard shortcut in the plugin for next preset, keyboard shortcut to the script to save a Reaper preset and done almost instantly!
A more complex, but flexible way could be something that works a bit like LICEcap. Determine the co-ordinates for the area of the screen where the plugin displays the preset name, send a screenshot of that area using a Python library with that functionality, then feed into another Python library for high quality OCR like Google's which returns the text of the preset name to the script.
You might even be able to use macro software so the switching/saving of presets is done automatically for the most part.
(I made a simple Python script that converts Reaper presets into Valhalla presets when I wanted to switch to the VST3 version but had years of Reaper presets that wouldn't work otherwise. The opposite direction wouldn't be hard. Eventide presets are easy too because the developers are nice enough to use XML instead of some totally unnecessary binary encoding.)
__________________
FRs: v5 Media Explorer Requests, Global Quantization, Session View
Win10 Pro 64-bit, Reaper 6(x64), AMD 3950x, Aorus X570 Master, 64GB DDR4 3600, PowerColor Red Devil 5700XT, EVO 970 2TB, 10TB HD, Define R6
Last edited by PitchSlap; 03-07-2024 at 09:41 AM.
|
|
|
03-08-2024, 05:40 AM
|
#28
|
Human being with feelings
Join Date: Apr 2017
Posts: 121
|
Linux Mint 21.3_x64 - Reaper 7.11 - save_fx_preset_1.02
Hi,
THIS SCRIPT is AMAZING! Many THANKS!
I don't understand why it doesn't save tool presets .clap
thanks again....
Last edited by Codesound; 03-08-2024 at 05:48 AM.
|
|
|
03-08-2024, 06:14 AM
|
#29
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,132
|
Quote:
Originally Posted by Codesound
Linux Mint 21.3_x64 - Reaper 7.11 - save_fx_preset_1.02
Hi,
THIS SCRIPT is AMAZING! Many THANKS!
I don't understand why it doesn't save tool presets .clap
thanks again....
|
The available version only supports VST and JS plugins
Try replacing the line
PHP Code:
if not(FX_Type=="VST" or FX_Type=="JS") then return end -- Only VST and JS supported
With this
PHP Code:
if not(FX_Type=="VST" or FX_Type=="JS" or FX_Type=="CLAP" or FX_Type=="LV2" or FX_Type=="AU")
then return end -- VST, JS, CLAP, LV2, AU are supported
AND PLEASE REPORT BACK
.
.
.
.
|
|
|
03-08-2024, 08:24 AM
|
#30
|
Human being with feelings
Join Date: Apr 2017
Posts: 121
|
Hi,
thanks for your interest.... The problem persists.....
I want to say that the script is in
"/home/USER/.config/REAPER/Scripts/X-Raym Scripts/"
thanks again
|
|
|
03-08-2024, 02:05 PM
|
#31
|
Human being with feelings
Join Date: Sep 2019
Posts: 1,132
|
I was able to make the script recognize a CLAP plugin and read CLAP config data but unfortunately the data which was then stored in the preset ini file after conversion from base64 to hexadecimal could not be read back by the plugin. And when i saved the same data using REAPER save preset dialogue the code which was stored was completely different from the one stored by the script.
That's about as far as my knowledge goes. I cannot troubleshoot the base64 to hexadecimal conversion function because i don't understand the data structure. Maybe someone knowledgeable will come along and be able to make it work for CLAP and other architectures.
Sorry.
|
|
|
03-10-2024, 12:41 AM
|
#32
|
Human being with feelings
Join Date: Apr 2017
Posts: 121
|
Quote:
Originally Posted by Buy One
I was able to make the script recognize a CLAP plugin and read CLAP config data but unfortunately the data which was then stored in the preset ini file after conversion from base64 to hexadecimal could not be read back by the plugin. And when i saved the same data using REAPER save preset dialogue the code which was stored was completely different from the one stored by the script.
That's about as far as my knowledge goes. I cannot troubleshoot the base64 to hexadecimal conversion function because i don't understand the data structure. Maybe someone knowledgeable will come along and be able to make it work for CLAP and other architectures.
Sorry.
|
no worry, Thanks for your try!
This script is useful for certain plugins that have somewhat complicated presets saving procedures (see Dexed or Osirus, in which you export the cartdrige)
thanks again. I hope for one update of this script
|
|
|
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 06:01 AM.
|