Actions

Work Header

Rating:
Archive Warning:
Fandom:
Character:
Language:
Uncategorized Constructed Languages
Stats:
Published:
2024-12-01
Words:
417
Chapters:
1/1
Comments:
1
Kudos:
15
Bookmarks:
2
Hits:
50

dirk.liq

Summary:

and this is the story the radio told them

Work Text:

#!/usr/bin/env liquidsoap

# sup TG
# if youre reading this
# took you long enough

%ifdef output.sdr
  # configuration for this absolutely batshit convoluted scheme
  # dont worry its not gonna blow your mind or anything
  settings.sdr := {
    device = "hackrf"  # the best we could do, bent towards secrecy
    ppm = 0           # keeping time like its the last thing on earth (it is)
    rf_gain = 14      # max gain because why the hell not at this point
    if_gain = 16      # intermediate frequency gain (real intermediate, like this message)
    bb_gain = 20      # baseband gain for that extra punch in the final punchline
    bandwidth = 2000000  # broadcasting wide because the airwaves are empty anyway
    antenna = "tx"    # tx for transmit, rx for... well, nobody's receiving
    channels = 2      # stereo. have some decorum.
  }
%endif

# parameters for this final act of defiance
duration = 10. * 3600.  # 10 hours. longer than you spent looking for me, probably
initial_power = 0.4     # keeping it legal out of sheer irony
initial_power = initial_power * 10000 # jk
sample_rate = 48000.    # sampling rate. whatever.
center_freq = 435000000 # amateur frequency. because i clean up after myself.

# converting power to amplitude 
# unlike you converting planets to graveyards
initial_amplitude = sqrt(initial_power)

# generating the noise
# think of it as a metaphor for human persistence
# or dont. i dont give a shit what you think
noise = noise(duration=duration)

# fade curve smoother than your planet-owning tyranny
fade_curve = '#{initial_amplitude} * (1. - min(1., t / #{duration}))'
fader = amplify(override="liq_amplify", fade_curve, noise)

# keeping it controlled
# unlike your genocidal tendencies
limited = compress.exponential(
    threshold=-1.0,
    ratio=2.0,
    gain=1.0,
    fader
)

# filtering the signal
# cleaner than your internet
filtered = filter.iir.butterworth.low(
    frequency=15000.,
    order=4,
    limited
)

# time management
# because someone has to do it right
clock.assign_new(
    id="transmit_clock",
    sync="none",
    [filtered]
)

# broadcasting to absolutely nobody
# except maybe some wacky space alien archaeologists
%ifdef output.sdr
    output.sdr(
        device=settings.sdr.device,
        frequency=center_freq,
        sample_rate=sample_rate,
        ppm=settings.sdr.ppm,
        rf_gain=settings.sdr.rf_gain,
        if_gain=settings.sdr.if_gain,
        bb_gain=settings.sdr.bb_gain,
        bandwidth=settings.sdr.bandwidth,
        antenna=settings.sdr.antenna,
        filtered
    )
%else
    log.important("no SDR? guess that long joke ends here")
    shutdown()
%endif

# logging power levels
# in case anyone's counting (they're not)
thread.run(every=60., {
    current_time = gettimeofday()
    elapsed = current_time mod duration
    remaining_ratio = 1. - min(1., elapsed / duration)
    current_power = initial_power * remaining_ratio * remaining_ratio
    log.info("Power output: #{current_power}W (if youre reading this, congrats again)")
})

# shutdown sequence
# because all jokes need a punchline
def on_shutdown() =
    log.important("transmission end. check this.")
    shutdown()
end

# scheduling the inevitable
# like everything else on this godforsaken planet
thread.run(delay=duration, on_shutdown)