To reconfigure the parameters of LocalizeMUSIC , SourceTracker , and HRLE dynamically during execution of a network, this node subscribes parameters of the three modules through socket communication and passes the parameter to the three modules.
None.
When to use
This node is used when wishing to reconfigure parameters of LocalizeMUSIC , SourceTracker , and HRLE dynamically while executing a network.
Typical connection
Figure 6.92 shows the usage example of HarkParamsDynReconf node.
LocalizeMUSIC , SourceTracker , and HRLE in Figure 6.92 have the PARAMS input terminals that are not displayed by the default. Figure 6.93 shows how to add the invisible input terminal PARAMS.
Input
No inputs.
Output
: Vector<ObjectRef> type. This outputs the parameters of LocalizeMUSIC . This should be connected to the PARAMS input terminal of LocalizeMUSIC .
: Vector<ObjectRef> type. This outputs the parameters of SourceTracker . This should be connected to the PARAMS input terminal of SourceTracker .
: Vector<ObjectRef> type. This outputs the parameters of HRLE . This should be connected to the PARAMS input terminal of HRLE .
Parameter
Parameter name |
Type |
Default value |
Unit |
Description |
PORT |
Port number for the socket connection |
|||
ENABLE_DEBUG |
false |
Enable debug output |
: int type. This parameter defines the port number for socket communication.
: bool type. If true, the debug message is printed to the standard output.
This node works as a server of a non-blocking socket communication and subscribes parameters of LocalizeMUSIC , SourceTracker , and HRLE from a client program. After receiving the new parameters, this node sends the parameter to the three nodes.
The subscribed data should be a float type vector with the size 12, denoted as buff[12] hereinafter. If the current frame receives new parameters, the parameters are updated. If not, the parameters keep the previous ones.
The received data, buff[12], is decoded as follows and sent to the next nodes.
NUM_SOURCE (LocalizeMUSIC ) : (int)buff[0]
MIN_DEG (LocalizeMUSIC ) : (int)buff[1]
MAX_DEG (LocalizeMUSIC ) : (int)buff[2]
LOWER_BOUND_FREQUENCY (LocalizeMUSIC ) : (int)buff[3]
UPPER_BOUND_FREQUENCY (LocalizeMUSIC ) : (int)buff[4]
THRESH (SourceTracker ) : (float)buff[5]
PAUSE_LENGTH (SourceTracker ) : (float)buff[6]
MIN_SRC_INTERVAL (SourceTracker ) : (float)buff[7]
MIN_TFINDEX_INTERVAL (SourceTracker ) : (float)buff[8]
COMPARE_MODE (SourceTracker ) : (Source::CompareMode)buff[9]
LX (HRLE ) : (float)buff[10]
TIME_CONSTANT (HRLE ) : (int)buff[11]
This node supports the reconnection of client programs.
Here is an example of a client program written in python.
#!/usr/bin/python import socket import struct HOST = ’localhost’ # The remote host PORT = 9999 # The same port as used by the server sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((HOST, PORT)) buff = [2.0, -180.0, 180.0, 500.0, 2800.0, 30.0, 800.0, 20.0, 6.0, 0.0, 0.85, 16000.0] msg = struct.pack("f"*len(buff), *buff) sock.send(msg) sock.close()