MIDI Message for Mic ON = Speakers off

Hello radio makers!

I just bought a Behringer BCF2000 and I’m trying to control mAirlist with it. I use a DAW called “Studio One” as a mixer and I’m also controlling mAirlist with it. The BCF2000 has a multiclient driver that doesn’t cause any interference with two simultaneously running programs.

The Mic is plugged into an ASIO-Card and the DAW is running it exclusively. I control the mic Volume over a midi message from the BCF2000 in the DAW and I want the speakers to turn off, when I’m raising the volume of the mic. Unfortunately the DAW isn’t able to handle this. So I want mAirlist to receive the same parameters and send a certain CC message if the value is bigger than 1 or 5 to a certain midi device.

If that’s not possible I would like to know if I can send a message to the windows hardware device and simply mute it, when mAirlist triggers the MIC on event.

I fiddled around with a couple of user scripts, but I wasn’t able to figure it out.

EDIT: It would also bee cool to use the fader for smooth volume control.

Thank you in advance for you help!

Anyone?

I hope I got your question right, here’s some info that should help.

A basic script that listens for MIDI messages (a MIDI remote must be set up in the Remote section of mAirListConfig first!), and sends out another MIDI message on certain conditions:

procedure OnLoad;
begin
//  MidiOutListDevices;
  MidiOutOpen(1);
end;

procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin
  if (Status = $00) and (Data1 = $00) and (Data2 = $00) then
    MidiOut(1, $00, $00, $00);
end;

begin
end.

Save this as e.g. “midi.mls” and register it as a Notification Script in the config.

Of course you have to replace all the $00s with the appropriate status/data1/data2 values.

The “1” in MidiOutOpen() and MidiOut() is the number of the MIDI output device to send your message to. To get a list of the available MIDI output devices and their numbers, uncomment the MidiOutListDevices line and reload the script, then check the output in the System Log (double click the status bar in the main window).

Hint: During development, you can reload a script by opening mAirList Control Panel (Ctrl+Alt+X), and unchecking the script in the Notification Scripts list, then checking it again.

Regarding smooth volume control, this can be done easily from within the MIDI remote configuration, without a script:

Add a new entry to the MIDI messages list so that it reacts on a particular status/data1, and on all data2 > 0. Then you can use $DATA2 as a parameter in the following command (you have to type it manually):

PLAYER 1-1 VOLUME $DATA2/127

This will set the volume of the first player to the value of data2- where 0dBFS is assumed at data2=127 (you can use a lower number if you want a bit of overhead). This will even give you a nice logarithmic scale as most “real” consoles use it.

1 Like

Thank’s for your response!

Can I use logical operators like < > >= <= instead a simple = in the if section? By the way what programming language is it? And do you have any documentation?

Regarding the volume control: Will your solution send back the parameters to the device? It would be cool if the BCF could move the faders to the right position.

