I have a radio receiver. That radio's sound output goes to my computer. The sound output contains morse code on or about 440 Hz. That morse code could range in speed from 2 to 20 WPM. I sort-of know how to figure out whether the other station is transmitting, but how do I take that transmitting/not transmitting state and turn it into text? I thought there might be a better solution than brute force.
Complicating factors:
- I want the program to be able to figure out how fast the other station is transmitting rather than it being specified by the user as in most morse-code programs.
- There is noise
- Morse code transmitters don't turn on and off instantly. There is a rise and fall time on the order of 4 milliseconds.
- Much of this morse code is sent by people, and is thus not perfect:
- For instance, a pause between words is supposed to by 7 elements, but it could be anything from 5 to 8.
- A persons sending speed could vary by about 20% in a single conversation
- I want to do this in more-or-less real time. It's ok if the program outputs something, realizes it's a mistake, and corrects it.
Example output of program so far. It can resolve the audio into keyed/not keyed, but resolving that into dots/dashes is not working.
###########################################################__________________________
_________________________________####################################################
#####################################################################################
#######################################______________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_____________________________________________________________________________________
_________________________
Any code/suggestions on the thing that determines transmitting/not transmitting and/or the section that resolves that to morse code would be appreciated.
About separating dots from dashes and spaces from each other one idea is to start collecting statistics at the start of conversation and put all "XXms of keyed" events into one array (or something) and all "YY ms of not keyed" into another array (or something). Then you will eventually a histogram probability(t) for keyed and the same for not keyed. These histograms should have some maximums and minimums, visible both to humans and to some algorithms. So, you do some rounding of the curves split them at those minimums to separate dots to the left from dashes to the right, same with maybe more than one minimum with spaces. This approach will really pick well into the conversation, but require no tuning.