Reading a parameter by name from SigmaStudio in MATLAB.
I am able to write parameter values to the hardware in MATLAB by running a script defined as follows, for example:
'ss.ObjectSetProperties("setControlValue","SDSP-myproject.Compressor",0,0,"Threshold");'
But there seems to be no way to read a parameter value in the same way because the script has only true or false as its output, and MATLAB doesn't do output parameters in the function call.
So I tried on ADAU1787 to use PARAMETER_READ_FLOAT_USING_NAME() but then found that there was no such name mapped to the compressor threshold.
I was wondering if anyone has met this issue with MATLAB.
Also I didn't receive any confirmation of my previous request about IIR coefficient (b0,b1,b2,a0,a1) write by name in the interface - I was wondering if that can be answered.
ADAU1787
Integrated/Special Purpose A/D Converters
Audio CODECs
Hello Peter,
Can you upload your project so we can see what compressor you are using and other details?
Dave T
myproject.dspproj
Hi Dave,
I can create a script in MATLAB :
myscript = 'ss.ObjectSetProperties("setControlValue","SDSP-myproject.Compressor",0,0,"Threshold", -6.0);'
which succeeds in setting the threshold.
But I cannot find a way to read this threshold using the control name "SDSP-myproject.Compressor" and parameter name "Threshold" as I did in the write.
Best regards
Peter
Hello Peter,
Have you read the links that are on this Wiki page?
SigmaStudio Scripting [Analog Devices Wiki]
There are a couple of links that refer to Matlab interfacing. The answers should be there.
Dave T
Hi Dave,
Unfortunaltely there are no examples in that Wiki that let me read a compressor property using MATLAB. I agree they should be there, but they are not.
The problem remains as I put forward in the initial question :
- MATLAB cannot read a value using a scripted ss.ObjectGetProperties() because the return value is a truth value not the property in question.
- I have tried other possible methods for this, but they do not respond to the parameter name (i.e. Threshold).
I am a trying to be really specific, but without the specific documentation, it's all a bit too difficult. The problem I think is that the interface is not complete and not documented.
Peter,
I had added some more info to the Matlab scripting page, but I forgot to approve it to expose it to the public. Please see here for info on generating a table of functions, arguments, and return values for accessing SigmaServer from Matlab.
As shown above, GET_OBJECT_PROPERTIES() has two return values. The Matlab notation:
[firstRetVal, secondRetVal] = Function();
must be used to access both return values. By default, you'll only get the first, which isn't very useful in this case. If this doesn't solve your problem, please let me know and I'll write a more complete example.
Ken
Hi Ken,
Thanks for looking into this. It's no problem to generate the table, but it is not clear how to represent the system object parameter to GET_OBJECT_PROPERTY(). I can see that the opcode getControlvalue has the following structure
As I mentioned the following script works, so SigmaStudio identifies the control value correctly as 0,0,"Threshold"
'ss.ObjectSetProperties("setControlValue","SDSP-myproject.Compressor",0,0,"Threshold", -6.0);'
but when I supply an object {0,0, "Threshold"} to GET_OBJECT_PROPERTY
i.e.
[x, y] = s.ss.GET_OBJECT_PROPERTY("getControlValue", "SDSP-myproject.Compressor",{"0", "0","Threshold"})
MATLAB returns :
Error using Interface.2942E58A_4461_410E_87B3_64152C81935F/GET_OBJECT_PROPERTY
Error: The parameter is incorrect.
So I then created a class (MATLAB R2021a) of base type matlab.System to encapsulate the data
classdef paramclass <matlab.System
properties
i1
i2
name
end
methods
function obj = paramclass(i1, i2, name)
obj.i1 = i1;
obj.i2 = i2;
obj.name = name;
end
end
end
and generate an instance and supply as the final parameter
p = paramclass(0,0,"Threshold");
And supply it to GET_OBJECT_PROPERTY() but then I get logical false as my result.
It's not clear what format the system object needs to be as the final parameter. An example would be essential in this context, if that's possible please.
Peter
I managed to solve the same issue in python not sure if this is useful for you but leaving it here.
basically, the out variable in the com server function has to be declared as a VARIANT Array type like this:
outvar = win32com.client.VARIANT(win32com.client.pythoncom.VT_BYREF | win32com.client.pythoncom.VT_ARRAY | win32com.client.pythoncom.VT_VARIANT, None)
z = ss_server.GET_OBJECT_PROPERTY("getControlValue", "vol", outvar , 0,0,'Gain')
and it works well
Please log in to reply.