It’s the Pascal Script (http://www.remobjects.com/ps.aspx) scripting engine, so it’s Pascal syntax, and the most commonly used Delphi functions are available as well. And yes, you can use all of the common comparison operators.

Controlling the motor faders according to the current volume is rather difficult. I can try to write a script for it if I have some spare time in the next few days (I happen to own a BCF2000 as well).

I tried it with a little script and it didn’t work. Sometimes the script is loading and sometimes mAirlist says that there’s an error: “MidiOutOpen (device 1): Error 4”. And even when the loading succeeds, it doesn’t send anything.

Here’s my remote.ini. Device 1 is the BCF and Device 13 is a Akai MPD18.

[code][Remote0]
Type=MIDI
Enabled=on
Device=1
Message0=00B0D105
Action0=ENCODER MIC OFF
Message1=00B05185
Action1=ENCODER MIC ON
Message2=00B05400
Action2=PLAYER 1-1 STOP
Message3=00B05401
Action3=PLAYER 1-1 START
Message4=00B05501
Action4=PLAYER 1-2 START
Message5=00B05500
Action5=PLAYER 1-2 STOP
Message6=00B04C7F
Action6=PLAYER 1-1 RESET

[Remote1]
Type=MIDI
Enabled=on
Device=13
Message0=00802400
Action0=PLAYER 1-1 START/FADEOUT
Message1=00802500
Action1=PLAYER 1-2 START/FADEOUT
Message2=00803300
Action2=AUTOMATION 1 ON/OFF
Message3=00802700
Action3=ALL PLAYERS STOP
Message4=00802C00
Action4=CARTWALL 1 START/FADEOUT
Message5=00802D00
Action5=CARTWALL 2 START/FADEOUT
Message6=00802E00
Action6=CARTWALL 3 START/FADEOUT
Message7=00802F00
Action7=CARTWALL 4 START/FADEOUT
Message8=00802800
Action8=CARTWALL 5 START/FADEOUT
Message9=00802900
Action9=CARTWALL 6 START/FADEOUT
Message10=00802A00
Action10=CARTWALL 7 START/FADEOUT
Message11=00802B00
Action11=CARTWALL 8 START/FADEOUT
Message12=00803000
Action12=AUTOMATION 1 FORCENEXT
Message13=00803200
Action13=AUTOMATION 1 PLAY
Message14=00803C00
Action14=CARTWALL 1 PFL ON/OFF
Message15=00803D00
Action15=CARTWALL 2 PFL ON/OFF
Message16=00803E00
Action16=CARTWALL 3 PFL ON/OFF
Message17=00803F00
Action17=CARTWALL 4 PFL ON/OFF
Message18=00803800
Action18=CARTWALL 5 PFL ON/OFF
Message19=00803900
Action19=CARTWALL 6 PFL ON/OFF
Message20=00803A00
Action20=CARTWALL 7 PFL ON/OFF
Message21=00803B00
Action21=CARTWALL 8 PFL ON/OFF
Message22=00803400
Action22=PLAYER 1-1 PFL ON/OFF
Message23=00803500
Action23=PLAYER 1-2 PFL ON/OFF
Message24=00802600
Action24=PLAYLIST 1 NEXT
[/code]

This my test script.

[code]procedure OnLoad;
begin
MidiOutOpen(1);
end;

procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin

if (Status = $B0) and (Data1 = $51) and (Data2 >= $01) then
MidiOut(1, $B0, $50, $7F);
end;

begin
end.[/code]

Error 4 means “the device is already allocated”; it probably happens when you reload the script after a modification. I’m not sure right now, but the error in OnLoad might prevent the script from running altogether.

I propose you add an OnUnload hook where you close the device again:

procedure OnLoad;
begin
  MidiOutOpen(1);
end;

procedure OnUnload;
begin
  MidiOutClose(1);
end;

procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin

  if (Status = $B0) and (Data1 = $51) and (Data2 >= $01) then
    MidiOut(1, $B0, $50, $7F);
end;

begin
end.

Have you confirmed the device numbers by looking at the output of MidiOutListDevices? The input and output devices might use a different numbering.

Why don’t you use a fixed ID for every device? That’s absolutely confusing. Maybe the Windows device ID or a hash from the name of the device.

Alright, I got it. The mute function is working now. I installed an extra virtual midi device to send the midi-events from mAirlist to my DAW.

Thank you very much for your help!

Here’s the final script.

[code]procedure OnLoad;
begin
MidiOutListDevices;
MidiOutOpen(15);
end;

procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin

// mute the speakers
if (Status = $B0) and (Data1 = $51) and (Data2 >= $05) then
MidiOut(15, $B0, $50, $7F);

// un-mute the speakers
if (Status = $B0) and (Data1 = $51) and (Data2 <= $04) then
MidiOut(15, $B0, $50, $00);

end;

begin
end.[/code]

I also got the volume control working now. Lovely!

The thing is, I got more than one mic and I want to mute the speakers whenever any of them is open. (That works.) But I cannot un-mute them?

The syntax seems to be right and I can’t figure out, what’s wrong. Do you have any idea?

[code]procedure OnLoad;
begin
MidiOutListDevices;
MidiOutOpen(15);
end;

procedure OnUnload;
begin
MidiOutClose(15);
end;

procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
begin

// mute the speakers if any mic is open
if ((Status = $B0) and (Data1 = $51) and (Data2 >= $02)) or
((Status = $B0) and (Data1 = $52) and (Data2 >= $02)) then
MidiOut(15, $B0, $50, $7F);

// un-mute the speakers if all mics are closed
if ((Status = $B0) and (Data1 = $51) and (Data2 <= $01)) and
((Status = $B0) and (Data1 = $52) and (Data2 <= $01)) then
MidiOut(15, $B0, $50, $00);

end;

begin
end.[/code]

Check the second if statement… and vs. or.

If I change it to “or” it doesn’t recognize all open mics. So it should be “and”. I want ALL mics to be closed, before I un-mute the speakers.

Ah, OK, I see. Anyways, the “and” thing will not work, because you look for data1 being $51 and $52 at the same time, which will never happen.

Instead you have to save the state of either microphone in a variable, like this:

var mic1on: boolean; mic2on: boolean;

procedure OnLoad;
begin
mic1on := false;
mic2on := false;
MidiOutListDevices;
MidiOutOpen(15);
end;

procedure OnUnload;
begin
MidiOutClose(15);
end;

procedure OnMidiMessage(Device: integer; Status, Data1, Data2: byte);
var
changed: boolean;
isAboveThreshold: boolean;
begin
changed := false;

// is the fader above the threshold value?
isAboveThreshold := Data2 >= $02;

// fader for mic1 was moved
if (Status = $B0) and (Data1 = $51) then begin
changed := mic1on <> isAboveThreshold;
mic1on := isAboveThreshold;
end;

// fader for mic2 was moved
if (Status = $B0) and (Data1 = $52) then begin
changed := mic2on <> isAboveThreshold;
mic2on := isAboveThreshold;
end;

// only mute/unmute if something has changed
if changed then begin
if mic1on or mic2on then
MidiOut(15, $B0, $50, $7F) // mute
else
MidiOut(15, $B0, $50, $00); // unmute
end;
end;

begin
end.

(untested, might be typos in there)

Note the extra “changed” variable which will only be set to true if the state of any fader has changed; this avoids unnecessary calls to MidiOut when you move the fader within the “on” range.

Does this make the Beringer unit work as a multichannel mixer?

I am amused by this thread for some reason. I have one of these units in the closet so I am curious.

No, it just works as a remote control for the internal volume sliders in mAirList (and also that other MIDI device Cman78 is using).

Nice work Torben! There ain’t no tyos in it.

And what if I want to adjust the signal Element “MIC” in the GUI-section, to visualize if a mic is on. Can I use “ENCODER MIC ON” and “ENCODER MIC OFF” like in the remote configuration of mAirlist to make that thing a big red button? - A manual with these options and parameters would be very helpful.

That’s a good question. I would like to know this too.

You mean you want another, bigger MIC button than the default one (in the Encoder Status screen object)?

I suppose cman78 means the encoder thing. Anyway, is there some kind of documentation for all the options?

You don’t like to answer that, or do you?