morsekob / pykob Goto Github PK
View Code? Open in Web Editor NEWPython implementation of a library for Morse and MorseKOB functionality
Home Page: https://sites.google.com/site/morsekob/morsekob40
License: MIT License
Python implementation of a library for Morse and MorseKOB functionality
Home Page: https://sites.google.com/site/morsekob/morsekob40
License: MIT License
Announcing the current time immediate provides a quick check on audio and serial configuration.
When connecting to a wire MKOB (python) uses "AC Les - Seattle, WA" even though a different station name was specified.
Steps to replicate:
$ python3 Clock.py
Traceback (most recent call last):
File "Clock.py", line 34, in
from pykob import config, kob, morse, log
File "/Users/Patrick/Documents/Projects/Morse/MorseKOB/pykob-4/pykob/morse.py", line 31
from future import print_function ###
^
SyntaxError: from future imports must occur at the beginning of the file
and fix #! headers
Using Clock.py --help
info wasn't clear.
Eds-Macbook:PyKOB esilky$ python3 ./clock.py --help
2020-05-11 01:01:47 Starting Clock
usage: clock.py [-h] [-p portname] [-a sound] [-s speed] [-b time] [-e time]
[-i minutes] [-t]
optional arguments:
-h, --help show this help message and exit
-p portname, --port portname
The name of the serial port to use
-a sound, --sound sound
'ON' or 'OFF' to indicate whether morse audio should
be generated
-s speed, --speed speed
The morse send speed in WPM
-b time, --begin time
Beginning of time announcements
-e time, --end time End of time announcements
-i minutes, --interval minutes
The time announcement interval in minutes
-t, --text Whether to print text locally as it's sent to the
sounder
Eds-Macbook:PyKOB esilky$ python3 ./clock.py --begin time now
2020-05-11 01:08:55 Starting Clock
usage: clock.py [-h] [-p portname] [-a sound] [-s speed] [-b time] [-e time]
[-i minutes] [-t]
clock.py: error: argument -b/--begin: invalid int value: 'time'
Eds-Macbook:PyKOB esilky$
Given the help I tried python3 clock.py --begin time now
I also tried python3 clock.py --begin now
Neither worked.
I think the help needs to be more specific of the syntax.
Support the user preference of whether the sounder should be driven or not.
There are more configuration settings than the current PORT, SOUND, and WPM options. We might also enable configuration of
STATION - local station call
WIRE - default wire to connect to
CWPM - received speed? (although we should probably auto-detect speed instead)
LOCAL - local copy of generated traffic (using settings of SOUND and PORT)
REMOTE - remote copy of generated traffic (using setting of WIRE)
git should ignore any log files; Receive.py creates a log file "log.txt".
When the reader window is full, new text should cause the window to scroll up smoothly. Instead, it jitters up and down slightly with each new character.
This problem was frustrating enough that it caused me to give up on the whole MKOB project in despair.
When connected to a wire the 'Connected Stations" list (un-labled upper right text box) doesn't list any stations.
Steps to reproduce:
This excerpt from the MorseKOB 2.5 tutorial describes the expected behavior. It facilitates round table discussions with multiple operators, such as the nets that take place regularly on wire 11.
Within 10 seconds after connecting, in the text box in the upper right part of the KOB window you’ll see a list of the IDs for everyone connected to the same wire that you’re on. Whenever someone transmits, their ID is moved to the bottom of the list, so the station at the top of the list is the one that has waited the longest since their last transmission. About 60 seconds after a user disconnects from the wire, their ID is removed from the list.
Save and restore the main config values between MorseKOB sessions. Specifically, these settings are the station ID, code speed (WPM), and wire number.
Slight differences in manually sent code (especially American Morse) can cause 'typos' to occur in the decoded output. For example, a transmitted line of 'THE QUICK BROWN FOX' might be decoded to 'TSE QUICK 8ROWN FEEX' with just three very small decoding errors.
Rather than trying to fine tune the decoding - which currently works very well as-is, and in trying to 'adjust' might do more harm than good - adding an option to enable 'auto-correct' might work better.
Auto-correct has been available in word processing, email, and messaging applications for many years. Recently they have improved significantly. Adding an auto-correct option that processes the decoded text (as text) might work better than trying to adjust the decoding algorithm.
The PyKOB applications/commands (Time.py
, News.py
, etc.) should gracefully handle the KeyboardInterrupt
to exit.
Currently, many of the apps/commands produce a Traceback when ^C is used to exit.
Create an End-User friendly installer for MKOB-4.0 (PyKob).
This should be easy/intuitive to run and should install the application so it is ready to run.
The initial focus should be on Mac and Linux (particularly the Raspberry Pi) to provide non-Windows users the ability to use the application (MKOB-2.5 is Windows only).
When I have questions about GitHub, should I post them to this 'issues' thread? In particular, I don't know if I should @mention you guys when I post an issue, and/or follow up with a comment. As an experiment, I'll mention @AESilky here and see what happens. Patrick, did you get a notification of this issue?
By the way, I'm using GitHub Desktop to post this issue.
The existing config.py code is somewhat inconsistent about the 'SOUND' option - it's stored in the config file as a string ('ON' or 'OFF') but it's retrieved and used as a boolean. I believe it always came out 'True' as a result. Pull request #29 changes the config.py code to at least consistently store only the strings 'ON' and 'OFF' and have the Clock.py code re-interpret it as True or False respectively when creating the KOB.
We should either have all calling code configured similarly or to change the config option to save and restore a boolean. The current usage makes it awkward to set the default option for the "--sound" override.
Another option would be to define two complementary options (e.g. "-a" for audio on and "-q" for "quiet"?) argsparse can nicely handle the mutual exclusivity between those options.
The main question is to settle the content of the config file, and then make everything consistent.
It would be convenient to allow individual PyKOB commands/utilities to allow command line options to override the global configuration settings (configured using Configure.py, stored in the two .INI files, read by the 'config.py' module, and made available to the commands).
For example: the user might have used Configure.py
(via configure.cmd
or configure.sh
) to set 'SPEED' (WPM) to '20', but for the Time.py
program they would like to temporarily speed it up to 25 WPM. Being able to use the --speed 25
option on the Time.py
launch to set the speed to 25 just for this instance rather than changing the user's saved preferences would be useful.
Issue 'Default command-line option parsing to override configured defaults #13' should depend on this issue, rather than duplicating the options processing code in each application.
This is likely a problem with pykob.morse.Reader, but it becomes apparent in the MorseKOB app.
User preferences/configuration allows the user to set a character speed (in Words-Per-Minute).
Update the core to accept and use the character speed value.
For the 'MKOB' app (the GUI app for (Py)MorseKOB), it seems like a title bar of "MorseKOB " would be better than "MKOB ".
When connected to a wire, using the (un-labeled) lower left text box to enter text to send doesn't send code.
Steps to reproduce:
Document the timing of Morse code, addressing especially the differences between International Morse and American Morse as well as how Farnsworth spacing is calculated for both codes.
Provide an easy way to install the components needed to run PyKOB and run it.
This should check/install Python, the needed libraries, the application and provide a launch application so users don't need to use a command like python3 mkob.py
to run the application.
When running MKOB.pyw
from a command/terminal on Mac, the terminal window remains open (I think it should go away right away. The fact that it remains open is (probably) a separate issue.
This issue is that when the GUI is closed, the command/terminal remains open. It seems like it should close, or at least go back to a prompt.
Currently, the pykob.internet
module looks for a zero-length code sequence to indicate that a data packet is an ID packet and not a code packet. It would be better to use the 'flags' field in the data packet to make this determination.
Formatted string literals fail with Python 3.5.
Add a --save
option to save the user specified application options (the values for --full
, --di
) to be used when the app is next run.
Might consider --Save
to save all options (app and common) - but that should be a separate issue.
Also --default
to remove the user values that have been saved (so they will pick up the current programmed defaults) - but that should be a separate issue.
Someone more knowledgeable than myself needs to overhaul the setup files pykob/setup.py
and mkob/setup.py
. All details of these files need to be revisited (version no., etc.) but in particular I should not be listed as the sole author. Also, I don't know how these setup files relate to the broader issue #44 of providing installation capabilities for different platforms.
All of the MKOB files need the license header.
The configuration values for things like 'text speed', 'port', 'computer audio', 'code type', etc. should come from the Config object, not hard-coded.
A separate issue for saving changes to the preferences/configuration should be created.
The new 'config' module enables consistent configuration of various settings but we might consider some standard code to parse command line options for overrides of all of the configurable options, including ones suggested in Issue #12?
Provide an easy way to install the components needed to run PyKOB and run it.
This should check/install Python, the needed libraries, the application and provide a launch application so users don't need to use a command like python3 mkob.py
to run the application.
Many chiming clocks announce on the quarter-hour (0-15-30-45). It would be nice to have an option that does that.
'Continuous' can be a bit too much, while 'Hour' isn't often enough in some cases.
Something like Quarter
seems reasonable.
This will cover the UDP packet format, server commands, and extensions to the CWCom protocol to support closed-circuit telegraphy.
The config.py
module processes setting the Station
and Wire
values into the preference file, but when reading it back it always processes as None
.
It would be nice to have Windows, Mac and Linux shortcuts for the typically used applications (sample.py
, clock.py
, etc.) so the user doesn't need the enter python3 <app.py> (py <app.py>)
.
To make it easier to find any/all of the logging output and to make it easier to ignore any generated logging files in Git (or other VCS), create a log/
directory and configure all logging to go into it.
Update .gitignore
to ignore log/
.
Currently pykob.internet.py
is hardcoded to use 'mtc-kob.dyndns.org:7890'.
Provide an option to set the KOBServer URL so an alternate KOBServer can be used (primarily for testing).
Provide an easy way to install the components needed to run PyKOB and run it.
This should check/install Python, the needed libraries, the application and provide a launch application so users don't need to use a command like python3 mkob.py to run the application.
Running MKOB (python) on Mac doesn't display the label text and the buttons and text-box outlines do not display acceptably.
Information from test:
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
2020-05-26 23:42:24.352 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.352 Python[851:26597] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
2020-05-26 23:42:24.449 Python[851:26597] CoreText note: Client requested name ".SF NS Mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.457 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.457 Python[851:26597] CoreText note: Client requested name ".SF NS Mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.457 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.457 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.458 Python[851:26597] CoreText note: Client requested name ".SF NS Mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.458 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
When running on a Mac the GUI has a lot of boxes, buttons, etc. that don't display (or are very faint) when compared the the GUI on Windows (I haven't checked yet on Linux).
When I run Sample.py, I do hear the simulated sounder through the speakers, but the program produces the following warning messages:
les@Whimsy:~/PyKOB$ python3 Sample.py
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
HI
~ The quick brown fox +
les@Whimsy:~/PyKOB$
If I try listening to an active wire using the MKOB client, the 'ALSA underrun' message appears over and over again.
The code should have no more hard-coded configuration settings (e.g. for PORT, WPM etc.) but should consistently use the 'config' framework instead.
When MKOB is connected to a wire and a remote operator opens his key ("breaks" the circuit), the local loop should remain open. That way, when the local operator's sounder stops following his key, he knows that the remote operator wants him to stop sending and close his key.
Past experience tells me this is surprisingly tricky to implement, but worth the effort.
MorseKOB 2.5 allows the local operator to regain control of the wire by toggling the circuit closer checkbox (or, equivalently, by pressing the Escape key twice). This has proved to be a useful feature, despite its departure from realism.
"Cut Numbers" are letters used in place of common numbers. See https://wb8ylo.wordpress.com/2014/12/04/cw-shorthand-cut-numbers/ for a table of abbreviations for otherwise 5-symbol number representations and their "cut number" variants:
Number Normal Code Cut Number Result
1 di dah dah dah dah di dah A
2 di di dah dah dah di di dah U
3 di di di dah dah di di di dah V
4 di di di di dah di di di di dah 4
5 di di di di dit dit E
6 dah di di di dit dah di di di dit 6
7 dah dah di di dit dah dah dit G
8 dah dah dah di dit dah di dit D
9 dah dah dah dah dit dah dit N
0 dah dah dah dah dah dah T
It would be cool if either the core Morse encoding engine or specific applications like Clock.py could add optional support for using "cut numbers" to represent the numeric content in the message, perhaps in various levels (e.g. only use 'N' for '9', or also use 'T' for '0', or use A,U,V,E,G,and D as well?)
When Clock.py makes its initial announcement, it doesn't make sure the minutes have a leading '0' for the first 10 minutes. It will announce "The time is 16:7", for instance, instead.
The format should use a leading zero to make sure the 'minutes' field is always exactly 2 digits.
There should be a platform friendly/specific 'application launcher' that can be installed and allows a user to launch the application via an icon/shortcut (rather than running pythonX MKOB.py
) In a platform GUI. The app/launch icon should be a "Morse-type image". The icon should be shown in the 'start/active' bar and as a desktop item (if the user selects to create it) to launch the app or select it when it is running.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.