ΣSigmaStudio Ask AI Русский Log in

Changing SigmaStudio equalizer 'Boost' levels from MATLAB

SigmaDSP & SigmaStudio 5kØ Feb 5, 2013 00:00 5 replies Original on forum ↗
Subscribe
5kØ Question
Feb 5, 2013 00:00

Hi!

I'm trying to set the 'Boost' values of a SigmaStudio Medium Size Eq in an existing project from MATLAB. For this purpose I've set up SigmaStudio as a MATLAB COM server.

MATLAB script:
cd 'C:\Program Files\Analog Devices\SigmaStudio 3.8';

SS = actxserver('Analog.SigmaStudioServer.SigmaStudioServer');

SSinterfaces = SS.interfaces;

sssvr = SS.invoke('ISigmaStudioServer')

sssvr.OPEN_PROJECT('C:\...\TEST.dspproj')

This works, but now I want to set the 'Boost' property of the equalizer:

sssvr.SET_OBJECT_PROPERTY('setControlValue','Mid EQ2', 0, 0, 'Boost', 6)

This returns the error: No method 'SET_OBJECT_PROPERTY' with matching signature found for class 'Interface.2942E58A_4461_410E_87B3_64152C81935F'.

I can however change the name of the equalizer using SET_OBJECT_PROPERTY, so it's not that the function is entirely unavailable.

sssvr.SET_OBJECT_PROPERTY('setName','Mid EQ2', 'LeftEQ')

Strangely enough, I get no errors when I provide only three inputs in combination with 'setControlValue' (but it doesn't do anything useful either).

sssvr.SET_OBJECT_PROPERTY('setControlValue','Mid EQ2', 0)

or for example

sssvr.SET_OBJECT_PROPERTY('growAlgorithm', 'Mid EQ2', 0)

Is the input of SET_OBJECT_PROPERTY somehow limited to 3 parameters, even if some of the OPcodes require more?

Anyways, I then thought I should try to initialize a SigmaStudio script from MATLAB to accomplish my goal. The following SigmaStudio script works:

// #LANGUAGE# C#

int Boost1;

Boost1=3;

sigmastudio.ObjectSetProperties("setControlValue","Mid EQ2", 0, 0, "Boost", Boost1);

However I need to set the variable Boost1 to a value calculated in MATLAB. I can of course write the calculated values to a text file containing only integers with MATLAB. But how do I read those into variables using the SigmaStudio Script Editor? I googled some C# scripts (I have no personal C# experience whatsoever) like

string fileContent = System.IO.File.ReadAllText("somefile.txt");

string[] integerStrings = fileContent.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

int[] integers = new int[integerStrings.Length];

for (int n = 0; n < integerStrings.Length; n++)

integers[n] = int.Parse(integerStrings[n]);

But the Script Editor throws me an 'Illegal syntax detected in Script' error, because 'The use of .NET Reflection is not allowed. Please rename any variables that resemble System.Reflection members.'

Now I'm flat out of ideas. Can anyone please help me get the integer values calculated in MATLAB into the Boost setting of the SigmaStudio Equalizer?

script

matlab

sigmastudio

ADIApproved Reply
Feb 6, 2013 00:00

Hello,

I have pointed the software team to this thread. They might be able to provide some insight.

Thanks,

Brett

ADIApproved Reply
Feb 6, 2013 00:00

Hi,

I believe your issue is related to the the data type of the "value" it is type sensitive depending on the parameter. Try using "6.0". I have attached a rather old but hopefully still functional MATLAB sample that uses string based scripts, maybe you will find it useful.

Best regards,

John

5kØ Reply
Feb 7, 2013 00:00

Your string based scripts showed me how to do it!

It turns out that:

sssvr.SET_OBJECT_PROPERTY('setControlValue','Mid EQ2', 0, 0, 'Boost', 6)

doesn't work, because only 3 input variables are expected, the last of which should be a SafeArray. I didn't get it to recognize MATLAB arrays though.

From your files however, I realized there was also the option of making SigmaStudio interpret a MATLAB string as a script. So then it was straight forward:

% Format function inputs into a SigmaStudio script string:

script = 'ss.ObjectSetProperties("setControlValue","Mid EQ2",0,0,"Boost",6);';

% Run the script

sssvr.RUN_SCRIPT( script );

Thank you!

Pierre_B Reply
Nov 19, 2013 00:00

Hi,

I have issue, that can be solved by using RUN_SCRIPT.

To change a huge amount of biquads, this solution is too slow to be applied in real time (8sec for 36 * 5 coefficients)

I guess that using the C# script interpretor as an additionnal layer between Matlab and the processeur shall be one of the problem.

Does anybody know the real syntax of SET_OBJECT_PROPERTY ?

Thanks,

Pierre

jeffrex Reply
Jul 20, 2018 00:00

This is still a relevant set of questions- can anyone at ADI revisit? The script solution is way too slow, requiring about 110ms for any parameter on my setup. I found this:

How can I pass arguments to an ActiveX server from MATLAB 7.0 (R14) as one-dimensional arrays? - MATLAB Answers - MATLAB…

which seems like it would be helpful, but

feature('COM_SafeArraySingleDim', 1)
did not help. Anyone have any advice?

SigmaStudio 4.1, Matlab 2017b.

Thanks,

Jeff