Difference between revisions of "SoundData:getSample"

m (Update argument description)
m (Added info about stereo interleaving.)
Line 1: Line 1:
Gets the sample at the specified position.
+
Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
Line 6: Line 6:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|i|An integer value specifying the position of the sample (0 points to the first sample).}}
+
{{param|number|i|An integer value specifying the position of the sample (starting at 0).}}
  
 
=== Returns ===
 
=== Returns ===
{{param|number|sample|The normalized sample (range -1.0 to 1.0).}}
+
{{param|number|sample|The normalized samplepoint (range -1.0 to 1.0).}}
 
== See Also ==
 
== See Also ==
 
* [[parent::SoundData]]
 
* [[parent::SoundData]]
 
* [[SoundData:getSampleCount]]
 
* [[SoundData:getSampleCount]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Gets the sample at the specified position.}}
+
{{#set:Description=Gets the value of the samplepoint at the specified position.}}
 
{{#set:Since=000}}
 
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|SoundData:getSample}}
 
{{i18n|SoundData:getSample}}

Revision as of 20:04, 2 October 2017

Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order.

Function

Synopsis

sample = SoundData:getSample( i )

Arguments

number i
An integer value specifying the position of the sample (starting at 0).

Returns

number sample
The normalized samplepoint (range -1.0 to 1.0).

See Also


Other Languages