Printf("%s ", alphamorse) - 65]) // Print the a-z string If (T != ' ' & (!isdigit(T))) // if user input isnt space or number While (T != '\0') // Convert the string to morse (the end of the string '\0') Printf("\nMorse convert in progress.\n") // UI Printf("\nYour input:\n") // UI -> string show Gets(T) // To recive input from user keyboard Printf("\nEnter a sentence:\n") // UI -> string Scanf_s("%d", &delaydd) // To recive input from user keyboard Printf("\n Delay between Dash/Dot duration : \n") // UI -> delay duration (Default 0msec) Scanf_s("%d", &dot) // To recive input from user keyboard Printf("\n Dot ('.') duration : \n") // UI -> dash duration (Default 100msec) Scanf_s("%d", &dash) // To recive input from user keyboard Printf("\n Dash ('-') duration : \n") // UI -> dash duration (Default 300msec) Gets(enter) //recive the 'Enter' pressing from user without interruption for the gets below Scanf_s("%d", &freq) // To recive input from user keyboard } while (input > 4 || input frequancy (Default -> unsigned int freq=550) Scanf_s("%d", &input) // scan -> user input Printf("\nUltrasonic Data Transmit & Receive - POC\n \nChoose one of the following options by entering the number:\n" "\n1.Transmit\n" "2.Receive\n" "3.Configuration\n" "4.Exit\n") //UI main menu Input = 0 count = 0 i = 0, j = 0 // reset the Setting & Variables values Unsigned int input = 0 //defult value of menu input Unsigned int delaydd = 0 // delay between dash/dots Unsigned int freq=550,dash=300,dot=100 // Recommended -> dash time x3 then dot -Setting & Variables-//Ĭhar enter // To recive enter input without interruption #include "delay.h" // To call delay.h function #include // To use more standard functions #include // To use standard input/output functions #include // To use output of the computer (speakers) Out = paste(unlist(empty.Code: #define _CRT_SECURE_NO_WARNINGS // To ingore VisualStudio C language errors # 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 – ).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |