Git Product home page Git Product logo

cwsim's Introduction

CW Simulator

This is the source repository for a CW contest simulator written in python, based on and mostly a clone of Morse Runner by Alex, VE3NEA. Therefore it is a derivative work of Morse Runner Copyright 2004-2006, Alex Shovkoplyas, VE3NEA [email protected]. The Morse Runner source is distributed under the Mozilla Public License, v. 2.0. You can download it here.

No Morse Runner files are used directly in this project, but most algorithms are identical, and often functions are straightforward translations of the Morse Runner Delphi code into python. I used the GNU GPL version of Qt and Qt Designer for my GUI code, so the cwsim code is licensed under GNU GPL version 3.0, to be consistent with that license.

The code runs on Linux, Mac OS, and Windows, and probably any other platform that supports python, Qt, and portaudio.

Windows Users

If you are running Microsoft Windows, and do not wish to install python and the requirements, as described below, a windows executable file is available under the Releases tag on Github. This file is automatically built by github runners on release. It just uses Pyinstall to gather the python components below and package them into an exe file. Download and run the executable.

Windows users can also install and run python directly as described below.

Installation

You just need to satisfy the requirements in requirements.txt or requirements_qt5.txt (sounddevice uses portaudio). One way is to use pip and requirements:

Steps

  • Install python version 3.8 or later.

  • The following steps should be done in a terminal (or powershell on Windows)

  • Clone this archive:

    git clone https://github.com/w9cf/cwsim

  • Change to the cwsim directory:

    cd cwsim

  • Install requirements

    pip install -r requirements.txt --user

    alternatively, to use the older Qt5 version instead of the current Qt6,

    pip install -r requirements_qt5.txt --user

  • Run the program with:

    python python/cwsim.py

Alternative for Raspberry Pi 4B

I normally run Slackware on my PI 4B. The installation just uses sbopkg and slackbuilds.com to add the needed packages. I did test with the 2022-04-04 64bit Raspberry Pi operating system. Here are the commands I used to install the needed packages:

git clone https://github.com/w9cf/cwsim.git
sudo apt-get install python3-matplotlib
sudo apt-get install python3-pyqt5
sudo apt-get install libportaudio2
pip install pip --upgrade --user
python3 -m pip install numpy==1.23 --user
python3 -m pip install sounddevice --user
python3 -m pip install pyxdg --user

Then

cd cwsim/python
python3 cwsim.py

Note! Make sure the numpy version is >= 1.22, otherwise a numpy.accumulate bug in older versions will crash the program unless QSK is turned off. This bug was fixed in numpy 1.22. The python3 -m pip install numpy==1.23 --user command above will install numpy 1.23 locally.

cwsim's People

Contributors

bg7jaf avatar w9cf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cwsim's Issues

macOS sounddevice.PortAudioError

Thanks for the work!

Trying to run this on macOS Ventura with a new Python install. Ran through the installation and the main window shows up, but pushing "Start" crashes it and gives this feedback:

$ python3 python/cwsim.py
||PaMacCore (AUHAL)|| Error on line 1316: err='-66748', msg=Unknown Error
Traceback (most recent call last):
  File "/Users/Matt/Desktop/cwsim/cwsim/python/cwsim.py", line 554, in startStop
    self.contest.start()
  File "/Users/Matt/Desktop/cwsim/cwsim/python/contest.py", line 333, in start
    self.stream = sd.OutputStream(samplerate=self._rate
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Matt/Library/Python/3.12/lib/python/site-packages/sounddevice.py", line 1494, in __init__
    _StreamBase.__init__(self, kind='output', wrap_callback='array',
  File "/Users/Matt/Library/Python/3.12/lib/python/site-packages/sounddevice.py", line 898, in __init__
    _check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters,
  File "/Users/Matt/Library/Python/3.12/lib/python/site-packages/sounddevice.py", line 2747, in _check
    raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening OutputStream: Internal PortAudio error [PaErrorCode -9986]
Abort trap: 6

Support hotkeys same as N1MM & Morse Runner

There are certain hotkeys used by N1MM & Morse Runner (and similar):

  • \ Same as F1
  • ; Exchange (Same as F2)
  • . TU same as F3

These are handy because you don't have to reach for the F-keys as much.
Would this be something you can consider implementing?

Problem with creating wheels

Hi Kevin.
Super nice implementation, thanks a million for sharing!
I am a casual Python user (no package-wiz :) ) and had some minor issues with installing it on my Mac (BigSur 11.7), Python 3.11.
Running pip with the requirements file went fine until the final build of wheels for numpy, matplotlib where the installation crashed. (some output argument was no of the proper type - sounds like some compatibilty problem). When a ran "pip install" manually line by line in requirements.txt everything worked just fine. cwsim is running like a charm!

/Jens SM0HEV/SM1HEV/SF1Z CWops #2237

Sounddevice on Mac

A pecularity with sounddevice package (at least on Mac) is that it does not seem to read the list of available/default/selected audio devices continuously. When you change output device on the Mac or plugging in a headphone while cwsim is running will not automatically redirect the sound to the headphones.
Workaround - have the headphones connected when starting cwsim :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.