## 6.7.4 HarkParamsDynReconf

### 6.7.4.1 Outline of the node

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.

### 6.7.4.3 Usage

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.107 shows the usage example of HarkParamsDynReconf node.

LocalizeMUSIC , SourceTracker , and HRLE in Figure 6.107 have the PARAMS input terminals that are not displayed by the default. Figure 6.108 shows how to add the invisible input terminal PARAMS.

### 6.7.4.4 Input-output and property of the node

Input

No inputs.

Output

LocalizeMUSIC

: Vector<ObjectRef>  type. This outputs the parameters of LocalizeMUSIC . This should be connected to the PARAMS input terminal of LocalizeMUSIC .

SourceTracker

: Vector<ObjectRef>  type. This outputs the parameters of SourceTracker . This should be connected to the PARAMS input terminal of SourceTracker .

HRLE

: Vector<ObjectRef>  type. This outputs the parameters of HRLE . This should be connected to the PARAMS input terminal of HRLE .

Parameter

Table 6.91: Parameter list of HarkParamsDynReconf
 Parameter name Type Default value Unit Description PORT 9999 Port number for the socket connection ENABLE_DEBUG false Enable debug output
PORT

: int type. This parameter defines the port number for socket communication.

ENABLE_DEBUG

: bool type. If true, the debug message is printed to the standard output.

### 6.7.4.5 Details of the node

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.

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()