Pipe In CHOP

From TouchDesigner 099 Wiki

Summary

The Pipe In CHOP allows users to input from custom devices into CHOPs. It is implemented as a TCP/IP network connection.

The connection can be from a user-written program that outputs to the Pipe In CHOP's port, or from another TouchDesigner process, where the data is coming from a Pipe Out CHOP.

Regular channel data sent to Pipe In outputs has CHOP channels (channel names with floating point values every frame). Mixed with it can be TouchDesigner scripting commands that get executed when they arrive.

TIP: The TCP/IP In DAT or UDP In DAT is the preferred way to send script commands and other data packets over the network.

This node differs from the Touch In CHOP as it functions using a stream of commands, instead of a simple stream of channel data like the Touch In CHOP. Information comes in in various commands which are documented in the files located in your installation directory C:/Program Files/Derivative/TouchDesigner*/touch/docs/pipe.

To receive network data from another "server" computer (e.g. from a TouchDesigner Pipe Out CHOP running remotely), a connection must be established between the server and the Pipe In CHOP before data is sent. You must supply the Server Address and Port from which to receive incoming data to a channel. The server should be listening for connections on the port that this CHOP is using.

NOTE for Windows OS - If experiencing connection issues make sure Windows Firewall is disabled.

See also Shared Mem In CHOP.

PythonIcon.png pipeinCHOP_Class

Interfacing User Program / Device to TouchDesigner

The Pipe In CHOP allows you to interface to CHOPs from other programs and input devices. To make it work, you need a program that gets values from the input device, and writes them to a Network port.

The values are output in a format that is specified in the sample code. You can find a compilable example of a Pipe In application in the TouchDesigner installation directory:

C:/Program Files/Derivative/TouchDesigner*/touch/docs/pipe

The user's custom program writes formatted messages into the port, and the Pipe In CHOP reads it, creating the channels specified in the messages. Simple human-readable ASCII commands are sent to the CHOP, via the TCP/IP (network) connection.

Networking TouchDesigner to TouchDesigner

To set up a link between two TouchDesigner processes, one process should have a Pipe Out CHOP active (thus listening for connections) on an arbitrary port (i.e. port #5010).

The second TouchDesigner process uses a Pipe In CHOP with the network address set to the name of the machine that the first TouchDesigner process is running on. The network port should be set to the same port as the server (in this case, 5010).

Pipe In/Out CHOPs with matching port numbers on different machines will automatically sense one another. Multiple Pipe In CHOPs can connect to a Pipe Out CHOP.

Parameters - Pipe In Page

Originate - Determines whether the Pipe In CHOP or the Pipe Out CHOP tries to initiate the communication. Only one of the two CHOPs attempting to connect can have this flag on, either the Pipe In or Pipe Out, but not both. One side must originate, and the other side must have that location specified.

Server Address/address - The network address of the server computer. This address is a standard WWW address, such as 'foo' or 'foo.bar.com'. You can use an IP address (e.g. 100.123.45.78) or the computer's network name can be entered. If you put "localhost", it means the other end of the pipe is on the same computer.

Server Port/port - The network port of the server.

Active/active - While On, the CHOP receives information from the pipe or server. While Off, no updating occurs. Data sent by a server is lost, but a pipe will store the data until Active is turned on again. If in Network mode, turning this parameter on initiates a connection, and turning it off breaks the connection.

Queued/queued - When checked on, the network queuing is enabled. See the following parameters. Minimum Target/mintarget - the lower end of the queue target range. The Pipe In CHOP will try to maintain a queue length greater than or equal to this value.

Maximum Target/maxtarget - the upper end of the queue target range. The Pipe In CHOP will try to maintain a queue length less than or equal to this value.

Maximum Queue/maxqueue - The maximum size of the queue when full. Incoming samples will be dropped if the maximum queue is reached. This also affects the maximum number of script commands that can be queued up before they start gettting dropped.

Queue Adjust Time/adjusttime - specifies how often to repeat/drop a samples in order to get closer to the queue target range. If the value = 1 and the units = seconds, then it will try to repeat/drop a sample once per second to maintain the queue target set in the Minimum Target and Maximum Target parameters above.

Reset Channels/reset - Discards and clears all channels and incoming data.

Allow Incoming Scripts/allowscripts - Incoming script commands will be ignored unless this parameter is turned On. Turning it Off is more secure.

Echo Messages to Console/echo - Print all incoming commands (not channel data) to the Console which can be opened from the Dialogs menu. A good way to test a connection is to put "echo X" commands in the incoming stream.

Script DAT/callbacks - Path to a DAT containing callbacks for each event received. See pipeinCHOP_Class for usage.

NOTE on Time Slicing

When Time Slice flag is On, the Pipe In CHOP ignores 'block', 'rate' and 'start' commands, and takes full range coming in, not just last time slice. The Time Slice flag is on the Common page of parameters.

Programming the Pipe In CHOP

The Pipe In CHOP is designed to allow you to program an interface to CHOPs from other programs, input devices or TouchDesigner running on another computer.

This is done by sending simple human-readable ASCII commands to the CHOP, via a TCP/IP (network) connection.

Source Code Example - You can find a compilable example of a Pipe In application in the TouchDesigner installation folder:

C:/ProgramFiles/Derivative/TouchDesigner*/touch/docs/pipe

Tips

If you are having problems with Pipe In and Pipe Out CHOPs not connecting, try turning off the Windows Firewall in the Security Center (or any other firewall application you have running).

See also TCP/IP In DAT.