<?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="makenote" module="max" category="Notes">
	<digest>
		Generate a note-on/note-off pair
	</digest>
	<description>
		Outputs a MIDI note-on message paired with a velocity value followed by a note-off message after a specified amount of time. This allows for generative MIDI output without having to manage note-off generation.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			time
		</metadata>
		<metadata name="tag">
			Notes
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				Pitch
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				Velocity
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="2" type="INLET_TYPE">
			<digest>
				Duration
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Pitch Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="OUTLET_TYPE">
			<digest>
				Velocity Output (Note-on Velocity, Then 0)
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="velocity" optional="1" type="number">
			<digest>
				Set initial velocity
			</digest>
			<description>
				Sets an initial velocity value (int or float) to be paired with incoming pitch numbers. If there is no argument, the initial velocity is <m>0</m>.
			</description>
		</objarg>
		<objarg name="duration" optional="1" type="number">
			<digest>
				Set initial duration
			</digest>
			<description>
				Sets an initial note duration (time before a note-off is sent out), in any of Max's time units. A simple int or float will set the duration in milliseconds. If the second argument is not present, the note-off follows the note-on immediately.
			</description>
		</objarg>
		<objarg name="channel" optional="1" type="number">
			<digest>
				Set initial MIDI channel
			</digest>
			<description>
				Sets an initial MIDI channel number. If a third argument is used, the <o>makenote</o> object will have an additional fourth inlet (which specifies MIDI channel number) and an additional third outlet (which specifies MIDI output channel).
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				MIDI note information
			</digest>
			<description>
				In first inlet: The number is treated as a pitch value for a MIDI note-on message. It is paired with a velocity value and the numbers are sent out the outlets. After a certain time, a note-off message (a note-on with a velocity of 0) is sent out for that pitch.
				<br />
				<br />
				In second inlet: The number is stored as a velocity to be paired with pitch numbers received in the left inlet.
				<br />
				<br />
				In third inlet: The number is stored as the duration that <o>makenote</o> waits before a note-off message is sent out.
				<br />
				In fourth inlet: The number specifies a MIDI output channel. The fourth inlet will only be present if the <o>makenote</o> object is initialized with three arguments.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				MIDI note information
			</digest>
			<description>
				In first inlet: The number is treated as a pitch value for a MIDI note-on message. It is paired with a velocity value and the numbers are sent out the outlets. After a certain time, a note-off message (a note-on with a velocity of 0) is sent out for that pitch.
				<br />
				<br />
				In second inlet: The number is stored as a velocity to be paired with pitch numbers received in the left inlet.
				<br />
				<br />
				In third inlet: The number is stored as the duration that <o>makenote</o> waits before a note-off message is sent out.
				<br />
				In fourth inlet: The number specifies a MIDI output channel. The fourth inlet will only be present if the <o>makenote</o> object is initialized with three arguments.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="input" optional="0" type="list" />
			</arglist>
			<digest>
				Set all MIDI note information
			</digest>
			<description>
				In left inlet: The second number is treated as the velocity and is sent out the right outlet. The first number is treated as the pitch and is sent out the left outlet. A corresponding note-off message is sent out later.
				<br />
				If the <o>makenote</o> object is instantiated with three arguments, a four-item list can be used which contains an additional fourth element specifying the MIDI channel number, which is sent out the rightmost outlet of the object.
			</description>
		</method>
		<method name="anything">
			<arglist>
				<arg name="input" optional="0" type="list" />
			</arglist>
			<digest>
				Set all MIDI note information
			</digest>
			<description>
				Performs the same function as <m>list</m>.
			</description>
		</method>
		<method name="clear">
			<arglist />
			<digest>
				Clear all stored notes
			</digest>
			<description>
				Erases all notes currently held by <o>makenote</o>, without sending note-offs.
			</description>
		</method>
		<method name="clock">
			<arglist>
				<arg name="clock-name" optional="0" type="symbol" />
			</arglist>
			<digest>
				Select a clock source
			</digest>
			<description>
				The word <m>clock</m>, followed by the name of an existing <m>setclock</m> object, sets the <o>makenote</o> object to be controlled by that <m>setclock</m> object rather than by Max’s internal millisecond clock. The word <m>clock</m> by itself sets the <o>makenote</o> object back to using Max’s regular millisecond clock.
			</description>
		</method>
		<method name="stop">
			<arglist />
			<digest>
				Send note-off messages
			</digest>
			<description>
				Causes <o>makenote</o> to send out immediate note-offs for all pitches it currently holds.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="duration" get="1" set="1" type="atom" size="10">
			<digest>
				Duration
			</digest>
			<description>
				The duration that <o>makenote</o> waits before a note-off message is sent out.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="symbol" size="1" value="Timing" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Duration" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="time" />
				<attribute name="units" get="1" set="1" type="atom" size="7" value="ms hh:mm:ss ticks bars.beats.units notevalues hz samples" />
			</attributelist>
		</attribute>
		<attribute name="repeatmode" get="1" set="1" type="int" size="1">
			<digest>
				Retrigger behavior
			</digest>
			<description>
				Sets behavior when a note is retriggered. The modes are:
				<br />
				<br />
				repeatmode 0 (default): There is no pre-specified behavior when when you repeat a pitch before the note-off for that pitch has been sent.
				<br />
				repeatmode 1: If a note is still playing when you retrigger it, the <o>makenote</o> object will send a note-off (velocity 0) message to stop the first note and then send a new note-on message.
				<br />
				repeatmode 2: If a note is still playing when you retrigger it, the <o>makenote</o> object will cancel the scheduled output of the first note - only the last played note will send note-off (velocity 0) message.
			</description>
			<attributelist>
				<attribute name="basic" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="enumvals" get="1" set="1" type="atom" size="3">
					<enumlist>
						<enum name="Poly">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Re-trigger">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
						<enum name="Stop Last">
							<digest>
								TEXT_HERE
							</digest>
							<description>
								TEXT_HERE
							</description>
						</enum>
					</enumlist>
				</attribute>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Repeat Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="enumindex" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="makenote.png" caption="Supply note-offs for note-ons generated within Max" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="flush" />
		<seealso name="midiout" />
		<seealso name="noteout" />
		<seealso name="nslider" />
		<seealso name="stripnote" />
		<seealso name="transport" />
		<seealso name="xnoteout" />
		<seealso name="midichapter02" module="max" type="tutorial" />
	</seealsolist>
	<discussion>
		This object uses the Max <link name="maxtime" module="core" type="vignette">time format</link> syntax. The interval that the <o>makenote</o> object uses to specify the time between not-on and note-off can be either fixed or tempo-relative (it must be a single-valued). An additional third argument can be used to specify a MIDI output channel (the <o>makenote</o> object will then have four inputs and three outputs).
	</discussion>
	<misc name="Output">
		<entry name="int">
			<description>
				Out left outlet: The number received in the left inlet is sent out immediately, paired with a velocity value out the other outlet. After a certain duration, the same number is sent out paired with a velocity of <m>0</m>.				<br />
				<br />
				Out right outlet: The number in the middle inlet is sent out as a velocity value in conjunction with a pitch value out the left outlet. After a certain duration, <m>0</m> is sent out paired with the same pitch.
			</description>
		</entry>
	</misc>
</c74object>
