<?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="detonate" module="max" category="Sequencing">
	<digest>
		Play a score of note events
	</digest>
	<description>
		Provides score playback managed using Max messages. The score may be loaded from a MIDI file, or generated using Max functions. The score is not limited to MIDI notes and values; any information can be stored and played back with <o>detonate</o>.
	</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>
				Control Messages, Time Parameter When Recording
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				Pitch Parameter When Recording
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="2" type="INLET_TYPE">
			<digest>
				Vel Parameter When Recording
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="3" type="INLET_TYPE">
			<digest>
				Dur Parameter When Recording
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="4" type="INLET_TYPE">
			<digest>
				Chan Parameter When Recording
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="5" type="INLET_TYPE">
			<digest>
				Track Parameter When Recording
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="6" type="INLET_TYPE">
			<digest>
				X1 Parameter When Recording
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="7" type="INLET_TYPE">
			<digest>
				X2 Parameter When Recording
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Time Parameter Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="OUTLET_TYPE">
			<digest>
				Pitch Parameter Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="2" type="OUTLET_TYPE">
			<digest>
				Vel Parameter Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="3" type="OUTLET_TYPE">
			<digest>
				Dur Parameter Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="4" type="OUTLET_TYPE">
			<digest>
				Chan Parameter Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="5" type="OUTLET_TYPE">
			<digest>
				Track Parameter Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="6" type="OUTLET_TYPE">
			<digest>
				X1 Parameter Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="7" type="OUTLET_TYPE">
			<digest>
				X2 Parameter Output
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="label" optional="0" type="symbol">
			<digest>
				A named context
			</digest>
			<description>
				Supplies a name for the object. Any <o>detonate</o> objects with the same name argument will share the same event data.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Output event then move to next
			</digest>
			<description>
				Performs the same function as <m>next</m>.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="parameter" optional="0" type="int" />
			</arglist>
			<digest>
				Set a note event parameter
			</digest>
			<description>
				After a <m>record</m> message has been received, all numbers received are treated as parameters of a note event.
				<br />
				<br />
				In left inlet: The delta time (delay), in milliseconds, since the previous recorded event. This denotes the &quot;inter-onset interval --the time between the beginnings of notes--which effectively determines the rhythm in which the events are recorded. This need not necessarily be the true time in which they occur; <o>detonate</o> believes any (non-negative) delta time it receives.
				<br />
				<br />
				When <o>detonate</o> receives a number in the left inlet while recording, it treats the number as the inter-onset interval (the time elapsed since the previous event), combines it with the numbers most recently received in the other inlets, and records them together as a note event. As with most Max objects, the numbers received in the other inlets are stored for use in subsequent note events triggered by the receipt of a number in the leftmost inlet.
				<br />
				<br />
				When <o>detonate</o> has received a <m>follow</m> message, a subsequent number in the 2nd inlet is treated as the key number (pitch) of a note. If the number is the same as the pitch of the current note in the score (or a nearby note), the information recorded for that note--except for the delta time--is sent out.
				<br />
				<br />
				When <o>detonate</o> is neither recording nor following, a number in the left inlet has the same effect as the <m>nth</m> message.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="parameter" optional="0" type="float" />
			</arglist>
			<digest>
				Set a note event parameter
			</digest>
			<description>
				Converted to <m>int</m>.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="event-values" optional="0" type="list" />
			</arglist>
			<digest>
				Set all values
			</digest>
			<description>
				The first number in the list is used as the delta time, and the other numbers are treated as if they had been received in the other inlets, respectively from left to right.
			</description>
		</method>
		<method name="clear">
			<arglist />
			<digest>
				Clear all stored content
			</digest>
			<description>
				Erases the contents of <o>detonate</o>.
			</description>
		</method>
		<method name="(mouse)">
			<digest>
				Open the editing window
			</digest>
			<description>
				Double-clicking on the <o>detonate</o> object in a locked patcher opens a graphical editing window for editing the stored <o>detonate</o> data.
			</description>
		</method>
		<method name="delay">
			<arglist>
				<arg name="offset" optional="0" type="int" />
			</arglist>
			<digest>
				Offset event positions
			</digest>
			<description>
				The message <m>delay</m> followed by a number will move the entire sequence of recorded note values over with the first note of the sequence beginning at the specified number.
			</description>
		</method>
		<method name="follow">
			<arglist>
				<arg name="pitch" optional="0" type="int" />
			</arglist>
			<digest>
				Begin score following
			</digest>
			<description>
				Causes <o>detonate</o> to behave like a score reader, comparing incoming pitch information to the events stored in its score. When a key number is received in the 2nd (pitch) inlet, and it is the same as the pitch of the current note in the score, <o>detonate</o> sends out the information recorded for that event--except for the delta time--and then moves ahead to the next note event.
			</description>
		</method>
		<method name="followat">
			<arglist>
				<arg name="pitch" optional="0" type="int" />
				<arg name="velocity" optional="0" type="int" />
				<arg name="channel" optional="0" type="int" />
			</arglist>
			<digest>
				Find and start following from a specific event
			</digest>
			<description>
				The word <m>followat</m>, followed by a pitch, a velocity, and a MIDI channel number, causes <o>detonate</o> to look for a note event with those attributes in its stored score. If such a note is found, <o>detonate</o> commences score-following from the next event onward. If not, it simply prints <m>detonate: note not found</m> in the Max Console.
			</description>
		</method>
		<method name="export">
			<arglist>
				<arg name="time" optional="0" type="int" />
				<arg name="file-format" optional="0" type="int" />
			</arglist>
			<digest>
				Write a Standard MIDI File to disk
			</digest>
			<description>
				Same as <m>write</m>.
			</description>
		</method>
		<method name="in1">
			<arglist>
				<arg name="pitch" optional="0" type="int" />
			</arglist>
			<digest>
				Set key number of a note event
			</digest>
			<description>
				In 2nd inlet: The number is treated as the key number (pitch) of the note. If no key number has ever been received, <m>60</m> is used by default.
			</description>
		</method>
		<method name="in2">
			<arglist>
				<arg name="velocity" optional="0" type="int" />
			</arglist>
			<digest>
				Set the velocity value of a note event
			</digest>
			<description>
				In 3rd inlet: The velocity of the note. If the velocity is 0--indicating a note-off-- the event will be treated as the end of an earlier note-on the same key, and will determine the duration of that earlier note. If no velocity number has ever been received, it is <m>64</m> by default.
			</description>
		</method>
		<method name="in3">
			<arglist>
				<arg name="duration" optional="0" type="int" />
			</arglist>
			<digest>
				Set a duration value of a note event
			</digest>
			<description>
				In 4th inlet: In lieu of a note-off message, a note duration can be supplied as part of the note-on event. If no duration value has ever been received, and no note-off event is received to end the note, a duration of <m>10</m> milliseconds is used by default.
			</description>
		</method>
		<method name="in4">
			<arglist>
				<arg name="channel" optional="0" type="int" />
			</arglist>
			<digest>
				Set a MIDI channel value of a note event
			</digest>
			<description>
				In 5th inlet: The MIDI channel of the note. If no channel has ever been specified, notes are recorded on channel 1.
			</description>
		</method>
		<method name="in5">
			<arglist>
				<arg name="track" optional="0" type="int" />
			</arglist>
			<digest>
				Set the track of an event
			</digest>
			<description>
				In 6th inlet: The number of a track on which to record the note event. Overdub recording is not possible with <o>detonate</o>, but each recorded note can be tagged with a track number for storing separate tracks of notes internally. If no track number has ever been received, notes are recorded on track 1.
			</description>
		</method>
		<method name="in6">
			<arglist>
				<arg name="extra" optional="0" type="int" />
			</arglist>
			<digest>
				Set an extra value for a note event
			</digest>
			<description>
				In 7th inlet: An &quot;extra&quot; number, which can be used for any purpose, attached to the note event. This number can be used to provide an additional event parameter, or to serve as a control value in sync with the note. If no number has ever been received in this inlet, it is recorded as <m>0</m> by default.
			</description>
		</method>
		<method name="in7">
			<arglist>
				<arg name="extra-2" optional="0" type="int" />
			</arglist>
			<digest>
				Set a second extra value for a note event
			</digest>
			<description>
				In right inlet: A second &quot;extra&quot; number.
			</description>
		</method>
		<method name="import">
			<arglist>
				<arg name="filename" optional="0" type="list" />
			</arglist>
			<digest>
				Load a Standard MIDI File
			</digest>
			<description>
				Same as <m>read</m>.
			</description>
		</method>
		<method name="next">
			<arglist />
			<digest>
				Output an event then move to next
			</digest>
			<description>
				Once playback of the score has been started with a <m>start</m> message, <m>next</m> sends out the event information (except the delta time) for the current note in the score, then sends out the delta time for the next note. That delta time can in turn be used as a delay time before sending another <m>next</m> message to detonate. When <m>next</m> is received on the last note of the score, there is no note following that one, so a unique value of <m>-1</m> is sent out the left outlet to signal the end of the score. If a <m>next</m> message is received while the score is not being played back, <o>detonate</o> simply prints the message <m>not playing</m> in the Max Console.
			</description>
		</method>
		<method name="nth">
			<arglist>
				<arg name="event" optional="0" type="int" />
			</arglist>
			<digest>
				Output note event data for a specified number
			</digest>
			<description>
				The word <m>nth</m>, followed by a number, sends out the note information of the event in the score indicated by the number. (Events are numbered beginning with 0.) In place of the delta time for the event, the (cumulative) starting time of the event is sent out the left outlet.
			</description>
		</method>
		<method name="mute">
			<arglist>
				<arg name="event-parameter" optional="0" type="int" />
				<arg name="parameter-value" optional="0" type="int" />
				<arg name="mute-flag" optional="0" type="int" />
			</arglist>
			<digest>
				Mute specific events
			</digest>
			<description>
				Permits the selective muting of note events that meet specific criteria. The word <m>mute</m> must be followed by an event parameter number, a parameter value, and a value of <m>1</m> or <m>0</m> signifying &quot;mute&quot; or &quot;unmute&quot;.
			</description>
			<discussion>
				Event parameters are numbered beginning at 0 for delta time, 1 for pitch, etc. For example, the message <m>mute 4 10 1</m> mutes notes on MIDI channel 10 (channel is parameter 4), preventing their note information from being sent out; those notes can later be unmuted by the message <m>mute 4 10 0</m>.
			</discussion>
		</method>
		<method name="params">
			<arglist>
				<arg name="tolerance" optional="0" type="int" />
				<arg name="advance" optional="0" type="int" />
				<arg name="octave-match" optional="0" type="int" />
			</arglist>
			<digest>
				Set score following behavior
			</digest>
			<description>
				The word <m>params</m>, followed by three numbers, modifies the score-following behavior of <o>detonate</o> for cases when the received pitch does not match the pitch of the current note in the score. The first number tells <o>detonate</o> how many errors to tolerate before moving ahead in the score. The second number tells how many milliseconds to move ahead in the score when too many errors have occurred. The third number, if non-zero, tells <o>detonate</o> to treat a received pitch that is an octave too high or too low as if it were a match. For example, the message <m>params 3 1000 1</m> means to allow three successive errors (with octave displacements considered to be a match) before moving ahead one second in the score and resuming. By default, <o>detonate</o> allows 2 errors before moving ahead 200 milliseconds, and does not consider octave pitch displacements to be a match for the stored note.
			</description>
		</method>
		<method name="open">
			<arglist />
			<digest>
				Open the editing window
			</digest>
			<description>
				See the <m>(mouse)</m> message.
			</description>
		</method>
		<method name="setparam">
			<arglist>
				<arg name="parameter" optional="0" type="number" />
				<arg name="name" optional="0" type="symbol" />
				<arg name="display-mode" optional="0" type="int" />
				<arg name="minimum" optional="0" type="int" />
				<arg name="maximum" optional="0" type="int" />
				<arg name="default" optional="0" type="int" />
				<arg name="interval" optional="0" type="int" />
				<arg name="scaling" optional="0" type="int" />
				<arg name="note-number" optional="0" type="int" />
			</arglist>
			<digest>
				Set all parameters
			</digest>
			<description>
				The message <m>setparam</m> followed by nine list elements will set the parameters of the object much like entering the information into the object's inspector. The first element in the list is a number and signifies which parameter to edit. The remaining elements are the desired settings listed, from left to right, as the &quot;parameter name&quot;, the &quot;display mode&quot;, the &quot;minimum value&quot;, the &quot;maximum value&quot;, the &quot;default value&quot;, the &quot;graph interval&quot;, the &quot;default scaling&quot;, and the &quot;Display MIDI note number&quot; flag.
			</description>
		</method>
		<method name="start">
			<arglist />
			<digest>
				Begin playback of the score
			</digest>
			<description>
				Begins playing back the score, by simply sending out the first delta time. Once playback of the score has been started, <m>next</m> messages can be used to send out the next event information.
			</description>
		</method>
		<method name="record">
			<arglist />
			<digest>
				Begin recording of score data
			</digest>
			<description>
				In left inlet: Begins recording numbers coming in the inlets, treating them as parameters of note events to be recorded. The onset of an event is recorded each time a number is received in the left inlet.
			</description>
		</method>
		<method name="startat">
			<arglist>
				<arg name="pitch" optional="0" type="int" />
				<arg name="velocity" optional="0" type="int" />
				<arg name="channel" optional="0" type="int" />
			</arglist>
			<digest>
				Find and start playback from a specific event
			</digest>
			<description>
				The word <m>startat</m>, followed by a pitch, a velocity, and a MIDI channel number, causes <o>detonate</o> to look for a note event with those attributes in its stored score. If such a note is found, <o>detonate</o> sends out the delta time of the next event, and a subsequent <m>next</m> message will refer to that next event. If no such note is found, <o>detonate</o> simply prints <m>detonate: note not found</m> in the Max Console.
			</description>
		</method>
		<method name="stop">
			<arglist />
			<digest>
				Stop recording or playback
			</digest>
			<description>
				Stops <o>detonate</o> from recording, playing, or following. It is not necessary to stop detonate before switching directly between <m>record</m>, <m>start</m>, and <m>follow</m>.
			</description>
		</method>
		<method name="read">
			<arglist>
				<arg name="filename" optional="0" type="list" />
			</arglist>
			<digest>
				Load a Standard MIDI File
			</digest>
			<description>
				The word <m>read</m> by itself opens a dialog for loading in a standard MIDI file as contents of the <o>detonate</o> score. If <m>read</m> is followed by the name of a MIDI file in Max's search path, that file is read in directly without opening a dialog box. The <m>read</m> message can also be followed by a number which--if non-zero--causes the time values in the file to be interpreted as milliseconds rather than as bars, beats and ticks at a certain tempo. If the number is 0 or not present, the times are read as bars and beats.
			</description>
		</method>
		<method name="restore">
			<arglist />
			<digest>
				Begin recording of score data
			</digest>
			<description>
				Same as <m>record</m>.
			</description>
		</method>
		<method name="unmute">
			<arglist>
				<arg name="parameter" optional="0" type="int" />
				<arg name="value" optional="0" type="int" />
			</arglist>
			<digest>
				Unmute specific events
			</digest>
			<description>
				The word <m>unmute</m>, followed by an event parameter number and a parameter value, undoes an earlier <m>mute</m> of the same criterion. For example, <m>unmute 4 10</m> has the same meaning as <m>mute 4 10 0</m>.
			</description>
		</method>
		<method name="unmuteall">
			<arglist />
			<digest>
				Unmute all muted events
			</digest>
			<description>
				Undoes the effects of all previous <m>mute</m> messages.
			</description>
		</method>
		<method name="wclose">
			<arglist />
			<digest>
				Close the editing window
			</digest>
			<description>
				Closes a previously opened editing window.
			</description>
		</method>
		<method name="write">
			<arglist>
				<arg name="filename" optional="1" type="symbol" />
				<arg name="time" optional="1" type="int" />
				<arg name="file-format" optional="1" type="int" />
			</arglist>
			<digest>
				Write a Standard MIDI File to disk
			</digest>
			<description>
				Opens a dialog for saving the contents of <o>detonate</o> as a standard MIDI file. The word <m>write</m> may optionally be followed by up to two numbers. If the first number is non-zero, the file will be saved with time represented in milliseconds rather than as bars, beats, and ticks in a certain tempo. If the number is 0 or not present, the file is saved as beats. The second number indicates the MIDI file format: 0 (all notes on a single track) o multi-track format, using the track parameter to separate the notes). The contents of <o>detonate</o> are also saved as part of the patch, when the patch is saved.
			</description>
		</method>
		<method name="writemax">
			<arglist>
				<arg name="filename" optional="1" type="symbol" />
			</arglist>
			<digest>
				Write a Max text file to disk
			</digest>
			<description>
				The message <m>writemax</m> followed by a symbol, saves the patch as a Max text file named after the symbol.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="name" get="1" set="1" type="symbol" size="1">
			<digest>
				Shared context name
			</digest>
			<description>
				Names the object for data sharing. Any <o>detonate</o> object that shares this name will share event data.
			</description>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="detonate.png" caption="Note events are recorded with a delta time, which can be used to play notes back in rhythm" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="follow" />
		<seealso name="seq" />
	</seealsolist>
	<discussion>
		When <o>detonate</o> receives a <m>start</m> message or a <m>startat</m> message in the left inlet, it sends out the delta time of its starting note event (or of the note after the found note, in the case of <m>startat</m>). After that, each time <o>detonate</o> receives a <m>next</m> message, it sends out all the other note data for that event, and the delta time of the next event, progressing through the score. Thus, the numbers coming out the left outlet can be used to control the playback rhythm, by delaying for the specified time and then triggering the <m>next</m> message.
		<br />
		<br />
		When <o>detonate</o> receives an <m>nth</m> message (or receives a number, while stopped) in the left inlet, it uses that information as an index number (starting at index number 0 for the first note event) and sends out all note data for the indexed event. Instead of sending the note's delta time out the left outlet, however, it sends the start time of the note--the total time since the beginning of the score.
		<br />
		<br />
		After <o>detonate</o> has received a <m>follow</m> or <m>followat</m> message in the left inlet, if a number is received in the 2nd inlet that matches the pitch of the current note in the score (or one of the two notes immediately after it), all the data for the matched note is sent out, except for the delta time.
		<br />
	</discussion>
	<misc name="Output">
		<entry name="int">
			<description>
				Out left outlet: When a <m>start</m>, <m>startat</m>, or subsequent <m>next</m> message is received in the left inlet, the delta time of the next note event is sent out. When the last event in the score is played by a <m>next</m> message, there is no note following that one, so a unique delta time of <m>-1</m> is sent out to signal that the last note has been played.
				<br />
				<br />
				When an <m>nth</m> message is received in the left inlet (or an <m>int</m> if <o>detonate</o> is stopped), the starting time of the specified note is sent out.
				<br />
				<br />
				Out 2nd outlet: In response to an <m>nth</m> message, or an <m>int</m> while <o>detonate</o> is stopped, or a <m>next</m> message while playing back, or a matched pitch while following, the pitch of the note is sent out.
				<br />
				<br />
				Out 3rd outlet: The velocity of the note.
				<br />
				<br />
				Out 4th outlet: The duration of the note.
				<br />
				<br />
				Out 5th outlet: The MIDI channel of the note.
				<br />
				<br />
				Out 6th outlet: The track number of the note.
				<br />
				<br />
				Out 7th outlet: An extra value associated with the note.
				<br />
				<br />
				Out right outlet: A second extra value associated with the note.
			</description>
		</entry>
	</misc>
</c74object>
