Difference between revisions of "Event.DATA AVAILABLE"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2013.06<br/>
'''<translate>Available since</translate>:''' Gideros 2013.06<br/>
+
'''Value:''' dataAvailable<br/>
'''<translate>Value</translate>:''' dataAvailable<br/>
+
'''Defined by:''' [[Microphone]]<br/>
'''<translate>Defined by</translate>:''' [[Special:MyLanguage/Microphone|Microphone]]<br/>
+
 
=== <translate>Descriptio</translate>n ===
+
=== Description ===
<translate>Dispatched as audio samples become available.</translate>
+
Dispatched as audio samples become available.
=== <translate>Parameters</translate> ===
+
 
'''peakAmplitude''': (number) <translate>The audio channel's peak amplitute.</translate><br/>
+
=== Parameters ===
'''averageAmplitude''': (number) <translate>The audio channel's average RMS amplitute.</translate><br/>
+
'''peakAmplitude''': (number) the audio channel peak amplitute<br/>
 +
'''averageAmplitude''': (number) the audio channel average RMS amplitute<br/>
 +
 
 +
=== Example ===
 +
<source lang="lua">
 +
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")
 +
</source>
 +
 
 +
{{Microphone}}

Revision as of 16:21, 25 May 2023

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

Description

Dispatched as audio samples become available.

Parameters

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

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")