From 3ba551253066901366e9bb38402d579db2b0454c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20=C3=96stling?= Date: Wed, 22 Jan 2025 22:28:47 +0100 Subject: [PATCH] Analog mode operation --- README.md | 14 ++++++++++++++ make_sound.py | 31 +++++++++++++++++++++++++++++++ make_table.py | 25 +++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 make_sound.py create mode 100644 make_table.py diff --git a/README.md b/README.md index 22cd78d..de75389 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,17 @@ cycle. You could of course also take either of the sine wave outputs (ZOUT1, ZOUT2) and amplify or feed directly into a low-pass filter to the antenna. +## make_table.py and make_sound.py + +Code to support completely analog operation. Run `make_table.py` and write +down the printed table on a piece of paper, making sure to include the +horizontal lines after every 9th symbol. I simply fill the indicated +squares with a pencil, and the whole message takes three columns on a piece of +A4 graph paper. + +Then run `make_sound.py`, which creates the file `ticks.wav`. This file can be +played (by an analog tape player, perhaps?) starting at an even minute. You +should have no problem following the beat when keying the message, but if you +lose track at some point, the higher tone at the symbol *before* each 9-symbol +block boundary can be used for synchronization. + diff --git a/make_sound.py b/make_sound.py new file mode 100644 index 0000000..8534bf7 --- /dev/null +++ b/make_sound.py @@ -0,0 +1,31 @@ +import numpy as np +import math +import scipy + +symbol_time = 8192/12000 +sr = 22050 + +tick_hz = 450 +tack_hz = 700 +start_pad = 1.0 +end_pad = 1.0 +total_time = 162*symbol_time + start_pad + end_pad +n_samples = int(total_time*sr) + +samples = np.zeros(n_samples, dtype=np.uint8) + +def add_sound_at(start_time, frequency, length=0.1): + start_sample = int(start_time*sr) + for i in range(int(length*sr)): + samples[start_sample+i] = 128 + int(64*math.sin(2*math.pi*i*frequency/sr)) + +def main(): + for i in range(162): + frequency = tack_hz if (i+1) % 9 == 0 else tick_hz + add_sound_at(start_pad + i*symbol_time, frequency) + add_sound_at(0.0, 1000.0, length=start_pad) + + #print(list(samples)) + scipy.io.wavfile.write("ticks.wav", sr, samples) + +main() diff --git a/make_table.py b/make_table.py new file mode 100644 index 0000000..9da78f4 --- /dev/null +++ b/make_table.py @@ -0,0 +1,25 @@ +"""Display for manual WSPR transmission.""" + +from encode import wspr_encode + +import datetime +import time + +def display(symbols): + for i, symbol in enumerate(symbols): + if i % 9 == 0: + print(f'-- {i:3d} ' + '-'*72) + left = ' ' if symbol & 1 else '#' + right = ' ' if symbol & 2 else '#' + print(f'[{left}] [{right}]') + +if __name__ == '__main__': + import sys + if len(sys.argv) != 4: + print('Usage: %s callsign locator dbm' % sys.argv[0]) + sys.exit(1) + callsign = sys.argv[1] + locator = sys.argv[2] + dbm = int(sys.argv[3]) + symbols = wspr_encode(callsign, locator, dbm) + display(symbols)