Studio monitor control

Hi,

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.

Muted regards

TSD

You could probably come around this, by sending Mic-Close command during initialization.

You can utilize midi or direct OSC via Network UDP to control the X32.
https://behringerwiki.musictribe.com/index.php?title=OSC_Remote_Protocol

https://behringerwiki.musictribe.com/index.php?title=X32_PRODUCER%3A_MIDI_Implementation
With Firmware Version 2.0 there have been added some additional mute functions.
https://behringerwiki.musictribe.com/index.php?title=V2.0_MIDI_Implementation

Also there is a bunch of tools, talking OSC directly.

Thanks!
You helped me a lot! :slight_smile:

I wrote this code:

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… :smiley:

Haven’t counted the lines, but one syntax miskate I see is that you must not terminate the line before an else with a semicolon:

if condition then
  command1  // <- no ; here
else
  command2; // <- only here!

Same is true of you have multiple commands wrapped in begin/end - no semicolon between end and else:

if condition then begin
  command1a;
  command1b;
end  // <- no ; here
else begin
  command2a;
  command2b;
end; // <- only here!

Thanks Torben!
I’ll try it.