2021-02-19 23:29:52 +01:00
|
|
|
|
function init(nstrip, nmod)
|
|
|
|
|
print("Initializing with "..nstrip.." strips with "..nmod.." modules each.")
|
|
|
|
|
|
2021-02-21 19:44:21 +01:00
|
|
|
|
print("Sampling rate: "..CONFIG['sampling_rate'].." Hz")
|
|
|
|
|
|
2021-02-19 23:29:52 +01:00
|
|
|
|
local nled = nstrip * nmod
|
|
|
|
|
|
|
|
|
|
red = {}
|
|
|
|
|
green = {}
|
|
|
|
|
blue = {}
|
|
|
|
|
white = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i = 1,nled do
|
|
|
|
|
red[i] = 0.8
|
|
|
|
|
green[i] = 0.1
|
|
|
|
|
blue[i] = 0.2
|
|
|
|
|
white[i] = 0.1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function periodic()
|
2021-02-21 19:44:21 +01:00
|
|
|
|
bass = sigproc:get_energy_in_band(0, 400)
|
|
|
|
|
mid = sigproc:get_energy_in_band(400, 4000)
|
|
|
|
|
treble = sigproc:get_energy_in_band(4000, 20000)
|
|
|
|
|
|
|
|
|
|
print("Bass: "..bass.." – Mid: "..mid.." – Treble: "..treble)
|
2021-02-19 23:29:52 +01:00
|
|
|
|
return red, green, blue, white
|
|
|
|
|
end
|