Houdini 17.0 Nodes Channel nodes

Pipe In channel node

Pipes data from custom devices into a CHOP, without needing the Houdini Developers' Kit or knowledge of Houdini internals.

On this page

You can use a "named pipe" or "FIFO" (first in, first out) on Linux and Mac OS X (see man -S 7 pipe) or a network connection (for remote connections) on Windows, Linux, and Mac OS X.

You need a program that gets values from the input device, and outputs them into a file specified in Filename or a Network port. Your custom program writes formatted messages into the file or port, and the Pipe In CHOP reads it, creating the channels specified in the messages.

Networking into Houdini

You can receive network data from another server (e.g. from a Houdini Pipe Out CHOP running remotely). A connection must be established between the server and the Pipe In CHOP before data is sent. Do this by changing the Source from Pipe to Network). 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.

To setup a link between two Houdini processes, one process should have a Pipe Out CHOP active (thus listening for connections) on an arbitrary port (i.e. port #5010). The second Houdini uses a Pipe In CHOP with the network address set to the name of the machine that the first Houdini process is running on. The network port should be set to the same port as the server (in this case, 5010). The port number can be any number between 5000 and 10000, as long as it is consistent between the Pipe In and Pipe Out CHOPs. For more than one connection, use distinct port numbers. Pipe In/Out CHOPs with matching port numbers on different machines should automatically sense one another.

If you just want to send data from a local process to Houdini, set the server address to localhost.

Programming the Pipe In CHOP

The Pipe In chop is designed to allow you to program an interface to chops that do not require a Houdini Developers Kit.

The Pipe In CHOP allows Houdini to read information in a special formats described here from a FIFO (First In, First Out) file and create CHOP channels. As long as the correct formats are used, Houdini will be able to get data from any source including devices such as a joystick, microphone or PuppetWorks' hardware.

The Pipe In CHOP has two parameters and parses three command formats. The first parameter specifies which file to read from and the second toggles between active (reading) and inactive (discards data) modes. The formats supported allow the following functionality: upload the most current sample data, upload all sample data and create a full waveform, and upload the channel names.

Using the Pipe In CHOP

In order to read information with this chop, a separate application has to be developed to write to a FIFO in the proper format. The following sections describe and give sample code (written in C) for opening a file and writing values that will be accepted by the Pipe In CHOP.

Opening a Fifo File

To create a file that the Pipe In CHOP will read from, use the following code to open a new FIFO called FIFO_NAME. Define FIFO_NAME to be the desired file name to create. The output stream that is used for writing will block until a reader is connected to the file.

#include    <sys/types.h>
#include    <sys/stat.h>
#include    <stdio.h>
mode_t       prev_mask;
FILE        *output = 0;
/* Create a new fifo */
prev_mask = umask(0);
mkfifo (FIFO_NAME, 0666);
umask(prev_mask);
/* Open the file for writing */
fprintf(stderr,
"Awaiting reader of FIFO %s\n\r", FIFO_NAME);
output = fopen(FIFO_NAME, "wb");

Writing To The File

The Pipe In chop reads information from the FIFO in eight-byte big endian chunks of data called tokens, so it is necessary to write to the file in the same format. There is also a method in place for sending an escape character in case a reset is required in the middle of parsing a command.

Note

In versions prior to Houdini 12, 4 byte tokens were used instead of 8 byte tokens.

The reset character is an integer value of 170. When this byte is received, followed by a byte with a value of zero, the current parsing is reset. In order to send a value of 170 without the command being reset, two bytes with a 170 value must be sent consecutively so that the Pipe In CHOP will disregard the first value.

#define ESCAPE_CHARACTER        170
void
write_byte(char b, FILE *output)
{
    /* Prepend escape character */
    if (b == ESCAPE_CHARACTER)
      fputc(ESCAPE_CHARACTER, output); 
      fputc(b, output);
}
void
write_values(const char *p, int size, FILE *output)
{
    int          i;
    for(i=0; i<size; i++)
      write_byte(p[i], output);
}
void
send_reset(FILE *output)
{
    fputc(ESCAPE_CHARACTER, output);
    fputc(0, output);
    fputc(ESCAPE_CHARACTER, output);
    fputc(0, output);
    fputc(ESCAPE_CHARACTER, output);
    fputc(0, output);
    fputc(ESCAPE_CHARACTER, output);
    fputc(0, output);
    fflush(output);
}

Using these functions, any 8 bytes of data (e.g. 00000001, 3.141, Chan, …) can be sent to the file. To send a reset signal, four escape sequences are written to pad to 8 bytes. It is a good idea to send a reset signal before the command and flush the FIFO at the end of a command.

int64       token;
double            sample;
send_reset(output); 
/* Send a command here */
write_values((char *)&token, sizeof(token), output);
write_values((char *)&sample, sizeof(sample), output);
fflush(output);

Note

An escape character (170) can be sent, followed by any other character, to stop the current command parsing and begin again. If the 170-170 sequence is sent, the first character is ignored and the value is sent normally.

Command Type #1: Current Values

The first type of command that the Pipe In CHOP will read is used to get the most recent channel data. It has a default sample rate of 30 samples per second, CHOP length of 1, and a start position of 0. This command allows the number of channels to be set and the samples associated with those channels to be read.

(int64) 1

Command Type.

(int64)

Number of Channels.

(double)

Sample Data, one sample for each channel.

Command Type #2: Upload

The second type of command that can be parsed is used to upload a full set of samples to create a waveform. The sample rate, track length, start position, number of channels, and samples for each channel to fill the track length must be provided. The channel samples must be interleaved so that all the channels for one index are filled before moving forward to the next index.

(int64) 2

Command Type.

(int64)

Track Length.

(double)

Sample Rate.

(double)

Start Index.

(int64)

Number of Channels.

(double)

Sample Data, one sample for each channel for each index.

Command Type #3: Channel Names

This command allows the channels to be assigned names before they are created. Since the names are usually strings, it is important to remember to write them as eight-byte tokens (padded with zeroes at the end if necessary) so they will be parsed correctly. This format requires the number of names to be set, followed by the name length (in number of eight-byte tokens) and name data for each channel.

(int64) 3

Command Type

(int64)

Number of Names

For each name, the following data is read:

(int64)

Name Length, one per name

(char*)

Name Chunks (char\/nodes/chop/8\ * Name Length)

Command Type #4: Disconnect

This command causes the Pipe In CHOP to disconnect the network connection. It is typically sent by the Pipe Out CHOP when its Active parameter is turned off or if the node is bypassed.

(int64) 4

Command Type

Additional commands

delay refresh
    (int64)        5 - command type
    (int64)        - seconds to delay

script
    (int64)        6 - command type
    (int64)        - Script Length
    (char*)        - Script Chunks (char[8] * Script Length)

Writing a Command

Using command type 1 as an example, the following function could be used to send a command to the FIFO which will be read by the Pipe In CHOP.

void
send_current_values(FILE *output, int num, double *samples)
{
    int64       token;
    int         j;
    send_reset(output);             /* just to be safe */
    /* Command Type */
    token = 1;
    write_values((char *)&token, sizeof(token), output);
    /* Number of Channels */
    token = num;
    write_values((char *)&token, sizeof(token), output);
    /* Sample Values */
    for(j=0; j<num; j++)
      write_values((char *)&samples[j],
        sizeof(samples[j]), output);
      fflush(output);
}

Source Code Example

You can find a compilable example of a Pipe In application in:

$HH/public/PPD.tar.Z

One device that is implemented using this protocol the Puppetworks device, and its driver can be installed via the proto_install application.

Parameters

PipeIn

Source

Data can be piped in through a UNIX pipe or a Network port.

Filename

The file that the device data will be read from. The file must not be a regular file. It must be a "named pipe" or "FIFO". In UNIX, see "mknod".

Server Address

The network address of the server computer. This address is a standard WWW address, such as 'foo' or 'foo.bar.com'.

Server Port

The network port of the server. The port is a number between 5000 and 10000, which both the server and the client use to connect with.

Active

While active, the CHOP receives information from the pipe or server. When 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.

Reset Channels

Clears all channels and data.

Common

Some of these parameters may not be available on all CHOP nodes.

Scope

To determine which channels get affected, some CHOPs have a scope string. Patterns can be used in the scope, for example * (match all), and ? (match single character).

The following are examples of possible channel name matching options:

chan2

Matches a single channel name.

chan3 tx ty tz

Matches four channel names, separated by spaces.

chan*

Matches each channel that starts with chan.

*foot*

Matches each channel that has foot in it.

t?

The ? matches a single character. t? matches two-character channels starting with t.

r[xyz]

Matches channels rx, ry and rz.

blend[3-7:2]

Matches number ranges giving blend3, blend5, and blend7.

blend[2-3,5,13]

Matches channels blend2, blend3, blend5, blend13.

t[xyz]

[xyz]matches three characters, giving channels tx, ty and tz.

Sample Rate Match

The Sample Rate Match Options handle cases where multiple input CHOPs’ sample rates are different.

Resample At First Input’s Rate

Use rate of first input to resample others.

Resample At Maximum Rate

Resample to highest sample rate.

Resample At Minimum Rate

Resample to the lowest sample rate.

Error if Rates Differ

Does not accept conflicting sample rates.

Units

The units for which time parameters are specified.

For example, you can specify the amount of time a lag should last for in seconds (default), frames (at the Houdini FPS), or samples (in the CHOP’s sample rate).

Note

When you change the Units parameter, it does not convert the existing parameters to the new units.

Time Slice

Time Slicing is a feature which boosts cooking performance and reduces memory usage. Traditionally, CHOPs calculate the channel over its entire frame range. If the channel does need to be evaluated every frame, then cooking the entire range of the channel is unnecessary. It is more efficient to calculate only the fraction of the channel that is needed. This fraction is known as a Time Slice.

Unload

Causes the memory consumed by a CHOP to be released after it is cooked and the data passed to the next CHOP.

Export Prefix

The Export prefix is prepended to CHOP channel names to determine where to export to.

For example, if the CHOP channel was named geo1:tx, and the prefix was /obj, the channel would be exported to /obj/geo1/tx.

Note

You can leave the Export Prefix blank, but then your CHOP track names need to be absolute paths, such as obj:geo1:tx.

Graph Color

Every CHOP has this option. Each CHOP gets a default color assigned for display in the Graph port, but you can override the color in the Common page under Graph Color. There are 36 RGB color combinations in the Palette.

Graph Color Step

When the graph displays the animation curves and a CHOP has two or more channels, this defines the difference in color from one channel to the next, giving a rainbow spectrum of colors.

See also

Channel nodes

  • Acoustic

    Design audio filters and sound materials for the spatial audio system.

  • Agent

    Imports an animation clip from an agent primitive.

  • Area

    Calculates the area under a channel’s graph, which is the same as calculating the integral of a channel, or integrating the channel.

  • Attribute

    Adds, removes or updates attributes of the input chop.

  • Audio In

    Receives audio input from the analog audio ports or the digital port.

  • Band EQ

    A 14-band equalizer which filters audio input channels in the same way that a conventional band equalizer uses a bank of sliders to filter fixed-frequency bands of sound.

  • Beat

    Manually tap the beat of a piece of music, and automatically generate a repeating ramp or pulse that continues to keep time with the music after the taps stop.

  • Blend

    Combines two or more chops in input 2, 3 and so on, by using a set of blending channels in input 1.

  • BlendPose

    Performs multi-dimensional, example-based interpolation of channels.

  • Channel

    Creates channels from the value of its parameters.

  • Channel VOP

    Contains a VOP network that can manipulate channel data.

  • Channel Wrangle

    Runs a VEX snippet to modify channel data.

  • Composite

    Layers (blends) the channels of one CHOP on the channels of another CHOP.

  • Constant

    Create up to forty new channels.

  • Constraint Blend

    Combines two or more chops by using a list of weights specified as parameters.

  • Constraint Get Local Space

    Returns an Object Local Transform.

  • Constraint Get Parent Space

    Returns an Object Parent Transform.

  • Constraint Get World Space

    Returns an Object World Transform.

  • Constraint Lookat

    Constrains rotation so it always points toward a target position.

  • Constraint Object

    Compares two objects and returns information on their relative positions and orientations.

  • Constraint Object Offset

    Compares two objects and returns information on their relative positions and orientations.

  • Constraint Object Pretransform

    Returns an Object Pretransform.

  • Constraint Offset

    Applies an transformation offset after evaluating a constraint.

  • Constraint Parent

    Reparent an object.

  • Constraint Path

    Position an object on a path and orient it to the path’s direction.

  • Constraint Points

    Position and Orient an object using point positions from a geometry.

  • Constraint Sequence

    Combines multiple chops by blending the inputs in sequence.

  • Constraint Simple Blend

    Combines two chops by using a single weight specified as a parameter.

  • Constraint Surface

    Position and Orient an object using the surface of a geometry.

  • Constraint Transform

    Takes translate, rotate, and/or scale channels and transforms them.

  • Copy

    Produces multiple copies of the second input along the timeline of the first input.

  • Count

    Counts the number of times a channel crosses a trigger or release threshold.

  • Cycle

    Creates cycles.

  • Delay

    Delays the input, and can be run in normal or time-sliced mode.

  • Delete

    Removes channels coming from its input.

  • Device Transform

    Turns data from device inputs into transform data

  • Dynamics

    Extracts any information from a DOP simulation that is accessible through the dopfield expression function.

  • Envelope

    Outputs the maximum amplitude in the vicinity of each sample of the input.

  • Euler Rotation Filter

    Fixes discontinuity of rotation data after cracking matrices

  • Export

    A convenient tool for exporting channels.

  • Export Constraints

    Export Constraints Network on any object

  • Expression

    Modify input channels by using expressions.

  • Extend

    Only sets the "extend conditions" of a chop, which determines what values you get when sampling the CHOP before or after its interval.

  • Extract Bone Transforms

    Extracts the current world or local space bone transforms from a geometry object.

  • Extract Locomotion

    Extracts locomotion from an animation clip.

  • Extract Pose-Drivers

    Creates channels from the specified derived transforms, node parameters and CHOP channels for pose-space deformation.

  • FBX

    Reads in channel data from an FBX file.

  • Fan

    Used for controlling other CHOPs.

  • Feedback

    Get the state of a chop as it was one frame or time slice ago.

  • Fetch Channels

    Imports channels from other CHOPs.

  • Fetch Parameters

    Imports channels from other OPs.

  • File

    Reads in channel and audio files for use by chops.

  • Filter

    Smooths or sharpens the input channels.

  • Foot Plant

    Computes when position channels are stationary.

  • Foreach

    Divides the input channels into groups, cooking the contained network for each group.

  • Function

    Provides more complicated math functions than found in the Math CHOP such as trigonometic functions, logarithmic functions, and exponential functions.

  • Gamepad

    Turns input values for the gamepad or joystick device into channel outputs.

  • Geometry

    Uses a geometry object to choose a sop from which the channels will be created.

  • Gesture

  • Handle

    The "engine" which drives Inverse Kinematic solutions using the Handle object.

  • Hold

    Sample and hold the value of the first input.

  • IKSolver

    Solves inverse kinematics rotations for bone chains.

  • Identity

    Returns an identity transform.

  • Image

    Converts rows and/or columns of pixels in an image to CHOP channels.

  • Interpolate

    Treats its multiple-inputs as keyframes and interpolates between them.

  • InverseKin

    Generates channels for bone objects based on a bone chain and an end affector.

  • Invert

    Returns an invert transform of the input.

  • Jiggle

    Creates a jiggling effect in the translate channels passed in.

  • Keyboard

    Turns key presses into channel output.

  • Lag

    Adds lag and overshoot to channels.

  • Layer

    Mix weighted layers of keyframed animation from multiple Channel CHOPs to a base Channel CHOP.

  • Limit

    Provides a variety of functions to limit and quantize the input channels.

  • Logic

    Converts channels of all its input chops into binary channels and combines them using a variety of logic operations.

  • Lookup

    Uses a channel in the first input to index into a lookup table in the second input, and output values from the lookup table.

  • MIDI In

    The MIDI In CHOP reads Note events, Controller events, Program Change events, and Timing events from both midi devices and files.

  • MIDI Out

    The MIDI Out CHOP sends MIDI events to any available MIDI devices.

  • Math

    Perform a variety of arithmetic operations on and between channels.

  • Merge

    Takes multiple inputs and merges them into the output.

  • Mouse

    Outputs X and Y screen values for the mouse device.

  • Mouse 3D

    Turns input values for the Connexion space mouse into channel outputs.

  • Multiply

    Post multiplies all the input transformations.

  • Network

    Similar to the Pipe In/Out CHOPs in Network mode.

  • Noise

    Makes an irregular wave that never repeats, with values approximately in the range -1 to +1.

  • Null

    Used as a place-holder and does not have a function of its own.

  • Object

    Compares two objects and returns information on their relative positions and orientations.

  • ObjectChain

    Creates channels representing the transforms for a chain of objects.

  • Oscillator

    Generates sounds in two ways.

  • Output

    Marks the output of a sub-network.

  • Parametric EQ

    Filters an audio clip, and then applies other audio effects.

  • Particle

    Produces translate and rotate channels to move Objects according to the positions of particles in a POP Network.

  • Pass Filter

    Filters audio input using one of four different filter types.

  • Phoneme

    Translates english text into a series of phonetic values.

  • Pipe In

    Pipes data from custom devices into a CHOP, without needing the Houdini Developers' Kit or knowledge of Houdini internals.

  • Pipe Out

    Transmit data out of Houdini to other processes.

  • Pitch

    Attempts to extract the fundamental pitch of a musical tone from the input audio.

  • Pose

    Store a transform pose for later use by evaluating the input.

  • Pose Difference

    Computes the difference between two poses.

  • Pretransform

    Takes translate, rotate, and/or scale channels and transforms them using the pretransform of the given object.

  • Pulse

    Generates pulses at regular intervals of one channel.

  • ROP Channel Output

  • Record

  • Rename

    Renames channels.

  • Reorder

    Reorders the first input CHOP’s channels by numeric or alphabetic patterns.

  • Resample

    Resamples an input’s channels to a new rate and/or start/end interval.

  • Sequence

    Takes all its inputs and appends one chop after another.

  • Shift

    This time-shifts a CHOP, changing the start and end of the CHOP’s interval.

  • Shuffle

    Reorganizes a list of channels.

  • Slope

    Calculates the slope (or derivative) of the input channels.

  • Spatial Audio

    The rendering engine for producing 3D audio.

  • Spectrum

    Calculates the frequency spectrum of the input channels, or a portion of the channels.

  • Spline

    Edit the channel data by using direct manipulation of cubic or Bezier handles in the graph of the CHOP.

  • Spring

    Creates vibrations influenced by the input channels, as if a mass was attached to a spring.

  • Stash

    Caches the input motion in the node on command, and then uses it as the node’s output.

  • Stash Pose

    Stashes the bone transforms and pose-drivers for use by the Pose-Space Deform SOP and Pose-Space Edit SOP nodes.

  • Stretch

    Preserves the shape of channels and the sampling rate, but resamples the channels into a new interval.

  • Subnetwork

    Allows for the simplification of complex networks by collapsing several CHOPs into one.

  • Switch

    Control the flow of channels through a CHOPnet.

  • Time Range

    This converts an input node in Current Frame mode to a Time Range mode by re-cooking it multiple times.

  • Time Shift

    This time-shifts a CHOP, re-cooking the node using different time.

  • Transform

    Takes translate, rotate, and/or scale channels and transforms them.

  • TransformChain

    Combines a chain of translate, rotate, and/or scale channels.

  • Trigger

    Adds an audio-style attack/decay/sustain/release (ADSR) envelope to all trigger points in the input channels.

  • Trim

    Shortens or lengthens the input’s channels.

  • VEX Waveform

    This function is a sub-set of the waveform CHOP.

  • Vector

    Performs vector operations on a set or sets of channels.

  • Voice Split

    The Voice Split CHOP takes an audio track and separates "words" out into different channels.

  • Voice Sync

    The Voice Sync CHOP detects phonemes in an audio channel given some audio phoneme samples and pro…

  • Warp

    Time-warps the channels of the first input (the Pre-Warp Channels) using one warping channel in the second input.

  • Wave

    Creates a waveform that is repeated.