Code:

--============================================== Command Line Stereo Waveform Script ===============================================--
-- Make the dwell time and the step rate work together to maintain rotation speed. This allows thinning of the 'walls' and strengthening of corners.
-- Dwell time should be calculated on the difference in step sizes for the axis with the largest rate change.
-- Note! Only works with very fine time resolution. D=math.max(math.abs(RXN,RXO),math.abs(RYN,RYO))
-- LINE WEIGHT CALCULATION ERROR! It works, but the line length is not known till the rotator has done, and the draw length depends on step size and
-- count which are based on line length. You can't specify an accurate rotation rate at the outset, unless you also exactly specify the draw rate.
function Main() local F,OUT,X,Y,A,N,P,R,S,D={},{},0,0,8192,2.33333333333333333333333,math.rad(0),math.rad(0.02),0.05,10
for Z=1,N*3 do
F[Z],F[-Z]=math.sin((Z-1)*2*math.pi/N),math.cos((Z-1)*2*math.pi/N)
end
-- F[1],F[-1]=0,0 -- Array for frame, instead of for-loop polygon draw.
-- F[2],F[-2]=-0.1,0.25
-- F[3],F[-3]=0.01,1
-- F[4],F[-4]=0.1,0.25
local I,FL,SC,X,Y,SX,SY=1,table.getn(F) local x,y,c,s=0,0 R=R/FL
while table.getn(OUT)<44100*20 do
c,s=math.cos(P),math.sin(P) X,Y=c*F[I]+s*F[-I],c*F[-I]-s*F[I] -- Rotator.
SC=((X-x)^2+(Y-y)^2)^0.5/S+1 SX,SY=(X-x)/SC,(Y-y)/SC -- Step sizer.
for Z=1,SC do table.insert(OUT,Hex_Word(A,x+SX*Z,y+SY*Z)) end -- Interpolator.
for Z=1,D/SC+D do table.insert(OUT,Hex_Word(A,X,Y)) end -- Dwell points.
I=I+1 if I>FL then I=1 end x,y=X,Y P=P+R
end
DataSave("TEST WAVE.raw",table.concat(OUT,"")) --,S+D+1
wx.wxMessageBox("Finished Processing","",wx.wxOK+wx.wxICON_EXCLAMATION,wx.wxNull)
os.exit()
end
--====================================================== Common Functions ==========================================================--
function Hex_Word(S,X,Y) X,Y=S*X,S*Y
if (X<0) then X=X+65536 end if (Y<0) then Y=Y+65536 end return string.char(math.mod(X,256),X/256,math.mod(Y,256),Y/256)
end
function OpenTest(F)
F=io.open(F) if F then return io.close(F) end
end
function DataLoad(F)
F=assert(io.open(F,"rb")) local D=F:read("*a") F:close() return D
end
function DataSave(F,D)
F=assert(io.open(F,"wb")) F:write(D) F:close()
end
--======================================================= End Of Script ===========================================================--
Main()

Edit: