Difference between revisions of "Event.DATA AVAILABLE"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
Line 12: Line 12:
  
 
=== Example ===
 
=== Example ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
require "microphone"
 
require "microphone"
  

Revision as of 14:26, 13 July 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

<syntaxhighlight 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>