Back in the day there were some great books for the Atari and commodore about making your own sounds for games. I realised after a quick check that love has the potential to do this also. What I am getting stuck on is that the example tutorial is pretty basic and seems to not work.
function Oscillator(freq)
local phase = 0
return function()
phase = phase + 2*math.pi/rate
if phase >= 2*math.pi then
phase = phase - 2*math.pi
end
return math.sin(freq*phase)
end
end
function Oscillator(freq)
local phase = 0
return function()
phase = phase + 2*math.pi/rate
if phase >= 2*math.pi then
phase = phase - 2*math.pi
end
return math.sin(freq*phase)
end
end
But this still produces attempt to set out of range sample.
So I am guessing that something is up with the way that the Oscillator is checking the phase?
Is there something wrong with the code snippet? I checked the documentation and there does not seem to be any depreciated library functions being called. It should just work right - with the exception of the >.
Lol I just want to get my tone playing then I can start to update the old school commodore books to lua.