26 lines
773 B
Lua
26 lines
773 B
Lua
|
local sg=soundgen
|
||
|
local wave=sg:square():freq(50*(1+math.random()*0.4-0.2)):phase(math.random())
|
||
|
local wave=sg:new(function(self,t)
|
||
|
local ttcc,ttt=0,0
|
||
|
for n=1,20 do
|
||
|
local ttc,tt=0,0
|
||
|
local ma=1/(512+math.random()*256-128)
|
||
|
local st=ma/2
|
||
|
for n=-ma,ma,st do
|
||
|
ttc=ttc+1
|
||
|
tt=tt+wave:sample(t+n)
|
||
|
end
|
||
|
ttcc,ttt=ttcc+1,tt/ttc
|
||
|
end
|
||
|
return ttt/ttcc
|
||
|
end)
|
||
|
--wave=wave:pm(wave:am(sg:sine():freq(70):phase(math.random()),0,1),-0.01,0.01)
|
||
|
--wave=wave:pm(sg:noise():phase(0.5+math.random()*100):freq(3000):am(wave,-0.1,0.1),-0.005,0.005)
|
||
|
local wave=sg:new(function(self,t)
|
||
|
return wave:sample((t/4)^0.5*4)
|
||
|
end)
|
||
|
--wave=wave:amp(0.5):add(sg:sine():freq(102):pm(sg:sine():freq(49),-0.01,0.01):amp(0.5))
|
||
|
wave=wave:fade(0.001,0)
|
||
|
wave=wave:fade(0.001,0.5)
|
||
|
return wave:compile()
|