Plug'in Script help getting started

Official support for: bluecataudio.com
Post Reply New Topic
RELATED
PRODUCTS

Post

I am hoping to learn and use Plug'n Script to write some midi processing scripts. I have been using Logic's Scripter plugin for this and it works pretty well, but has a few limitations that I don't think Plug'n Script will have, such as ability to read other files, among other things.

Can anyone point me in the right direction to get notes specifically about the MIDI api within either Plug'n Script or AngelScript? Also about how to do GUi elements. I've looked through the various example scripts, they are very rudimentary and not enough info to figure out what I need to do. I guess I need to learn AngelScript too maybe it will all make perfect sense once I pass a certain threshold of understanding, but as of now I'm a bit lost as to how to structure a script and get started, and particularly how to specifically handle midi data and gui elements.

My first trial will be to write a script that converts incoming midi to outgoing automation events. ( and visa versa ).

Any pointers in the right direction will be welcome and I'm sure I will have follow up questions once I get going.
MacPro 5,1 12core x 3.46ghz-96gb MacOS 12.2 (opencore), X32+AES16e-50

Post

Hi,

For the first step, there is probably no need to write your on GUI, as a default one will be generated by the plug-in. The MIDI API is pretty basic and simple: you have access to input and output MIDI events queues in the processBlock method (fields of the BlockData structure). You can then manipulate them individually (either as RAW MIDI data or using the additional API delivered as a header file in the library).

Can you maybe give us a simple example of what you are trying to achieve so that we can help?

Post

Where can I find the header file or other documentation that explains the API?

Also where can I find information about the ability to script the sending and receiving of host automation data?
MacPro 5,1 12core x 3.46ghz-96gb MacOS 12.2 (opencore), X32+AES16e-50

Post

There is an entire chapter with the scripting API in the manual.

The header for the extra MIDI events library is available in your Documents folder/Blue Cat Audio/Blue Cat's Plug'n Script/Script/library. You can also check it out online on github: plug-in MIDI Events utility.

There is no specific API for automation: you simply get the data from the host or the plug-in GUI thru the input parameters. And you can write automation from the DSP using the output parameters.

Hope this helps!

Post

