Closed jidanni closed 3 years ago
In case you do not want to install perl
, tr
and sed
can help as well:
#!/usr/bin/env sed -f
# Usage:
# cat text-file.txt | morse | tr '\n' '\r' | sed -f morse2beep.sed | xargs beep
#
i -l0 -D0
s/ daw\r\r/-n -l300 -D700 /g
s/ dit\r\r/-n -l100 -D700 /g
s/ daw\r/-n -l300 -D300 /g
s/ dit\r/-n -l100 -D300 /g
s/ daw/-n -l300 -D100 /g
s/ dit/-n -l100 -D100 /g
Ah, that is simply brilliant, @ndim. I have an idea. Make a subdirectory, contrib/morse and rename my version to contrib/morse/morse2beep.pl, and install your version as contrib/morse/morse2beep.sed !
Thank you for the brilliant idea of converting morse code to beep parameters.
The sed script looks deceivingly simple, but it does several runs through the whole input, so it certainly will not be very efficient for long inputs. OTOH, nobody is going to transmit gigabytes of text in morse code via beep.
@jidanni Could you address the two things I have brought up in the review? Then I can pull that, add my sed script, and merge to master.
I would love to, if I could find it. What review?
@jidanni As far as I can tell, I can basically merge this. Any more remarks before I do that?
OK, looks good from my tiny cell phone. Give it a rip!
Thank you very much for the code, the ideas, and the fruitful discussion!
(I'm not sure if my name or date or version belong in here. Feel free to remove them.)