Page 3 of 3

Re: Scripting?

Posted: Fri Jun 07, 2019 8:34 pm
by Dewdman42
Is it possible through JS or macro to insert Program Change events into tracks somehow?

Re: Scripting?

Posted: Sat Jun 08, 2019 4:39 am
by Lawrence
Yes, look at those functions I posted. That works for any selected Instrument Track assigned to an External Instrument.

Code: Select all
setProgram (bank [integer], program [integer])
P.S. Look in my signature below, there's an External Instruments package download link there. It runs from the main Studio One menu.

Re: Scripting?

Posted: Sat Jun 08, 2019 5:22 am
by roblof
Is it possible to control other hardware like controllers and audio interfaces this way? Given there already is some way to talk to a device through midi or other means.

Can you subscribe to events?

Re: Scripting?

Posted: Sat Jun 08, 2019 5:39 am
by Lawrence
I'm sure it is as some External Devices like MCU and simiar have JS code files behind them. Actually doing it is another different conversation. :(

It's probably not a good idea to be too ambitious with scripts. It's better to fill smaller personal gaps, not jump into the deep end trying to do some really complex things.

Re: Scripting?

Posted: Sat Jun 08, 2019 6:28 am
by roblof
I’m too old to stay in the shallow end of the pool 8-)

I was thinking of controlling things like 3’rd party preamp gain, as already possible with presonus hardware integration.

Lawrence wroteI'm sure it is as some External Devices like MCU and simiar have JS code files behind them. Actually doing it is another different conversation. :(

It's probably not a good idea to be too ambitious with scripts. It's better to fill smaller personal gaps, not jump into the deep end trying to do some really complex things.

Re: Scripting?

Posted: Sat Jun 08, 2019 6:32 am
by Lawrence
I hear you. :) That end of the pool is probably pretty deep and also most likely unreachable without an API doc outlining those things.

Nothing wrong with thinking big but you also have to be realistic. That's not gonna happen without a hardware controller API from them and maybe also documentation from the specific hardware manufacturer.

Study any JS files you find in the \Studio One 4\devices folder, maybe that will give some pointers.

You might wanna also brew a BIG pot of coffee. :mrgreen:

Re: Scripting?

Posted: Sun Jun 09, 2019 1:18 pm
by Dewdman42
Lawrence wroteYes, look at those functions I posted. That works for any selected Instrument Track assigned to an External Instrument.

Code: Select all
setProgram (bank [integer], program [integer])
P.S. Look in my signature below, there's an External Instruments package download link there. It runs from the main Studio One menu.


What does that external instrument package do and how do i go about installing it to check it out?

So regarding the program change, thanks for pointing that out. Any way to save ProgramChanges to another track other then the currently selected one?

Well a more important question is, can we create noteOn/NoteOff Events on tracks using JS somehow?

Is there any way to see PC messages by patch "name" rather then number in S1?

Re: Scripting?

Posted: Mon Jun 10, 2019 5:46 am
by Lawrence
Put the package file in the application \scripts folder and restart Studio One. It will list from the Studio One menu as External Instruments. Use the Instruments menu > Edit Instruments to go into the directory where the Cubase patch scripts are and copy anything you want to use to the root directory and it will list in it. There's about 200 Cubase patch script files that install with it. Some of them may be badly formatted as I didn't test them all.

I also added a new function to functions.js... loadCubasePatchFile() … which reads those files and pushes the relevant data into an array, in case someone wants to do something different.

Re: Scripting?

Posted: Mon Jun 10, 2019 10:40 am
by Dewdman42
Thanks will check that out.

Is that a "no its not possible" on the question about adding noteOn/noteOff events to a track with JS?

Re: Scripting?

Posted: Mon Jun 10, 2019 3:10 pm
by Lawrence
Sure, it's possible. I don't know how since I never actually tried it, but it's possible as "Events" like MIDI notes in code are just objects, so sure, there's certainly a way to create any MIDI object like that from scratch if you know how.

Not sure Studio One uses on/off events directly, but a note event would trigger both.

Re: Scripting?

Posted: Mon Jun 10, 2019 4:02 pm
by Dewdman42
Any idea how we might be able to figure that out?

Re: Scripting?

Posted: Mon Jun 10, 2019 4:09 pm
by Lawrence
Nope, sorry.

Re: Scripting?

Posted: Wed Jun 12, 2019 3:22 pm
by Dewdman42
bummer.

Riddle me this. Do you think there is a way with JS to detect program change events on the program change lane to determine their value and maybe display the "current" program on the macrobar somehow by name? In other words you have your external instrument package for specifying a PC by name, which can insert those onto the program change lane...but I'd like to be able to view the names somehow of what is on the track. Any idea if we know how to accomplish that now? As near as I can see, the program change lane will a line/curve with nodes, but the only way to see the value is to hover the mouse over the nodes...and the value is most likely shown as a number if I recall. Plus I discovered the other day its based on a scale up to 100, rather then 128, so has to be converted somewhere?

Re: Scripting?

Posted: Mon Sep 07, 2020 8:54 am
by johnnythunder
Lawrence wrotehttps://github.com/ExpressMix/studioone_functions


This thread has been amazing :reading: . I'm a new comer to studio one (5), but this topic of reverse engineering and creating custom scripts/macros honestly sounds fascinating. I'm a Sr. Software Engineer by trade and do a lot of JS programming. Is there any way I could get some more tips on this? Or even just that studioone_functions.js file I could review? I'd greatly appreciate it and be willing to share any use scripts!

Re: Scripting?

Posted: Fri Mar 12, 2021 8:16 pm
by jacquesmk2

Re: Scripting?

Posted: Sat Mar 13, 2021 1:13 pm
by Dewdman42
Thank you for sharing that.

Re: Scripting?

Posted: Sun Jul 17, 2022 3:56 pm
by notSTEVE
Mikayy wrote
Lawrence wroteSounds like a plan. :thumbup:

Anyway, I already had a basic Hello World script so I uploaded it: https://github.com/StudioOneScripts/Hello-World

Take care my friend.


Hi Lawrence, thanks for uploading the example! Unfortunately, I don't see any change after putting the zipped file ("Hello-World-master.package") in the script folder. I assume I should see a button "Hello world" somewhere in the Track menu, but there is nothing. Should the script still work?

Thanks!

Be sure to zip up the individual files, not a folder containing the files.