Skip to content

Instantly share code, notes, and snippets.

@kareiva
Created April 28, 2020 07:53
Show Gist options
  • Save kareiva/f0a2b44fcb54cb728b6f9566fbc9a110 to your computer and use it in GitHub Desktop.
Save kareiva/f0a2b44fcb54cb728b6f9566fbc9a110 to your computer and use it in GitHub Desktop.
CW lecture generator based on Osvald's LY2BJ training method
#!/usr/bin/env python3
import sys
import random
import string
from urllib.parse import quote
letters = 'eistmohanrkuwdgvflpjbxcyzq?/.,'
numbers = '1234567890'
lectures = [3, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
out = 'vvv '
level = 2
count = 50
speed = 20
effective = 5
tone = 600
letter_set = letters[:sum(lectures[:level])]
pos = 0
while pos < count:
out += letter_set[random.randrange(len(letter_set))]
pos += 1
if (pos % 5) == 0: out += ' '*3
if (pos % 25) == 0: out += ' '*5
print('Lesson content:\n' + '-' * len(out.strip()))
sys.stdout.write(out)
print('\n' + '-' * len(out.strip()))
print('Link to MP3 at LCWO.net:\n')
print('\033[4m' + 'https://cgi2.lcwo.net/cgi-bin/cw.mp3?s=' + \
str(speed) + '&e=' + \
str(effective) + '&f=' + \
str(tone) + '&t=' + \
quote(out) + '\033[0m')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment