BIAMP volume control, using rs232
wilsoncarter
Posts: 15
i had a project which is needed to interface with biamp's rs232.
no matter what the code is, just would like to know how to convert the scale of the fader to a percentage for feedback, it makes me pull my head out.
ok.
1st i ask for biamp's fader value,
then i can use increase vol code to ramp it up,or down
however the feedback is needed to be a percentage, as if you know, the scale of a fader is not that smooth when it close to 0 db especially in the range of 0 - 12db.
i need to scale it at the site as well.
is that any code i can just convert and define a scale by myself in amx?
no matter what the code is, just would like to know how to convert the scale of the fader to a percentage for feedback, it makes me pull my head out.
ok.
1st i ask for biamp's fader value,
then i can use increase vol code to ramp it up,or down
however the feedback is needed to be a percentage, as if you know, the scale of a fader is not that smooth when it close to 0 db especially in the range of 0 - 12db.
i need to scale it at the site as well.
is that any code i can just convert and define a scale by myself in amx?
0
Comments
I have not found the need to sclae teh volume any differently depending on where the level is.
The Biamp runs from -100 to +12 a total of 112 steps. Realistically anything lower than -40 is probably pointless, so for most things I set a minimum level of -40, althought I have a constant to adjust that and the maximum level.
I use a signed integer and run my volume from my nminimum to my maximum, note that either can be negative. I also use a constant to allow me to change my increment/decrement amount, Usually I use 2.
note that all of these can be arrays
that takes your range of volume levels from your minium to your maximum and scales it to the 0-255 for the bar graph
Just general information.
To scale a range of values:
Determine the Range of values to be scaled. Subtract the low from the high. If you are working with signed values remove the negative sign and add the 2 values.
Determine the Range you want to go to. Percent is 100. AMX bars are 255 (default)
Now multiply the unscaled value by the range you want to go to.
Then divide it by the range that you are coming from.
So you have this: ( UnScaledValue*NewRange)/OldRange = ScaledValue
Example: (25*255)/100 = 63 (integer math dropping the float) So 25% of 255 is 63.
However, for more details, as if you are a audio tech u will know that, 2 db is a lot when close to 0db, because 3 db is doubled the volume already.
however the 2 db when close to -40 db is nth.
so if just simply write 2 db per press, the volume will go up really fast at the end.
will that be sth like:
if nCurVol < -5
nCurVol = nCurVol + 2
else if nCurVol>-5
nCurVol = nCurVol + 0.5
however there have no data type to support negative floating point, may be just multi it by 10 then divide it back when doing the scaling
if(cVolLevel<=-30 && cVolLevel >=-40)
nVolChange = 5
etc.
But I don't believe you really need to do that. I started in audio production doing live sound and recording before going into programming. A dB is a ratio between 2 levels. It is a linear scale. The electrical, or accoustical, power is changing non-linearly, but we convert that with logs to a linear change. 2 dB is 2dB no matter where it is is the overall level scale.
Anytime you double the electrical power of a circuit you increase by 3dB the audio level. That happens between -40dB and -37dB, as well as 0dB to +3dB.
The AMX level gets somewhat more accurate this way...
I know this thread is a year old, but I wanted to post code that can detect the current level value. I have it set to call this for each of my microphone levels whenever the "Volume" page is selected on a nxt-cv7 touchpanel. There are several levels above this one, so I have a wait statement that increments by 5 before each new level check. It does take up to 6 seconds for the page to refresh every level, so I am thinking about only doing this on a power loss event from one of the panels. However, people do adjust volume from davinci also, so I might just leave this and mess with the wait timing. I am connected via rs-232 to a biamp nexiavc and a nexiaTC but I will just list what I have for one of the VC levels since the code would be the same for either. I had a lot of trial and error with this to get the wait times down but found that removing them resulted in no data feedback.
Data_event[BIAMPVC]
{
Online:
{
SEND_COMMAND BIAMPVC,'SET BAUD 38400,N,8,1'
}
Offline:
{
}
String:
{
s_buffervc="data.text"
}
}
button_event[vTP,4] //volume page selected from menu
[
PUSH:
wait 50 //there are several volume levels before this one and the wait is incremented by 10 for each one. Try lowering the wait times to see what the threshold is.
{
{
s_buffervc = "" // clears out any previous values
wait 3
{
SEND_STRING BIAMPVC,"'GET 0 AECINPLVL 11 1',10"
{
WAIT 1
{
SET_LENGTH_STRING(S_BUFFERVC,LENGTH_STRING(s_buffervc)-8) //the -8 takes out the extra decimal places in the response. In their manual it says that it will output 4 decimals places but I have found that it is much more.
{
SEND_COMMAND vTP,"'^TXT-5,0,',S_BUFFERVC" //I have the level feedback in numeric form instead of bargraph form due to space limitations but it still looks really nice.
}
}
}
}
}
}
}
you may use the fnScaleRange() function from the attached Math.axi. Pretty simple to use.
It's attached as "Math.axs", because uploading an AXI is not possible. Simply rename the filetype.
Regarding the Audia/Nexia protocol: there are also commands implemented SETD and GETD. Using these command types, the unit will respond with the full parameter path, instead of just responding with a +OK (SET/SETL) or a value (GET/GETL). More data to parse, but much more reliable, and it is also not required to remember what control object you have set or requested previously. Protocols attached.
Ok, you are using the GET command which will just spit back a numeric response without any identification as to which GET command it is a response to. You are keeping track of which query it is a response to by timing. There are two ways that you can speed this up.
1. You can queue your queries and time them with a wait_until and a variable.
2. Probably easier, you can use the GETD command which will include details of the command that the response is a response to. Then you can parse and sort the response rather than relying on query timing. With a biamp, I do this with a timeline that fires every 100 ms (.1 sec). I suspect that the Biamp probably responds quickly enough (or has a sufficient buffer) so that you could run the queue at 50 ms, but I've never tried it.
here's a bit of how you might do this parsing:
Then you may scale the gain value for a gauge display, if you like, or use ftoa for an ascii display. Won't have to bother with those pesky zeroes.
Anyway, that's something for you to consider.
Wow these methods are awesome! Thanks! I have a nasty habit of making things more complicated than they need to be.