Need a script

Hello,

Looking to do a couple of things…,
I was looking at this post by misohoza titled “startwriteoutputtofile-stopwriteoutputtofile-and-other-undocumented-functions/130088”…, (sorry, forum won’t let me post links yet, probably because I’m new?) if you run that script with Halion v7 you’ll notice that “io”
has also been added to the API which is what I suspect would be needed to accomplish the following.

If someone could provide a .vstpreset that does the following it would be awesome.

I would like to have a macro page with a popup menu and 2 buttons.
The menu would function like this:
It should load from a .txt file(“D:/Loops/myLoops.txt”) entries that look somewhat like this(The following format is just an example, I can change it if need be.):
Loop-001: 24.0, 10930.90, 18193.71
Loop-002: 49.0, 22658.00, 32792.70
.
…,etc.

This is for a Spectral Synh Zone, the first number is the “SpectralOsc.Pos” the next 2 values are “SampleOsc.SustainLoopStartA” and “SampleOsc.SustainLoopEndA”.
When a menu slot is selected it should set those values accordingly.

The buttons should function like this if possible;
Button-1: When clicked would save any new values for the above 3 entries in the current slot of the menu and the .txt file.
(Not sure if the menu can act in a dynamic way or if another button would be needed to reload the .txt?)
Button-2: When clicked would save to first available empty slot of menu and .txt file.

If the buttons part isn’t possible or just too much of a hassle then just a menu that can load and set values from the .txt file would be fine.

Hi @jackorez369

While it looks like the io library is present in HALion 7 it might be restricted. So far I always get operation not permitted error. But there are ways how to read data from other files. You can use require, dofile or loadfile. But for this to work you need to format the data file as valid lua code.

If you format the txt file this:

t = {
	{24.0, 10930.90, 18193.71},
	{49.0, 22658.00, 32792.70},
}

You should be able to access that data from HALion script module.
(Adjust the path variable)

path = "D:/Desktop/H7.txt"
dofile(path)
loopNames = {}
for i, loop in ipairs(t) do
	loopNames[i] = "Loop "..i	
end

defineParameter("LoopSelect", nil, 1, loopNames, function() printLoop() end)

function printLoop()
	local loop = t[LoopSelect]
	print("Position: ", loop[1], " Loop Start: ", loop[2], "Loop End: ", loop[3])
end

At the moment it doesn’t do much. It just prints the values when you change the menu parameter. But you can change it and use the values to set parameters of the zone.

Thank you misohoza :slight_smile:

I’ll have a go at this when I get home.
As for the io library, I was able to get somethings to work like saving to a file, couldn’t figure out loading.
For some reason I was ending up with the output file in a locked state, I could get unlocked sometimes and sometimes not. I was going off of the info in the lua manual, however it seemed like some of the commands were’nt working like I thought they should, but could also just be my lack of understanding.

@misohoza,

I just wanted to thank you again, your scripts have been extremely useful. I’ve been having so much fun, maybe too much, stayed up until about 4am playing around. :smiley:

I have a couple more questions, if you don’t mind?
1)Is there a way to make a variable inside of a script visable as a modulation destination?

2)Do think there is any way to allow the output of modulation sources lfo, env, etc., to influence a parameter of another plugin? Maybe by attaching them to an Automation parameter then linking that inside the DAW to the other plugins parameter or perhaps some other creative way?

…, one more, sorry :wink:
Did you ever come up with any other interesting findings regarding the undocumented globals, such as ‘Wiget’ and ‘Plugin Wiget’, what might those be used for?
If you have any snippets of code regarding any of the undocumented globals that you’d care to share that would be cool.

Have a great day!

Sadly, the answer to both of your questions is probably no.

You cannot create additional modulation destinations, but you can create modulation sources.

The global starting with upper case letters are probably classes or enums. So we probably need to wait for documentation updates.

@misohoza,

In regards to your script that prints out the list of globals, I noticed one named “select”.

Do you think there is a way to use that function to select a range of envelope points?

I know I could use a “For Loop” and manipulate the points within the script., but what I’m looking to do is create “env point selection presets” that I can switch between for use in conjunction with the toolset of the envelope editor (Scale, Tilt, Compress/Expand…).

This would speed up the envelope creation process quite a bit and make it more fun.:wink:

Maybe when you have some time you could hack around a bit with the “select” function to see if it can be used on envelope points?

Thank you