Difference between revisions of "Event.DATA AVAILABLE"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
 
(One intermediate revision by one other user not shown)
Line 8: Line 8:
  
 
=== Parameters ===
 
=== Parameters ===
'''peakAmplitude''': (number) the audio channel peak amplitute<br/>
+
'''peakAmplitude''': (number) the audio channel peak amplitude<br/>
'''averageAmplitude''': (number) the audio channel average RMS amplitute<br/>
+
'''averageAmplitude''': (number) the audio channel average RMS amplitude<br/>
  
 
=== Example ===
 
=== Example ===
Line 22: Line 22:
  
 
microphone:setOutputFile("|D|record.wav")
 
microphone:setOutputFile("|D|record.wav")
</source>
+
</syntaxhighlight>
  
 
{{Microphone}}
 
{{Microphone}}

Latest revision as of 02:30, 26 August 2024

Available since: Gideros 2013.06
Value: dataAvailable
Defined by: Microphone

Description

Dispatched as audio samples become available.

Parameters

peakAmplitude: (number) the audio channel peak amplitude
averageAmplitude: (number) the audio channel average RMS amplitude

Example

require "microphone"

local microphone = Microphone.new(nil, 22050, 1, 16)

microphone:addEventListener(Event.DATA_AVAILABLE, function(event)
	print(event.peakAmplitude, "*", event.averageAmplitude)
end)

microphone:setOutputFile("|D|record.wav")