Audio
The Audio interface allows to interact with any audio files linked to a scene.
Usage
To use this module, add the following require at the top of your script:
Reference
getAnalysis
Get an FFT analysis from the audio engine. It returns an array of 256 samples
Examples
local Audio = require 'engine/audio'
local Canvas = require 'engine/canvas'
local audioData = Audio.getAnalysis()
local barCount = 256
local barWidth = Canvas.getWidth() / barCount
Canvas.clear()
Canvas.setFillColor(255, 255, 255, 1)
for i = 1, barCount do
Canvas.fillRect((i-1)*barWidth, 0, barWidth-1, audioData[i])
end