![]() ![]() Guru A virtual teacher who reveals to you the great secrets of Base64 # grouping letters into words based on word.ends vec:Ĭur.points = letter.vec] Letter.vec = unlist(lapply(empty.list, function(x))) # grouping the beep duration letters (l's and s's) into lettersĬur.points = ]Įmpty.list] = paste(cur.points,collapse = "") # recoding beep durations to long and short:ī = "l"ī = "s" Word.ends = which(as.numeric(pause.durs > p.2) = 1) # creating the letter and word end vectors: Pause.centers = ī = kmeans(as.numeric(names(raw.tab)),2)$centersīeep.centers = ![]() = kmeans(as.numeric(names(raw.tab)),3)$centers # note: this step needs to take the beep.durs data and the pause.durs data # few beep durs that are only 1 for now, hard coding these out: # note: for some files, there seems to be a few # create indices for change instances - these will be 1 and -1īeep.durs =. If you’ve got ideas for how to improve things, definitely let me know on twitter – I’m the code: # initialize # The solution starts with a bit of a strange stamp, but the rest should be pretty easy to read. ![]() wav file is stored on your machine), then execute my code. wav (and make sure to change the file path for the sf.1 object to wherever the. If you’d like to give it a spin, try downloading one of the example morse code files e.g. It’s still pretty fragile because the example sound files I’ve been using are computer generated, so the function won’t really work on Morse code ‘in the wild’ yet. ultimately not that bad though.įiguring out how to deal with the converted audio file was actually a lot of fun – after a few hours of tinkering, I arrived at a solution (copied below) which converts audio Morse code to text. The only bother here was needing to convert the sound files from. To get these into R, I used the readWave function from Uwe Ligges’ very cool tuneR package. To start on all of this, I found a site with a bunch of example Morse code sound files, maintained by The National Association for Amateur Radio (there are a bunch of files here – ). Hand the paper to someone who runs the code over to another tent, ultimately to be sent to the decryption device.Īll this got me thinking – wouldn’t it be great if the ‘wire listening’ part of this process could be automated too? So here’s the toy problem all this made me think about: could I write an R function which would take a sound file (.wav) with Morse code, and return decrypted text?.Write down the series of short and long beeps on a piece of paper.The movie features a bunch of scenes with bustling rooms full or workers intercepting (and documenting) encrypted radio transmissions, which are then passed along to Turing’s decryption device (bombe). A few months ago, I finally got a chance to see The Imitation Game (the new Alan Turing movie), which gave me an idea for a Sunday morning R hacking session.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |