mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-10-11 17:23:39 +00:00
17 lines
281 B
Ruby
17 lines
281 B
Ruby
|
f=File.open("sine_data.i","w")
|
||
|
|
||
|
TABLE_ENTRIES=0x80
|
||
|
AMPLITUDE=205
|
||
|
OFFSET=50
|
||
|
|
||
|
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
|