thanks, will try some stuff and get back here later.
MacPro 5,1 12core x 3.46ghz-96gb MacOS 12.2 (opencore), X32+AES16e-50

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Blue Cat Audio wrote:There is an entire chapter with the scripting API in the manual (https://www.bluecataudio.com/Doc/Product_PlugNScript/#ScriptingReference.API).

The header for the extra MIDI events library is available in your Documents folder/Blue Cat Audio/Blue Cat's Plug'n Script/Script/library. You can also check it out online on github: plug-in MIDI Events utility (https://github.com/bluecataudio/plugnscript/blob/master/Built-in/Scripts/library/Midi.hxx).

There is no specific API for automation: you simply get the data from the host or the plug-in GUI thru the input parameters. And you can write automation from the DSP using the output parameters.

Hope this helps!
Dear Blue Cat,

I am too a beginner trying to achieve "record output parameters as automation curves or send MIDI CC messages to other plug-ins".

The code below is what I've mustered so far, the output parameters are missing and I don't know how to fit them in. I suspect this is why in my exported VST, only one tab "Control Input" is present in the Preset/Global Settings. As there is no Output tab, the knob movement also does not output any MIDI CC data.

Ideally, I would like to learn
1. How to output kmidiControlChange messages with a turn of a knob.
2. How to pass pedal CC64 through the MIDI filter script along w/ kmidinoteOn & ChannelAftertouch.

It's probably very simple for you guys, I'm trying hard but still have a hard time figuring it out.

From my experiments, writing a string of output parameters will create another set of controls that appears in the GUI and automation lane, making it redundant. Will I have to link the inputparameters to the outputparameters, then hide the arrays of outputparameters in the GUI? Is this the right way to do it?
Is it also possible to specify the CC number assignments in the cxx, thus hardwiring the choice of CC input and output within the plugin?

Lastly, to achieve a simple MIDI editor that outputs CC, where should I begin studying AngelScript or find examples?

I can’t wait to get started and appreciate any help, thanks for the great product!

Pat

Code: Select all (#)

// parameters
array<string> inputParametersNames={"CUTOFF cc74", "Reso cc71"};
array<double> inputParameters(inputParametersNames.length);

array<double> inputParametersMin={0,0};
array<double> inputParametersMax={127,127};
array<double> inputParametersDefault={0,0};
array<int> inputParametersSteps={128,128};
array<string> inputParametersFormats={".0"};


/* per-block processing function: called for every block with updated parameters values.
*
*/
void processBlock(BlockData& data)
{
    // read parameters
    uint8 channel=int8(inputParameters[0]+.5);

    // iterate on MIDI events
    for(uint i=0;i<data.inputMidiEvents.length;i++)
    {
        // send Note On and Off events plus CC64
        MidiEventType type=MidiEventUtils::getType(data.inputMidiEvents[i]);
        if(type==kMidiNoteOn || type==kMidiNoteOff || type==kMidiChannelAfterTouch)

//kMidiControlChange???

        {
            // forward the event (unchanged)
            data.outputMidiEvents.push(data.inputMidiEvents[i]);
        }
    }
}

//how to fit these guys in?

array<string> outputParametersNames={"74 hidden from GUI & automation" "71 hidden"};
array<double> outputParameters(outputParametersNames.length);
array<double> outputParametersMin={0,0};
array<double> outputParametersMax={127,127};
array<int>    outputParametersSteps={128,128};
array<string> outputParametersFormats={".0"};

void computeOutputData() 
{ 
     outputParameters[0]=// code for continuous value?
     outputParameters[1]=// " 
} 


Post

Hello @tksense
I am in the same "beginner" state as you were I guess as I am new to PNS and I would like to write also a script writing sysex or MIDI CC to a midi output while rotating a knob.

did you managed to get some information bout how to do this please?
if yes , if you could point me to some code example it would be great.
many thanks in advance for your help.
Cheers , eric

Post

I am not sure about SYSEX support in PnS (it may not work in all platforms as it has not been tested yet). You can try to manually write Sysex events sequences using the MIDI output API in PnS.

There are already some built-in MIDI scripts that manipulate MIDI events in Plug'n Script (but obviously no Sysex). You can either find them inside the plug-in or in the PnS code repository.

Post

I'm also someone who was looking for more information on using PnC to do midi CC output - so it's a shame there aren't more examples out there or help for us absolute beginners. I would like to see some scripts that mirror the functions of Remote Control for example - examples of how to create single knob or slider that maps onto a CC controller. Despite the Blue Cat comment above from August 2022 there aren't any such examples I can find.

I came looking after I bought Remote Control to automate my Chase Bliss CXM1978 pedal - though I could quickly set up the plug-in to automate the pedal's sliders which are CC 0-127 controlled, I could not work out how to automate / access the arcade buttons, which have three settings each, called by the values 1, 2 or 3 only per additional CC.

Maybe PnC with no coding experience is far too big a hill to climb. It's a fascinating tool, but without more resources, beginners are quickly going to fall by the wayside.

Alternatively, an update to Remote Control that makes it much more modular / customisable - where you can choose precisely how many output objects you want, what type they are, and have some more options as to type of CC output - buttons which toggle through set values etc. - would be brilliant. And it also really needs an option to display / automate 0-127 rather than 0-100% I think.

There are so many great pedals these days with midi control - Chase Bliss, OTO etc. - that I would like to have my own fully functional plug-in controllers for that would save / recall settings in sessions. Remote Control is a start but not there yet and I think PnC is just too difficult.

best to all,
Ewan

Post

We would indeed like to add more flexibility to the remote Control in the future and release more examples for Plug'n Script, but there is unfortunately quite a lot on our plate!

You can however combine the examples that have input parameters and the other ones that send MIDI events, but it indeed requires some minimal programming knowledge to get there.

Post Reply

Return to “Blue Cat Audio”