mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-09-12 02:54:54 +00:00
17 lines
281 B
Ruby
17 lines
281 B
Ruby
f=File.open("sine_data.i","w")
|
|
|
|
TABLE_ENTRIES=0x80
|
|
AMPLITUDE=255
|
|
OFFSET=00
|
|
|
|
TABLE_ENTRIES.times do |i|
|
|
value=OFFSET+Math.sin(Math::PI*i.to_f/TABLE_ENTRIES.to_f)*AMPLITUDE
|
|
if i%0x08==0
|
|
f<<"\n.byte "
|
|
else
|
|
f<<", "
|
|
end
|
|
f<<"$%02x" % value
|
|
end
|
|
|
|
f.close |