cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
502
Views
1
Helpful
4
Replies

Macro for Room Kit EQ that mutes the mic inputs individually.

Mark-Harpum
Level 1
Level 1

We have had a request for a macro to be created for a Cisco EQ device that allows one of the microphone inputs to be muted via the touch panel.

The Cisco EQ system is using 2 microphone inputs on the codec, 1 for the ceiling mic and 1 that is connected to a mixer with 4 mics connected.

When we use the mics plugged into the mixer, the ceiling mic is still active at the same time in the room.
We want to be able to mute the ceiling mic when we use the other mics. Currently when both are in use we get an issue with Echo cancellation on the far end of the call. Echo control and noise reduction is on for all inputs. If the ceiling mic is unplugged then the issue goes away.
If we can have a macro created that mutes only 1 mic input on the UI, a toggle button that says ceiling mic mute would be ideal. This would resolve the issues in this room.

I have seen the microphone controls macro example on the codec macros page, it mutes groups of mics. I am new to macros and scripting so am not sure if it is as simple as changing a few things in the macro to make this work.

const ceilingMics = [5, 6, 7];
const panelMics = [2, 3, 4];

 Maybe changing this part to ceilingMics = [3] ;
                                             panelMics = [2] ;

Any help would be appreciated.

1 Accepted Solution

Accepted Solutions

sveistef
Cisco Employee
Cisco Employee

What you're asking is, as you say fairly simple. 
You can even automate the creation of the needed groupbutton to toggle between the two, if you want to have an "either/or".

To simplify, I've made it so it always defaults back to ceiling mics (input 2, you can also add input 1 to this group by uncommenting relevant lines).

Hope this can be helpful:

const xapi = require('xapi');
 
//Initialize and sync UI
function init(){
  xapi.Config.Audio.Input.Microphone[2].Gain.set(20);
  xapi.Config.Audio.Input.Microphone[3].Gain.set(20);
  xapi.Config.Audio.Input.Microphone[2].Mode.set("On");
  xapi.Config.Audio.Input.Microphone[3].Mode.set("On");
  xapi.Command.UserInterface.Extensions.Widget.SetValue({ Value: 'ceilingMics', WidgetId: 'micSelect'});
}
 
function guiEvent(event) {
  if (event.WidgetId === 'micSelect' && event.Type === 'released') {
    console.log(event.Value)
    switch (event.Value) {
      case 'ceilingMics':
        //xapi.Config.Audio.Input.Microphone[1].Gain.set(20);
        xapi.Config.Audio.Input.Microphone[2].Gain.set(20);
xapi.Config.Audio.Input.Microphone[3].Gain.set(0);
//xapi.Config.Audio.Input.Microphone[1].Mode.set("On");
xapi.Config.Audio.Input.Microphone[2].Mode.set("On");
xapi.Config.Audio.Input.Microphone[3].Mode.set("Off");
 
break;
      case 'panelMics':
        //xapi.Config.Audio.Input.Microphone[1].Gain.set(0);
        xapi.Config.Audio.Input.Microphone[2].Gain.set(0);
xapi.Config.Audio.Input.Microphone[3].Gain.set(20);
        //xapi.Config.Audio.Input.Microphone[1].Mode.set("Off");
xapi.Config.Audio.Input.Microphone[2].Mode.set("Off");
xapi.Config.Audio.Input.Microphone[3].Mode.set("On");
break;
      default:
    }
  }
};
 
