Commit Briefs

40c37b5c53 Sven M. Hallberg

use arc4random (main)

While crappy old rand(3) is fine for this program and uses arc4random(3) on OpenBSD anyway, the linker spews a warning about it and the noise during compilation is annoying me. FWIW, Linux finally got arc4random(3) with glibc >= 2.36 (2022) so it could actually be considered fairly portable now. However, for the time being, I'd like to still support older systems. NB, the closest "native" alternative, getentropy(3), appears in glibc >= 2.25 (2017), so even it is not exactly ancient, yet. Thur, instead of mucking around with wrappers, feature flags and conditional compilation, rand() is still it for portable.


7100fec23e Sven M. Hallberg

add coefficient (basemul) for base weight


d01528a063 Sven M. Hallberg

use overall rate as baseline weight


7e15a2c893 Sven M. Hallberg

slightly reorder the code in cwinit


0f4e0bbca9 Sven M. Hallberg

clean up return latency code in cwstop


02b03fabec Sven M. Hallberg

remove debug output


237ea00efb Sven M. Hallberg

reset the clock in cwstart

This is a workaround to guard against the possibility that the onmove callback is not called at all. This happens if playback has not started before cwstop(), and hence sio_stop(), is called.


3f64dc1f60 Sven M. Hallberg

fix timing calculation

Measure and take into account the "return latency" of cwstop(), i.e. the time it took between playback stopping ang cwstop() returning, usually negative.


b232461a63 Sven M. Hallberg

try to figure out proper timing

This is an intermediate commit of some experimental changes: - playback in synchronous mode (par.xrun = SIO_SYNC) - tracking of play position via sio_onmove() and total frames written - (broken/ignored) reporting of "time remaining" from sound() and friends - debug instrumentation (#ifdef DEBUGTIME)


ed992560fb Sven M. Hallberg

UI styling


Branches

Tags

This repository contains no tags

Tree

.gitignorecommits | blame
Makefilecommits | blame
NOTEScommits | blame
READMEcommits | blame
cw.ccommits | blame
cw.hcommits | blame
morse.ccommits | blame
morseplay.ccommits | blame
morseteach.ccommits | blame
teach.ccommits | blame

README

An OpenBSD implementation of Ward Cunningham's automatic morse teacher
pesco DC4HK 2021-2023


How to build:

 $ make

Designed to compile and run on OpenBSD.
Check out the 'portable' branch for Linux support.


How to use:

 $ ./morse -t
 ... follow the on-screen instructions ...


Useful environment variables:

 MORSE_SPEED	set output speed in words per minute [24]
 MORSE_PITCH	set sidetone frequency in Hz [550]
 MORSE_LEVEL	set number of starting characters [4]


Tips for learning:

 - Do not try to go fast!
   Give yourself time to process each symbol. Speed comes after accuracy.
 - Consider the sound of each symbol as a whole.
   Do not try to count individual beeps.
 - Think of each character while you type it.
   Avoid training only your fingers' muscle memory.
 - Look away from the screen if it helps you concentrate on the sounds.
 - Resound a new symbol a few times (press Space) when you first hear it.
   You are encouraged to use this function whenever you want.
 - Experiment with raising the output speed (MORSE_SPEED).
   Shorter sounds help your ear consider them as a whole, but be sure to keep
   the speed low enough to clearly distinguish hard cases like 5 vs. H.
 - Trust your intuition.
   For example, when you have trouble distinguishing 6 from B, 4 from V, or
   5 from H, ask your ear: "Did that sound like a digit or not?"
 - Rest after each session.
   Your subconcious needs time to commit its experiences to memory. You don't
   have to sit in meditation, just do something benign for about 15 minutes to
   give it some room.
 - Begin every session with only the first few characters.
   It reinforces learning to reiterate old material. You may later increase
   MORSE_LEVEL *conservatively* if and when the "recap" part of each session
   takes so long that it impedes progress.
 - Aim to train once every day.
   More than one session per day is said to be unhelpful. Persistence is key.
 - Leaves of absence are fine.
   Life likes to interfere. Even months-long breaks are not very damaging to
   your progress. Restart at the beginning and you will recover quickly.
 - Find what works for you.
   Like learning a language, learning Morse code is an individual process.
   Experiment, try different approaches, mix and match, hack up this program.
   Whatever suits your needs.


Detailed table of contents:

 morse.c
	An extended version of classic /usr/games/morse that supports
	audio output (-a) through sndio and integrates an interactive
	teacher mode (-t) modeled after Cunningham's 1977 algorithm.
 morseteach.c
	Stand-alone teacher program that forks and uses 'morse -a' in the
	background for its audio output.
 morseplay.c
	Stand-alone audio component to play morse code. Accepts dots and
	dashes as 'morse -s' produces them.

 teach.c
	Implements the teacher algorithm. Used by morse and morseteach.
 cw.c
	Audio output routines for "continuous wave" tones of a given
	frequency and length. Applies envelope functions for clean sound
	without unwanted clicks. Used by morse and morseplay.

 NOTES
	Background research, plans, and history for the teacher algorithm,
	other implementations, and the UNIX/BSD morse program.