<?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="mtof" module="max" category="Math">
	<digest>
		Convert a MIDI note number to frequency
	</digest>
	<description>
		Performs MIDI-note-number to frequency conversion. Frequency is reported in as a <m>float</m> in Hertz (Hz).
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			math
		</metadata>
		<metadata name="tag">
			MIDI
		</metadata>
		<metadata name="reference">
			TEXT_HERE
		</metadata>
		<metadata name="license">
			TEXT_HERE
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				MIDI note number input
			</digest>
			<description>
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				MIDI note number input
			</digest>
			<description>
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				frequency output
			</digest>
			<description>
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg id="0" name="OBJARG_NAME" type="OBJARG_TYPE" optional="0">
			<digest>
				TEXT_HERE
			</digest>
			<description>
				TEXT_HERE
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="int">
			<arglist>
				<arg name="MIDI-note-number" optional="0" type="int" />
			</arglist>
			<digest>
				MIDI note number
			</digest>
			<description>
				Outputs the frequency for the incoming MIDI note value (0 - 127).
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="MIDI-note-number" optional="0" type="float" />
			</arglist>
			<digest>
				MIDI note number
			</digest>
			<description>
				Outputs the frequency for the incoming MIDI note value (0 - 127).
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="MIDI note list" optional="0" type="list" />
			</arglist>
			<digest>
				List of MIDI note numbers
			</digest>
			<description>
				Generates a list of frequency values corresponding to the list of MIDI note numbers.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="base" get="1" set="1" type="float" size="1">
			<digest>
				Set the base frequency
			</digest>
			<description>
				Sets the &quot;base frequency&quot; used when calculating frequency values (e.g., A = 440.). The default base frequency is 440 Hz.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Base Frequency" />
			</attributelist>
		</attribute>
		<attribute name="map" get="1" set="1" type="atom" size="1">
			<digest>
				Keyboard Map
			</digest>
			<description>
				A set of values, given as a list, for a keyboard map in Scala format:
				<ul>
					<li>
						Size of map; the pattern repeats every so many keys (example: 12)
					</li>
					<li>
						First MIDI note number to retune (example: 0)
					</li>
					<li>
						Last MIDI note number to retune (example: 127)
					</li>
					<li>
						Middle note where the first entry of the mapping is mapped to (example: 60)
					</li>
					<li>
						Reference note for which frequency is given (example: 69)
					</li>
					<li>
						Frequency for reference note, as a float (example: 440.0)
					</li>
					<li>
						Frequency for reference note, as a float (example: 440.0)
					</li>
					<li>
						Scale degree to consider as formal octave, determines difference in pitch between adjacent mapping patterns (example: 12)
					</li>
					<li>
						Mapping (example: 0 1 2 3 4 5 6 7 8 9 10 11)
					</li>
				</ul>
				Note: to indicate an unmapped key, you can use either an &quot;x&quot; or &quot;-1&quot;. At the end of the list, unmapped keys may be left out. For more information about keyboard mappings, visit
				<a href="https://www.huygens-fokker.org/scala/help.htm#mappings">
					the Scala documentation.
				</a>
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Keyboard Map" />
			</attributelist>
		</attribute>
		<attribute name="mapname" get="1" set="1" type="symbol" size="1">
			<digest>
				Keyboard Map File
			</digest>
			<description>
				The name of a valid keyboard map file in Scala format that has been saved in Max's search path will cause <o>mtof</o> to use that mapping. The file extension (.kbm) can be omitted. For more information about keyboard mappings, visit
				<a href="https://www.huygens-fokker.org/scala/help.htm#mappings">
					the Scala documentation.
				</a>
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Keyboard Map File" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="filename" />
			</attributelist>
		</attribute>
		<attribute name="mid" get="1" set="1" type="int" size="1">
			<digest>
				Middle Note Number
			</digest>
			<description>
				The note number where a Scala scale begins (default 60).
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Middle Note Number" />
			</attributelist>
		</attribute>
		<attribute name="ref" get="1" set="1" type="int" size="1">
			<digest>
				Reference Note Number
			</digest>
			<description>
				The MIDI note number assigned to the base frequency (default 69).
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Reference Note Number" />
			</attributelist>
		</attribute>
		<attribute name="scale" get="1" set="1" type="atom" size="1">
			<digest>
				Scale Data
			</digest>
			<description>
				A set of values, given as a list, for a scale described using the Scala format. The first value is the count of notes, followed either by floats defining a value in cents (example: 579.47057) or a ratio of two ints (example: 5/4). For more information, see the
				<a href="https://www.huygens-fokker.org/scala/scl_format.html">
					the Scala documentation.
				</a>
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Scale Data" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="text_large" />
			</attributelist>
		</attribute>
		<attribute name="scalename" get="1" set="1" type="symbol" size="1">
			<digest>
				Scale Name
			</digest>
			<description>
				A valid scale name from the
				<a href="https://www.huygens-fokker.org/docs/scalesdir.txt">
					Scala archive
				</a>
				, will cause <o>mtof</o> to use the tuning described in that scale for its MIDI to frequency conversion. For this purposes of this attribute, the file extension (.scl) can be omitted.
			</description>
			<attributelist>
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Scale Name" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="mtof.png" caption="Use MIDI note number to provide frequency value for an oscillator" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="expr" />
		<seealso name="ftom" />
		<seealso name="mtof~" />
	</seealsolist>
	<misc name="Output">
		<entry name="float">
			<description>
				The frequency corresponding to the received MIDI pitch value.
			</description>
		</entry>
	</misc>
</c74object>
