Need a script #2

Hello., part 2 :slight_smile:

Second script that I could really use would be one that can load data from a .txt file that looks like this: (I would like to parse from the original file if possible because I have about 2000 files, however if that’s not possible or just a pita with lua script, I can always export the relevant data to a .txt or .csv using Notpad++.
…so the data looks like this:
------------Super simple example:(The max # of points these can have is around 100, this one just has 4.)----------------
{“name”:“Saw Up”,“num_points”:4,“points”:[0.0,1.0,0.5247524976730347,0.4867578148841858,1.0,0.0,1.0,1.0],“powers”:[0.0,-7.1822590827941895,0.0,0.0],“smooth”:false}

The data is x,y pairs (note: 1.0 is actually the points y:min. val and 0.0 is y:max…, so it’s kinda weird). x values are in the range 0.0-1.0.
The “powers” are the segment curve values in the range -10.0 = y:max and 10.0 = y:min.

You’ve probably guessed by now that I would like to import this data into a “User Env”…, please, oh please tell me one of you can script this. :slight_smile:

Thank you

P.S.
Anyone know why part of my post ended up in bold font?

See the Forum Guide (New here? Read this.) – look for formatting

You can set envelopes from the script by using a table that has a certain structure.

A single envelope point could be written like this:

point = {level = 0, duration = 0, curve = 0}
  • level in range of -1 to +1 or 0 to +1 for filter and amp
  • duration in seconds (0 to 30) relative to previous point. First point always has duration of 0
  • curve in range of -1 to +1

Whole envelope could look like this:

envelope = {
	{level = 0, duration = 0, curve = 0},
	{level = 1, duration = 0, curve = -1},
	{level = 1, duration = 0.5, curve = -1},
	{level = 0, duration = 0.3, curve = -1},	
}

To set an envelope you need to set the relevant EnvelopePoints parameter.

zone = this.parent:getZone()

envelope = {
	{level = 0, duration = 0, curve = 0},
	{level = 1, duration = 0, curve = -1},
	{level = 1, duration = 0.5, curve = -1},
	{level = 0, duration = 0.3, curve = -1},	
}

zone:setParameter("User Env.EnvelopePoints", envelope)

Simple example of envelope presets using script:

zone = this.parent:getZone()

envelopePresets = {
	{name = "preset 1",	
		points = {
			{level = 0, duration = 0, curve = 0},
			{level = 1, duration = 0, curve = -1},
			{level = 1, duration = 0.5, curve = -1},
			{level = 0, duration = 0.3, curve = -1},
		},
	},
	{name = "preset 2",	
		points = {
			{level = 0, duration = 0, curve = 0},
			{level = 1, duration = 0.25, curve = -0.2},
			{level = 0.5, duration = 0.5, curve = 0},
			{level = 0, duration = 0.7, curve = 0.25},
		},
	},
	{name = "preset 3",	
		points = {
			{level = 0, duration = 0, curve = 0},
			{level = 0, duration = 1, curve = 0},
			{level = 1, duration = 1.25, curve = 0.5},
			{level = 0, duration = 0.5, curve = 0},
		},
	},
}

presetNames = {}
for i = 1, #envelopePresets do
	presetNames[i] = envelopePresets[i].name
end

defineParameter("UserEnvPreset", nil, 1, presetNames, function() setUserEnvelope() end)

function setUserEnvelope()
	zone:setParameter("User Env.EnvelopePoints", envelopePresets[UserEnvPreset].points)
end

Env Script.vstpreset (12.8 KB)

Once again thank you very much misohoza :smiley:

This looks like a step in the right direction.
Can’t wait to dig in!

The envelopes I’m trying to port over to HALion were made using this little python program., hxxps://github.com/SlavaCat118/EquoFO
I believe it’s open source, so if anyone wants to have a go at either porting over to lua or maybe what might be easier is modding the code to save to a format that can be imported to HALion envelopes via lua script or whatever. It sure would be awesome to have something like this to use with HALion.