Audio¶
The Audio interface allows to interact with any audio files linked to a scene.
Reference¶
- audio.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