...
The AWD which works with these scripts is attached below. Load this AWD into Audio Weaver, then build and run the layout. Finally, run the script.
View file | |||||||
---|---|---|---|---|---|---|---|
|
Python 2.7 and 3.11
Code Block | ||
---|---|---|
| ||
import socket import time TCP_IP = 'localhost' TCP_PORT = 15007 BUFFER_SIZE = 1024 # Open a TCP socket to AWE Server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) print ("Scaler 1") # Read the value of thescaler scaler1's gain s.send(b'0,get_value,Scaler1.currentGain\n') data = s.recv(BUFFER_SIZE) print (data) # Attenuate channelscaler 1 to 0.5 s.send(b'0,set_value,Scaler1.currentGain,0.5\n') data = s.recv(BUFFER_SIZE) print (data) print ("Scaler 2") # Read the value of scaler 2's gain s.send(b'0,get_value,Scaler2.currentGain\n') data = s.recv(BUFFER_SIZE) print (data) # Attenuate Scaler 2 to 0.5 s.send(b'0,set_value,Scaler2.currentGain,0.5\n') data = s.recv(BUFFER_SIZE) print (data) |
The expected output is shown below.
...
Note the integer value that comes after the “success” status in the responses. This is the parameter ID for the chosen module variable that you accessed using the Mod.Var format. In the case of Scaler1, no objectID was assigned, so this value is dynamically determined when the layout is built and run (i.e., unpredictable).
If you assign an objectID, as is shown with Scaler2 below, the value will be the decimal equivalent of that parameter’s handle, as shown in the generated ControlInterface.h file:
#define AWE_Scaler2_currentGain_HANDLE 0x07530009
0x07530009 = 122880009 (decimal)
...
MATLAB (tested with r2023b)
...