Event.DATA AVAILABLE: Difference between revisions
From GiderosMobile
No edit summary |
No edit summary |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 2: | Line 2: | ||
'''Available since:''' Gideros 2013.06<br/> | '''Available since:''' Gideros 2013.06<br/> | ||
'''Value:''' dataAvailable<br/> | '''Value:''' dataAvailable<br/> | ||
'''Defined by:''' [[Microphone]]<br/> | |||
=== Description === | === Description === | ||
Dispatched as audio samples become available. | |||
=== Parameters === | === Parameters === | ||
'''peakAmplitude''': (number) | '''peakAmplitude''': (number) the audio channel peak amplitude<br/> | ||
'''averageAmplitude''': (number) | '''averageAmplitude''': (number) the audio channel average RMS amplitude<br/> | ||
=== 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") | |||
</syntaxhighlight> | |||
{{Microphone}} | |||
Latest revision as of 01: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")