peak

If a number is greater than previous numbers, output it

Description

The number in the left inlet of peak is compared to the old peak-value and, if it's larger than the older number, it is sent out the output while the new peak-value is set to that number.

Arguments

Name Type Opt Description
number-format float The initial value stored in peak is 0. Providing a float argument will cause peak to operate with floating point numbers instead of integers.

Messages

 bang In left inlet: Sends the currently stored peak value out the left outlet. int input [int] In left inlet: If the input is greater than the value currently stored in peak, it is stored as the new peak value and is sent out. In right inlet: The number is stored in peak as the new peak value, and is sent out. (inlet1) peak-value [int] In right inlet: The number is stored in peak as the new peak value, and is sent out. float input [float] In left inlet: If the input is greater than the value currently stored in peak, it is stored as the new peak value and is sent out. In right inlet: The number is stored in peak as the new peak value, and is sent out. (inlet1) peak-value [float] In right inlet: The number is stored in peak as the new peak value, and is sent out. list input and peak-value [list] In left inlet: The second number is stored as the new peak value and is sent out, then the first number is received in the left inlet.

Output

int: Out left outlet: New peak values are sent out. (A number received in the right inlet is always the new peak value.)

Out middle outlet: If the number received is a new peak value, the output is 1. If the number received in the left inlet is not a new peak value, the output is 0.

Out right outlet: If the number received is a new peak value, the output is 0. If the number received in the left inlet is not a new peak value, the output is 1.

Examples

Find the greatest in a series of numbers... A number in the right inlet always sets a new peak