<?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="adsr~" module="msp" category="MSP Functions">
	<digest>
		ADSR envelope generator
	</digest>
	<description>
		Use the <o>adsr~</o> object when you need a sample-accurate Attack-Decay-Sustain-Release signal envelope which can be controlled by signals. In some situations, a combination of the <o>function</o> and <o>line~</o> objects may be a useful alternative.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			MSP
		</metadata>
		<metadata name="tag">
			MSP Functions
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="signal/float">
			<digest>
				trigger
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="signal/float">
			<digest>
				attack
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="2" type="signal/float">
			<digest>
				decay
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="3" type="signal/float">
			<digest>
				sustain
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="4" type="signal/float">
			<digest>
				release
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="signal">
			<digest>
				adsr envelope
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="1" type="signal">
			<digest>
				new envelope trigger
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="2" type="message">
			<digest>
				mute outlet
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
		<outlet id="3" type="message">
			<digest>
				dump outlet
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="attack" optional="1" type="float">
			<digest>
				Attack parameter
			</digest>
			<description>
				A floating-point value specifies the initial values for the attack parameter.
			</description>
		</objarg>
		<objarg name="decay" optional="1" type="float">
			<digest>
				Decay parameter
			</digest>
			<description>
				A floating-point value specifies the initial values for the decay parameter.
			</description>
		</objarg>
		<objarg name="sustain" optional="1" type="float">
			<digest>
				Sustain parameter
			</digest>
			<description>
				A floating-point value specifies the initial values for the sustain parameter.
			</description>
		</objarg>
		<objarg name="release" optional="1" type="float">
			<digest>
				Release parameter
			</digest>
			<description>
				A floating-point value specifies the initial values for the release parameter.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="trigger/ADSR-parameters" optional="0" type="int" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: Like an <o>adsr~</o> object triggered by a signal input, a floating-point value triggers an envelope with the given amplitude. The envelope will sustain until a zero is input to trigger the release stage, or until another non-zero float retriggers the envelope.
				<br />
				<br />
				In second inlet: sets the envelope's attack time, in milliseconds.
				<br />
				<br />
				In third inlet: sets the envelope's decay time, in milliseconds.
				<br />
				<br />
				In fourth inlet: sets the envelope's sustain level, as a factor of the amplitude. For example, a value of 2 means the sustain level will be twice the value of the amplitude height.
				<br />
				<br />
				In fifth inlet: sets the envelope's release time, in milliseconds.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="trigger/ADSR-parameters" optional="0" type="float" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: Like an <o>adsr~</o> object triggered by a signal input, an int value triggers an envelope with the given amplitude. The envelope will sustain until a zero is input to trigger the release stage, or until another non-zero int retriggers the envelope.
				<br />
				<br />
				In second inlet: sets the envelope's attack time, in milliseconds.
				<br />
				<br />
				In third inlet: sets the envelope's decay time, in milliseconds.
				<br />
				<br />
				In fourth inlet: sets the envelope's sustain level, as a factor of the amplitude. For example, a value of 2 means the sustain level will be twice the value of the amplitude height.
				<br />
				<br />
				In fifth inlet: sets the envelope's release time, in milliseconds.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="attack" optional="0" type="float" />
				<arg name="decay" optional="0" type="float" />
				<arg name="sustain" optional="0" type="float" />
				<arg name="release" optional="0" type="float" />
			</arglist>
			<digest>
				Set the ADSR parameters
			</digest>
			<description>
				In left inlet: A list of 4 floating-point numbers will assign the values for the attack, decay, sustain and release portions of the ADSR-envelope consecutively.
			</description>
		</method>
		<method name="anything">
			<arglist>
				<arg name="attack" optional="0" type="float" />
				<arg name="decay" optional="0" type="float" />
				<arg name="sustain" optional="0" type="float" />
				<arg name="release" optional="0" type="float" />
			</arglist>
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: Performs the same function as <m>list</m>.				<br />
				<br />
				Any other inlet: A list may be used to specify time in one of the Max <link name="maxtime" module="core" type="vignette">time formats</link>.
			</description>
		</method>
		<method name="signal">
			<arglist />
			<digest>
				Function depends on inlet
			</digest>
			<description>
				In left inlet: Any non-zero value will trigger an envelope with that value as its amplitude. Like an <o>adsr~</o> triggered by an input float, a zero value represents &quot;note-off&quot; and will begin the release stage. Unlike the event-triggered model, a signal-triggered <o>adsr~</o> must receive a zero before it will retrigger.
				<br />
				<br />
				In second inlet: sets the envelope's attack time, in milliseconds.
				<br />
				<br />
				In third inlet: sets the envelope's decay time, in milliseconds.
				<br />
				<br />
				In fourth inlet: sets the envelope's sustain level, as a factor of the amplitude. For example, a value of 0.5 means the sustain level will be half of the amplitude height.
				<br />
				<br />
				In fifth inlet: sets the envelope's release time, in milliseconds.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="attack" get="1" set="1" type="atom" size="10">
			<digest>
				Attack time
			</digest>
			<description>
				Sets the attack of the ADSR-envelope in milliseconds.
			</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="Attack Time" />
				<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="decay" get="1" set="1" type="atom" size="10">
			<digest>
				Decay time
			</digest>
			<description>
				Sets the decay of the ADSR-envelope in milliseconds.
			</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="Decay Time" />
				<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="legato" get="1" set="1" type="int" size="1">
			<digest>
				Legato enable toggle
			</digest>
			<description>
				Given as input, the word <m>legato</m>, followed by a 0 or a non-zero number, disables or enables legato mode. If legato mode is enabled, the envelope will not drop to zero in the event of a retrigger while the envelope is active - instead, the envelope ramps to the new amplitude over the attack period.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Legato Mode" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
		<attribute name="maxsustain" get="1" set="1" type="float" size="1">
			<digest>
				Maximum sustain time
			</digest>
			<description>
				Given as input, the word <m>maxsustain</m>, followed by a float, sets the maximum amount of time that the envelope will remain in the sustain stage. A negative number sets no maximum; the envelope will remain forever in the sustain stage until a note-off is received. To create a simple three-stage sustainless envelope (an ADR), you can use the message maxsustain 0.0.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Maximum Sustain" />
			</attributelist>
		</attribute>
		<attribute name="release" get="1" set="1" type="atom" size="10">
			<digest>
				Release time
			</digest>
			<description>
				Sets the release of the ADSR-envelope in milliseconds.
			</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="Release Time" />
				<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="retrigger" get="1" set="1" type="float" size="1">
			<digest>
				Retriggering interval
			</digest>
			<description>
				Given as input, the word <m>retrigger</m>, followed by a float, sets the amount of time taken to ramp down to zero in the event of a retrigger while the envelope is active (the default is 5 milliseconds). This ramping prevents clicking.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Retrigger Delay" />
			</attributelist>
		</attribute>
		<attribute name="sustain" get="1" set="1" type="float" size="1">
			<digest>
				Sustain Level
			</digest>
			<description>
				Sets the sustain of the ADSR-envelope, as a factor of the amplitude. For example, a value of 0.5 means the sustain level will be half of the amplitude height.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Sustain Level" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="adsr~.png" caption="Use adsr~ to manage the polyphony and muting for a sampler or synthesizer patch internal to a poly~ object" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="function" />
		<seealso name="line~" />
		<seealso name="techno~" />
		<seealso name="transport" />
		<seealso name="zigzag~" />
	</seealsolist>
	<discussion>
		Any non-zero value in the trigger inlet will trigger an envelope with that amplitude. Like an <o>adsr~</o> triggered by an input float, a zero value represents &quot;note-off&quot; and will begin the release stage. unlike the event-trigger model, a signal-triggered <o>adsr~</o> must receive a zero before it will retrigger.
		<br />
		The <o>adsr~</o> object uses the Max <link name="maxtime" module="core" type="vignette">time format</link> syntax; envelope times can be specified in either fixed or tempo-relative formats.
	</discussion>
	<misc name="Output">
		<entry name="signal">
			<description>
				Left outlet: the envelope.
				<br />
				<br />
				Middle outlet: signals the beginning of an envelope by sending <m>1</m> when in the attack, decay, or sustain stages and <m>0</m> otherwise (release, retrigger, or inactive). You can use this outlet in conjunction with the <o>sah~</o> object to synchronize pitch (or other information) with the beginning of an envelope with sample accuracy.
			</description>
		</entry>
		<entry name="message">
			<description>
				The right outlet sends <m>mute</m> messages suitable for managing internal <o>poly~</o> instance muting with the <o>thispoly~</o> object.
			</description>
		</entry>
		<entry name="message">
			<description>
				The fourth outlet responds to query messages for the various attributes (i.e. <m>getattack</m>).
			</description>
		</entry>
	</misc>
</c74object>
