<?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="train~" module="msp" category="MSP Synthesis">
	<digest>
		Pulse train generator
	</digest>
	<description>
		<o>train~</o> generates a pulse signal whose period is specifiable in terms of milliseconds (see <o>&lt;~</o> for a method of making a pulse wave at a specified frequency). It also sends out a <m>bang</m> when going from 0 to 1, so it can be used as a metronome with a floating-point interval.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			MSP
		</metadata>
		<metadata name="tag">
			MSP Synthesis
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="signal/float">
			<digest>
				(signal/float) Pulse Interval in ms
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="signal/float">
			<digest>
				(signal/float) Pulse Width from 0 to 1
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="2" type="signal/float">
			<digest>
				(signal/float) Phase from 0 to 1
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="signal">
			<digest>
				(signal) Pulse Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="signal">
			<digest>
				bang on 0 to 1 Transition
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="inter-pulse-interval" optional="1" type="number" units="ms">
			<digest>
				Set the inter-pulse interval
			</digest>
			<description>
				Sets the initial value for the inter-pulse interval in milliseconds. The default is 1000 ms. If a signal object is connected to this inlet, the corresponding initial argument value is ignored.
			</description>
		</objarg>
		<objarg name="pulse-width" optional="1" type="number">
			<digest>
				Set the pulse width
			</digest>
			<description>
				Sets the initial value for the pulse width. The default is 0.5. If a signal object is connected to this inlet, the corresponding initial argument value is ignored.
			</description>
		</objarg>
		<objarg name="phase" optional="1" type="number">
			<digest>
				Set the pulse phase
			</digest>
			<description>
				Sets the initial value for the pulse phase. The default is 0. If a signal object is connected to this inlet, the corresponding initial argument value is ignored.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="parameter-settings" optional="0" type="int" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				Numbers can be used instead of signal objects to control period, pulse width, and phase. If a <m>signal</m> is also connected to the inlet, <m>float</m> and <m>int</m> messages are ignored.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="parameter-settings" optional="0" type="float" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				Numbers can be used instead of signal objects to control period, pulse width, and phase. If a <m>signal</m> is also connected to the inlet, <m>float</m> and <m>int</m> messages are ignored.
			</description>
		</method>
		<method name="signal">
			<arglist />
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: Specifies the period (time interval between pulse cycles), in milliseconds, of a pulse train sent out the left outlet.
				<br />
				<br />
				In middle inlet: Controls the pulse width or duty cycle. The signal values represent a fraction of the pulse interval that will be devoted to the &quot;on&quot; part of the pulse (signal value of 1). A value of 0 has the smallest &quot;on&quot; pulse size (usually a single sample), while a value of 1 has the largest (usually the entire interval except a single sample). A value of 0.5 makes a pulse with half the time at 1 and half the time at 0.
				<br />
				<br />
				In right inlet: Sets the phase of the onset of the &quot;on&quot; portion of the pulse. A value of 0 places the &quot;on&quot; portion at the beginning of the interval, while other values (up to 1, which is the same as 0) delay the &quot;on&quot; portion by a fraction of the total inter-pulse interval.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<!--EXAMPLE-->
	<examplelist>
		<example img="train~.png" caption="Provide an accurate pulse for rhythmic changes in signal" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="&lt;~" />
		<seealso name="&gt;~" />
		<seealso name="clip~" />
		<seealso name="phasor~" />
	</seealsolist>
	<discussion>
		The signal output can be used as a control input for <o>sah~</o> as shown in the example below, or at very small intervals, it is audible.
	</discussion>
	<misc name="Output">
		<entry name="signal">
			<description>
				Out left outlet: A pulse (square) wave train having the specified interval, width, and phase.
			</description>
		</entry>
		<entry name="bang">
			<description>
				Out right outlet: When the &quot;on&quot; portion of the pulse begins, a <m>bang</m> is sent out the right outlet. Using this outlet, you can use <o>train~</o> as a signal-synchronized metronome with an interval specifiable as a floating-point (or <m>signal</m>) value. However, there is an unpredictable delay between the &quot;on&quot; portion of the pulse and the actual output of the <m>bang</m> message, which depends in part on the current Max scheduler interval. The delay is guaranteed to be a millisecond or less if the scheduler interval is set to 1 millisecond.
			</description>
		</entry>
	</misc>
</c74object>