xapi.Event.UserInterface.Extensions.Widget.Action.on(value => {
  guiEvent(value);
  //console.log(value);
});
 
 
function createPanel() {
  const panel = `
  <Extensions>
  <Version>1.11</Version>
  <Panel>
    <Order>6</Order>
    <PanelId>micSelectPanel</PanelId>
    <Location>HomeScreenAndCallControls</Location>
    <Icon>Microphone</Icon>
    <Color>#262626</Color>
    <Name>Select Microphones</Name>
    <ActivityType>Custom</ActivityType>
    <Page>
      <Name>Select Microphones</Name>
      <Row>
        <Name>Row</Name>
        <Widget>
          <WidgetId>micSelect</WidgetId>
          <Type>GroupButton</Type>
          <Options>size=4</Options>
          <ValueSpace>
            <Value>
              <Key>ceilingMics</Key>
              <Name>Ceiling mics</Name>
            </Value>
            <Value>
              <Key>panelMics</Key>
              <Name>Panel mics</Name>
            </Value>
          </ValueSpace>
        </Widget>
      </Row>
      <Options>hideRowNames=1</Options>
    </Page>
  </Panel>
  </Extensions>
  `;
 
  xapi.Command.UserInterface.Extensions.Panel.Save(
        { PanelId: 'micSelect' },
        panel
      );
 
createPanel();
init();

 

View solution in original post

4 Replies 4

sveistef
Cisco Employee
Cisco Employee

What you're asking is, as you say fairly simple. 
You can even automate the creation of the needed groupbutton to toggle between the two, if you want to have an "either/or".

To simplify, I've made it so it always defaults back to ceiling mics (input 2, you can also add input 1 to this group by uncommenting relevant lines).

Hope this can be helpful:

const xapi = require('xapi');
 
//Initialize and sync UI
function init(){
  xapi.Config.Audio.Input.Microphone[2].Gain.set(20);
  xapi.Config.Audio.Input.Microphone[3].Gain.set(20);
  xapi.Config.Audio.Input.Microphone[2].Mode.set("On");
  xapi.Config.Audio.Input.Microphone[3].Mode.set("On");
  xapi.Command.UserInterface.Extensions.Widget.SetValue({ Value: 'ceilingMics', WidgetId: 'micSelect'});
}
 
function guiEvent(event) {
  if (event.WidgetId === 'micSelect' && event.Type === 'released') {
    console.log(event.Value)
    switch (event.Value) {
      case 'ceilingMics':
        //xapi.Config.Audio.Input.Microphone[1].Gain.set(20);
        xapi.Config.Audio.Input.Microphone[2].Gain.set(20);
xapi.Config.Audio.Input.Microphone[3].Gain.set(0);
//xapi.Config.Audio.Input.Microphone[1].Mode.set("On");
xapi.Config.Audio.Input.Microphone[2].Mode.set("On");
xapi.Config.Audio.Input.Microphone[3].Mode.set("Off");
 
break;
      case 'panelMics':
        //xapi.Config.Audio.Input.Microphone[1].Gain.set(0);
        xapi.Config.Audio.Input.Microphone[2].Gain.set(0);
xapi.Config.Audio.Input.Microphone[3].Gain.set(20);
        //xapi.Config.Audio.Input.Microphone[1].Mode.set("Off");
xapi.Config.Audio.Input.Microphone[2].Mode.set("Off");
xapi.Config.Audio.Input.Microphone[3].Mode.set("On");
break;
      default:
    }
  }
};
 
xapi.Event.UserInterface.Extensions.Widget.Action.on(value => {
  guiEvent(value);
  //console.log(value);
});
 
 
function createPanel() {
  const panel = `
  <Extensions>
  <Version>1.11</Version>
  <Panel>
    <Order>6</Order>
    <PanelId>micSelectPanel</PanelId>
    <Location>HomeScreenAndCallControls</Location>
    <Icon>Microphone</Icon>
    <Color>#262626</Color>
    <Name>Select Microphones</Name>
    <ActivityType>Custom</ActivityType>
    <Page>
      <Name>Select Microphones</Name>
      <Row>
        <Name>Row</Name>
        <Widget>
          <WidgetId>micSelect</WidgetId>
          <Type>GroupButton</Type>
          <Options>size=4</Options>
          <ValueSpace>
            <Value>
              <Key>ceilingMics</Key>
              <Name>Ceiling mics</Name>
            </Value>
            <Value>
              <Key>panelMics</Key>
              <Name>Panel mics</Name>
            </Value>
          </ValueSpace>
        </Widget>
      </Row>
      <Options>hideRowNames=1</Options>
    </Page>
  </Panel>
  </Extensions>
  `;
 
  xapi.Command.UserInterface.Extensions.Panel.Save(
        { PanelId: 'micSelect' },
        panel
      );
 
createPanel();
init();

 

Mark-Harpum
Level 1
Level 1

Hi, thank you for this. I really appreciate the help. 
It is for a user in Macedonia so I'll send it his way and ask him to upload it. 

Will this work on any codec or just an EQ? I don't have access to an EQ unit but I do have access to room kits and room kit pros. I'd like to test it on a unit I can access first if possible.

Thanks again!

Mark.

sveistef
Cisco Employee
Cisco Employee

This particular macro was written for the EQ. If you want to do the same on the Codec Pro, you'll need to substitute Gain with Level, and adjust the default values. The rest should be the same.
So in effect, 

xapi.Config.Audio.Input.Microphone[2].Gain.set(20);
should be replaced by
xapi.Config.Audio.Input.Microphone[2].Level.set(58);

Mark-Harpum
Level 1
Level 1

Thanks for the quick reply. I'l have a go today.

Much appreciated.

 

Mark.