Skip to content

Instantly share code, notes, and snippets.

@cheapie
Created August 18, 2023 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cheapie/e185b3002bf0ab5c2c471d30585dfd19 to your computer and use it in GitHub Desktop.
Save cheapie/e185b3002bf0ab5c2c471d30585dfd19 to your computer and use it in GitHub Desktop.
local dialsteps = {
{697,1336},
{770,1336},
{852,1209},
{941,1336},
{697,1336},
{697,1477},
{770,1209},
{941,1336},
{941,1336},
{941,1336},
{697,1477},
}
local modemsteps = {
{
freqs = {1400,2000},
time = 0.3,
},
{
freqs = {300},
time = 0.1,
},
{
freqs = {1600,2200},
time = 0.35,
},
{
freqs = {1850},
time = 0.1,
},
{
freqs = {1700},
time = 0.05,
},
{
freqs = {800,1000,1200},
time = 0.7,
},
{
freqs = {1500,1700,1900},
time = 0.7,
},
{
freqs = {800,1000,1200},
time = 0.4,
},
{
freqs = {},
time = 1,
},
{
freqs = {2200},
time = 0.4,
},
{
freqs = {2200},
time = 0.4,
},
{
freqs = {2200},
time = 0.4,
},
{
freqs = {800,1300,2200},
time = 0.4,
},
{
freqs = {800,1300,2200},
time = 0.4,
},
{
freqs = {800,1300,1600,1900},
time = 0.4,
},
{
freqs = {800,1300,1600,1900},
time = 0.4,
},
{
freqs = {700,1500,1650,1800,2700},
time = 0.2,
},
{
freqs = {200,400,600,800,1000,1500,1700,1900,2000,2200,2400,2600,2800,3000,3200,3400},
time = 0.25,
gain = 0.6,
},
{
freqs = {200,400,600,800,1000,1500,1700,1900,2000,2200,2400,2600,2800,3000,3200,3400},
time = 0.25,
gain = 0.1,
},
{
freqs = {700,1500,1650,1800,2700},
time = 0.2,
},
{
freqs = {200,400,600,800,1000,1500,1700,1900,2000,2200,2400,2600,2800,3000,3200,3400},
time = 0.25,
gain = 0.6,
},
{
freqs = {200,400,600,800,1000,1500,1700,1900,2000,2200,2400,2600,2800,3000,3200,3400},
time = 0.25,
gain = 0.1,
},
{
freqs = {1650},
time = 0.3,
},
}
if event.type == "on" then
mem.step = 0
digiline_send("nb",{sound="sine",pitch=0.35,cut=2})
digiline_send("nb",{sound="sine",pitch=0.44,cut=2})
interrupt(2,"step")
elseif event.iid == "step" then
mem.step = mem.step+1
if mem.step > #dialsteps then
mem.modemstep = 0
interrupt(1,"modem")
return
end
digiline_send("nb",{sound="sine",pitch=dialsteps[mem.step][1]/1000,cut=0.15})
digiline_send("nb",{sound="sine",pitch=dialsteps[mem.step][2]/1000,cut=0.15})
interrupt(0.2,"step")
elseif event.iid == "modem" then
mem.modemstep = mem.modemstep + 1
if mem.modemstep > #modemsteps then
interrupt(0,"st1")
return
end
local cstep = modemsteps[mem.modemstep]
interrupt(cstep.time,"modem")
for _,v in ipairs(cstep.freqs) do digiline_send("nb",{sound="sine",pitch=v/1000,cut=(not cstep.fadestart) and cstep.time,gain=cstep.gain or 1,fadestart=cstep.fadestart,fadegain=cstep.fadegain}) end
elseif event.iid == "st1" then
digiline_send("nb",{sound="noise",pitch=0.1,gain=0.25,cut=2})
interrupt(2,"st2")
elseif event.iid == "st2" then
digiline_send("nb",{sound="sine",pitch=1.4,cut=0.1})
interrupt(0.1,"st3")
elseif event.iid == "st3" then
digiline_send("nb",{sound="noise",pitch=0.1,gain=0.25,cut=2})
digiline_send("nb",{sound="noise",pitch=0.2,gain=0.25,cut=2})
interrupt(2,"dil1")
elseif event.iid == "dil1" then
local cstep = {
freqs = {1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000},
}
for _,v in ipairs(cstep.freqs) do digiline_send("nb",{sound="sine",pitch=v/1000,gain=0.6,fadestart=0,fadegain=0,fadestep=0.5}) end
interrupt(1.5,"dil2")
elseif event.iid == "dil2" then
local cstep = {
freqs = {1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000},
}
for _,v in ipairs(cstep.freqs) do digiline_send("nb",{sound="sine",pitch=v/1000,gain=0.6,fadestart=0,fadegain=0,fadestep=0.5}) end
interrupt(1.25,"dil3")
elseif event.iid == "dil3" then
digiline_send("nb",{sound="sine",pitch=2,cut=0.15,gain=0.2})
interrupt(0.15,"st4")
elseif event.iid == "st4" then
digiline_send("nb",{sound="noise",pitch=0.1,gain=0.25,cut=2})
digiline_send("nb",{sound="noise",pitch=0.2,gain=0.25,cut=2})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment