Hello, I want to make a synthesizer with a line y = ( math.sin(x / 100) * 100 ) and play the sound y = freq
But i dont know how
Can someone Help?
Thank you.
@Silvio2400 This isn’t exactly what you want, but it might get you started. See the sound command in the reference for more info.
function setup()
x=0
z=100
end
function draw()
background(40, 40, 50)
z=z+1
if z>30 then
x=x+1
y=math.sin(math.rad(x))
print("y= "..y)
s()
z=0
end
end
function s()
instrument = {StartFrequency = y, DecayTime = 1}
sound(instrument)
end
@dave1707 Thank you for the example it will get me started but whats the odd delay after y 0.5? Is it a sound bug?
@Silvio2400 I noticed those delays also. I don’t know the reason, but I doubt it’s a sound bug. I didn’t have time to figure it out when I created the example.
@Silvio2400 The sound function shouldn’t be called constantly like I’m doing in the draw function. When called, the sound function should be allowed to finish what it’s doing before it’s called again.