{remorse}

Use R to convert text to Morse Code to audio.

Read more in the blog post.

Installation

You can install {remorse} from GitHub, which also installs {sonify}.

if (!require(remotes)) install.packages("remotes")
# remotes::install_github("matt-dray/remorse")
install.packages("remorse", repos = c('https://matt-dray.r-universe.dev', 'https://cloud.r-project.org'))
library(remorse)

Examples

Text to Morse Code:

text_in <- "hello there!"
morse <- txt2morse(text_in)
morse
#> [1] "...././.-../.-../--- -/...././.-././-.-.--"

And back again:

text_out <- morse2txt(morse)
text_out
#> [1] "HELLO THERE!"

And from Morse to audio (will play audio on your speakers):

morse2sfx(morse)

Check the full list of supported Morse Code:

morse_lookup
#>        A        B        C        D        E        F        G        H 
#>     ".-"   "-..."   "-.-."    "-.."      "."   "..-."    "--."   "...." 
#>        I        J        K        L        M        N        O        P 
#>     ".."   ".---"    "-.-"   ".-.."     "--"     "-."    "---"   ".--." 
#>        Q        R        S        T        U        V        W        X 
#>   "--.-"    ".-."    "..."      "-"    "..-"   "...-"    ".--"   "-..-" 
#>        Y        Z        0        1        2        3        4        5 
#>   "-.--"   "--.."  "-----"  ".----"  "..---"  "...--"  "....-"  "....." 
#>        6        7        8        9        &        '        @        ) 
#>  "-...."  "--..."  "---.."  "----."  ".-..." ".----." ".--.-." "-.--.-" 
#>        (        :        ,        =        !        .        -        * 
#>  "-.--." "---..." "--..--"  "-...-" "-.-.--" ".-.-.-" "-....-"   "-..-" 
#>        +        "        ?        /          
#>  ".-.-." ".-..-." "..--.."  "-..-."      " "