Javascript Macro Action Requests

Discussion about: tracktion.com
Post Reply New Topic
RELATED
PRODUCTS

Post

Kang wrote:The former. So that you could scroll through which active automation line shows on the track.
Just added this too:

Code: Select all

//Next Active Automation Parameter
var track = Tracktion.getTrackFromSelectedObject();
Tracktion.changeActiveAutomationParameter (track, 1);

Post

Really looking forward to using these soon.

Post

Is there a way to incorporate 'select all clips in track' in macros currently?

I was wanting to make one that would duplicate a track, but without any clips.

Post

whyterabbyt wrote:
Rock wrote:Moving by time is cool, but so would be moving by beats. I know it is not typical javascripting, but it is common in scripts to be able to "wait" or "sleep" for a given amount of time. That could also be done in both time and beats.
one way of doing it would just need a conversion function, eg 'convertBeatsToSecs' which works out how many seconds (or samples) long a given measure is at a specific tempo.

Code: Select all

var currentPos = Tracktion.getPosition ('transport');
var rewindTime = convertBeatsToSecs(getCurrentTempo, 1, "bar")
Tracktion.setPosition ('transport', currentPos - rewindTime);
The problem is tempo changes. If you move backwards 1 bar, but there's a tempo change 'inside' that time range, what happens, how should it calculate how long that bar actually is?
Asking Tracktion to move forward 16 beats on the timeline does not seem to be out of the realm of possibilities. And a sleep/wait function could calculate with the tempo at the cursor.

Post

I wonder, looking at how some of this is formatted, is it possible to incorporate a "with" or "using" function?

Instead of typing "Tracktion.xxxx" multiple times in a script it would be ...

With Tracktion{
curTime = .GetPosition;
Etc,
Etc,
}

Or ...

Using Tracktion{
}

Post

LawrenceF wrote:I wonder, looking at how some of this is formatted, is it possible to incorporate a "with" or "using" function?
I believe 'with' is deprecated. But its bad practice anyway.

https://developer.mozilla.org/en-US/doc ... ments/with

http://javascript.info/tutorial/with-operator
An idiot on Set Theory:
"In some cases there is an object called red that contains everything that is red. In much the same way a pot is a plate."

Post

Ah, ok. Thanks. I use it a lot in Win scripting. Wasn't aware it was so problematic in JS.

Is it possible in JS to set an object var to get the same result, to not have to literally type out the full object ID every time?

Var D = Tracktion
D.xxxxx

Does that approach work in JS? Thanks.

Post

Can one of you guys who's figured this all out complete this script?

Code: Select all

//  Somehow get the current track collection array and
var foo
// Iterate through all tracks
for i ( track collection  )
{
   // Get the current name from track i
foo =  (get name from Track i);

   // Strip numeric chars from track name
   // or do some other kind of regex thing to it
foo = foo.replace(/\d*/g,'');

   // Set the modified track name
Tracktion.setName (tracks[i], foo);
}

Post

It would be nice to be able to activate or show an automation parameter as part of a macro.

For example, inserting a fader plugin and immediately showing the line for it's "gain" parameter. Or even just activating it so that you can use the scroll active automation thing that was added.

Post

Would it be possible to do a "Reset all muted/soloed tracks" via a macro so I could assign it to a key?

Post

gatorjj wrote:Would it be possible to do a "Reset all muted/soloed tracks" via a macro so I could assign it to a key?
You'll be able to do this in 6.2.1:

Code: Select all

// Reset Tracks Solo/Mute
var tracks = Tracktion.getEditElements ('track');
Tracktion.setSolo (tracks, false);
Tracktion.setSoloIsolate (tracks, false);
Tracktion.setMute (tracks, false);

Post

awesome!

Post

Here's another cool script that Woody asked me for. It renames all clips on a selected track to match the track name (available from T6.2.1):

Code: Select all

// Rename Clips From Track
var tracks = Tracktion.getSelectedEditElements ('track');

for (var i = 0; i < tracks.length; ++i)
{
	var track = tracks[i];
	var trackName = Tracktion.getName (track);
	var clips = Tracktion.getClipsFromTracks (track);

	for (var c = 0; c < clips.length; ++c)
	{
		var clipName = trackName + " " + (c + 1);
		Tracktion.setName (clips[c], clipName);
	}
}

Post

 
Some things I'd like to accomplish by script:

- trigger note events randomly OR

- put a random offset e.g. in the range of up to +/- one second on looped sequences

(would be great for 'natural' sounds like bells and birds etc.)


- have a shortcut to block receiving CC123 to Midi port (VSTHost and Cantabile do this)

- defer note off while sustain pedal is pressed. (for plugins that don't have regular sustain pedal support)
 

Post

dRowAudio wrote:Here's another cool script that Woody asked me for. It renames all clips on a selected track to match the track name (available from T6.2.1):

Code: Select all

// Rename Clips From Track
var tracks = Tracktion.getSelectedEditElements ('track');

for (var i = 0; i < tracks.length; ++i)
{
	var track = tracks[i];
	var trackName = Tracktion.getName (track);
	var clips = Tracktion.getClipsFromTracks (track);

	for (var c = 0; c < clips.length; ++c)
	{
		var clipName = trackName + " " + (c + 1);
		Tracktion.setName (clips[c], clipName);
	}
}

Could have used this one over the years, good call Woody.

Post Reply

Return to “Tracktion”