Old IBM PCs had a chip (the 8253) that could be accessed that would
allow you to play notes at a specified frequency for a specified
duration. A beep function could be written and invoked like so ...

dot [beep(440,2);pause]
dash [beep(440,6);pause]

Fast forward about 45 years.

Morse code

Morse code converter



the.quick.etc.wav

morse.tc
morse2c.c
bsdmorse.try.c