<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="follow" module="max" category="Sequencing">
	<digest>
		Compare a live performance to a recorded performance
	</digest>
	<description>
		<o>follow</o> records pitches, or you can give it a MIDI file, in which case it looks at the file's note-ons and ignores other events. When it is &quot;following&quot; it outputs the index of the last note matched.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			Sequencing
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				MIDI Pitch Input, Many Other Messages
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Number of Note In Score
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="OUTLET_TYPE">
			<digest>
				MIDI Pitch Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="filename" optional="1" type="symbol">
			<digest>
				TEXT_HERE
			</digest>
			<description>
				The argument is the name of a file containing a previously recorded sequence, to be read into <o>follow</o> automatically when the patch is loaded.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Starts playing back the sequence stored in <o>follow</o>.
			</digest>
			<description>
				Starts playing back the sequence stored in <o>follow</o>.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				When <o>follow</o> is recording, the numbers received in its inlet are recorded as a sequence.
			</digest>
			<description>
				When <o>follow</o> is recording, the numbers received in its inlet are recorded as a sequence. The numbers may be bytes of MIDI messages (from <o>midiformat</o> or <o>midiin</o>), exactly as with the <o>seq</o> object. However, <o>follow</o> differs from <o>seq</o> in its ability to record individual integers; with <o>follow</o> you can record notes as a single pitch value. Whether the performance is recorded as complete MIDI messages or just as note-on pitches, <o>follow</o> can effectively step through the note-on pitch numbers later, when following a performance.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Converted to <m>int</m>.
			</digest>
			<description>
				Converted to <m>int</m>.
			</description>
		</method>
		<method name="append">
			<arglist />
			<digest>
				Starts recording at the end of the stored sequence, without erasing the existing sequence.
			</digest>
			<description>
				Starts recording at the end of the stored sequence, without erasing the existing sequence.
			</description>
		</method>
		<method name="delay">
			<arglist>
				<arg name="onset-time (milliseconds)" optional="0" type="int" />
			</arglist>
			<digest>
				The word <m>delay</m>, followed by a number, sets the onset time, in milliseconds, of the first event in the recorded sequence.
			</digest>
			<description>
				The word <m>delay</m>, followed by a number, sets the onset time, in milliseconds, of the first event in the recorded sequence.
			</description>
		</method>
		<method name="dump">
			<arglist />
			<digest>
				Calls up the standard Open Document dialog box, so that a previously recorded sequence or standard MIDI file can be opened as text and displayed in a new Untitled text window.
			</digest>
			<description>
				Calls up the standard Open Document dialog box, so that a previously recorded sequence or standard MIDI file can be opened as text and displayed in a new Untitled text window. This in fact has no direct effect on the <o>follow</o> object, but does allow you to view or edit a sequence, save your changes in a file, then load the new file into <o>follow</o> with a <m>read</m> message.
			</description>
		</method>
		<method name="follow">
			<arglist>
				<arg name="index" optional="0" type="int" />
			</arglist>
			<digest>
				The <m>follow</m> message is the main feature that distinguishes <o>follow</o> from <o>seq</o>. In effect, <o>follow</o> is like a score reader, comparing a live performance with the one previously stored.
				<br />
				<br />
				The word <m>follow</m>, and a number, causes <o>follow</o> to begin comparing incoming numbers to its own stored numbers, beginning at the specified index (the specified event in its own stored sequence).
			</digest>
			<description>
				The <m>follow</m> message is the main feature that distinguishes <o>follow</o> from <o>seq</o>. In effect, <o>follow</o> is like a score reader, comparing a live performance with the one previously stored.
				<br />
				<br />
				The word <m>follow</m>, and a number, causes <o>follow</o> to begin comparing incoming numbers to its own stored numbers, beginning at the specified index (the specified event in its own stored sequence). When <o>follow</o> is following, and a number is received that matches the number recorded in <o>follow</o>, it sends out the index of that number.
				<br />
				<br />
				The <o>follow</o> object is a forgiving score reader, and will try to follow along even if the incoming numbers do not exactly match the recorded sequence. If a number arrives that does not match the next number, or either of the two subsequent numbers in the sequence, <o>follow</o> does nothing. If a number arrives that matches a number up to two notes ahead in the sequence, <o>follow</o> assumes that the performer simply missed a note or two, and jumps ahead to the matched number.
			</description>
		</method>
		<method name="in1">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				When <o>follow</o> is following, numbers received in its inlet are compared to the numbers recorded in the sequence. When a number is received that matches the number in the sequence, <o>follow</o> sends out the index of that number.
			</digest>
			<description>
				When <o>follow</o> is following, numbers received in its inlet are compared to the numbers recorded in the sequence. When a number is received that matches the number in the sequence, <o>follow</o> sends out the index of that number.
			</description>
		</method>
		<method name="next">
			<arglist />
			<digest>
				Causes <o>follow</o> to send out the index and the stored number it is currently trying to match, and move on to the next number.
			</digest>
			<description>
				Causes <o>follow</o> to send out the index and the stored number it is currently trying to match, and move on to the next number.
			</description>
		</method>
		<method name="print">
			<arglist />
			<digest>
				Prints the first few events of the recorded sequence in the Max Console.
			</digest>
			<description>
				Prints the first few events of the recorded sequence in the Max Console.
			</description>
		</method>
		<method name="start">
			<arglist>
				<arg name="tempo" optional="0" type="int" />
			</arglist>
			<digest>
				The word <m>start</m> by itself has the same effect as <m>bang</m>.
			</digest>
			<description>
				The word <m>start</m> by itself has the same effect as <m>bang</m>. The word <m>start</m>, followed by a number, plays the stored sequence at a tempo determined by the number. The message <m>start 1024</m> indicates normal tempo. If the number is <m>512</m>, <o>follow</o> plays the sequence at half the original recorded speed, <m>start 2048</m> plays it back at twice the original speed, and so on.
			</description>
		</method>
		<method name="stop">
			<arglist />
			<digest>
				Stops <o>follow</o> from recording, playing, or following.
			</digest>
			<description>
				Stops <o>follow</o> from recording, playing, or following. A <m>stop</m> message need not be received before switching directly from recording to playing, following to recording, etc.
			</description>
		</method>
		<method name="read">
			<arglist>
				<arg name="filename" optional="0" type="list" />
			</arglist>
			<digest>
				The word <m>read</m> with no arguments puts up a standard Open Document dialog box for choosing a sequence file to load into <o>follow</o>.
			</digest>
			<description>
				The word <m>read</m> with no arguments puts up a standard Open Document dialog box for choosing a sequence file to load into <o>follow</o>. If <m>read</m> is followed by a symbol filename argument, the named file is located and loaded into <o>follow</o>.
			</description>
		</method>
		<method name="record">
			<arglist />
			<digest>
				Starts recording integers received in the inlet.
			</digest>
			<description>
				Starts recording integers received in the inlet.
			</description>
		</method>
		<method name="write">
			<arglist>
				<arg name="filename" optional="0" type="list" />
			</arglist>
			<digest>
				Opens a standard Save As dialog box to save the <o>follow</o> sequence as a file.
			</digest>
			<description>
				Opens a standard Save As dialog box to save the <o>follow</o> sequence as a file.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<!--EXAMPLE-->
	<examplelist>
		<example img="follow.png" caption="A note that matches the recorded note can trigger a process, or the notes can be stepped through" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="seq" />
		<seealso name="detonate" />
		<seealso name="midichapter04" module="max" type="tutorial" />
	</seealsolist>
	<misc name="Output">
		<entry name="int">
			<description>
				Out left outlet: When <o>follow</o> is following, and the number received in the inlet matches the next number in the stored sequence (or one of the two numbers after that), the index of the matched number is sent out. The index of the next number is also sent out when a <m>next</m> message is received.
				<br />
				<br />
				Out right outlet: When <o>follow</o> receives a <m>bang</m> or a <m>start</m> message, the recorded numbers are played back. When <o>follow</o> is following, and a <m>next</m> message is received, the next number in the recorded sequence is sent out.
			</description>
		</entry>
	</misc>
</c74object>
