I’m completely new in mAirlist scripting and have one question about it becouse I couldn’t find any solution yet.
There is a Behringer X32 console in my studio. It sends MIDI messages to control players (start/stop) trigger automation mode etc.
My next project is to make the first 8 channels (mic channels) of the console to mute my monitors when I activate them.
I found a solution for a single channel, but that won’t work in a multi-channel situation. It might unmute the monitors when any of the channels pulled down.
So I need a script (or some kind of guide or help) to do the following:
When any of the 8 channels activated, a MIDI message is sent to mute the monitors (Matrix 1-2 in my case in the console)
When multiple channels are activated at once, the same happens.
The unmute message is sent only if all the channels are pulled down. (/deactivated)
You will have to find a way to store the statuses (on or off) for all your Microphones separately. As I am not familiar with MIDI, in a setup with “regular” commands – i.e. without using MIDI – it might be possible like this (invented from scratch and untested!), given here for three microphones – the principle stays the same:
var
MicOn : Array[0..2] of boolean ; //Create an Array of as many variables as there are mics (here: 3)
MicNumber : integer;
procedure OnLoad
begin
for MicNumber := 0 to 2 do //Setting any of these to false on startup
MicOn[MicNumber] := false;
end;
procedure OnExecuteCommand(Command: string)
begin
if (Command = 'FADER 0 OPEN') AND NOT MicOn[0] then begin //Set variable to true if fader is open ...
MicOn[0] := true;
end
else if (Command = 'FADER 0 CLOSE') AND MicOn[0] then begin //... and to false if fader is closed
MicOn[0] := false;
end
else if (Command = 'FADER 1 OPEN') AND NOT MicOn[1] then begin
MicOn[1] := true;
end
else if (Command = 'FADER 1 CLOSE') AND MicOn[1] then begin
MicOn[1] := false;
else if (Command = 'FADER 2 OPEN') AND NOT MicOn[2] then begin
MicOn[2] := true;
end
else if (Command = 'FADER 2 CLOSE') AND MicOn[2] then begin
MicOn[2] := false;
end
else if MicOn[0] OR MicOn[1] OR MicOn[2] then begin //If any of these variables is true (i.e. mic is open), then MUTE
ExecuteCommand('MONITOR MUTE ON');
end
else if NOT MicOn[0] AND NOT MicOn[1] AND NOT MicOn[3] then begin //If all of these variables are false, then MUTE OFF
ExecuteCommand('MONITOR MUTE OFF');
end;
end;
begin
end.
The FADER n OPEN/CLOSE-commands should be adapted to the respective MIDI-syntax. The MONITOR MUTE ON/OFF-command is a place holder for the method you are using for muting the monitor output.
if MicON[0] is an abbreviated syntax for if MicOn[0] = true,
as is if NOT MicOn[0] for if MicOn[0] = false.
So if one of the MicON-variables is set to true, the output is muted. Vice versa, muting is reset only if all of these are false (i.e. all Mics are closed).
This very script has the disadvantage of not muting the monitors if a microphone has been left open on startup.
var mic1on:boolean; mic2on:boolean; mic3on:boolean; mic4on:boolean; mic5on:boolean; mic6on:boolean; mic7on:boolean; mic8on:boolean;
procedure OnLoad;
begin
mic1on:=false;
mic2on:=false;
mic3on:=false;
mic4on:=false;
mic5on:=false;
mic6on:=false;
mic7on:=false;
mic8on:=false;
MidiOutOpen(1);
end;
procedure OnUnload;
begin
MidiOutClose(1);
end;
procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin
//Fader 1 ertekenek eldontese
if(Status=$B0) and (Data1=$00) then
begin
if(Data2>=$0D) then
mic1on:=true;
else
mic1on:=false;
end;
//Fader 2 ertekenek eldontese
if(Status=$B0) and (Data1=$01) then
begin
if(Data2>=$0D) then
mic2on:=true;
else
mic2on:=false;
end;
//Fader 3 ertekenek eldontese
if(Status=$B0) and (Data1=$02) then
begin
if(Data2>=$0D) then
mic3on:=true;
else
mic3on:=false;
end;
//Fader 4 ertekenek eldontese
if(Status=$B0) and (Data1=$03) then
begin
if(Data2>=$0D) then
mic4on:=true;
else
mic4on:=false;
end;
//Fader 5 ertekenek eldontese
if(Status=$B0) and (Data1=$04) then
begin
if(Data2>=$0D) then
mic5on:=true;
else
mic5on:=false;
end;
//Fader 6 ertekenek eldontese
if(Status=$B0) and (Data1=$05) then
begin
if(Data2>=$0D) then
mic6on:=true;
else
mic6on:=false;
end;
//Fader 7 ertekenek eldontese
if(Status=$B0) and (Data1=$06) then
begin
if(Data2>=$0D) then
mic7on:=true;
else
mic7on:=false;
end;
//Fader 8 ertekenek eldontese
if(Status=$B0) and (Data1=$07) then
begin
if(Data2>=$0D) then
mic8on:=true;
else
mic8on:=false;
end;
//Nemitas vagy engedelyezes
if(mic1on=true)or(mic2on=true)or(mic3on=true)or(mic4on=true)or(mic5on=true)or(mic6on=true)or(mic7on=true)or(mic8on=true)
then
MidiOut(1,$B1,$40,$7F);
else
MidiOut(1,$B1,$40,$00);
end;
begin
end.
(The comments are in hungarian. Sorry for that)
So it didn’t work. I tried to run it manually and got an error message. “Error running script: [Error] (32:3): identifier expected”
Could you help me solve this problem!
This is my first ever try writing a script, so I’m a bit limited…