May 02, 2024, 11:11:40 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Amateur Radio - Morse Code Trainer

Started by GWS, November 22, 2007, 01:21:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GWS

Hi folks,

I've finally managed to convert this program from 5 years ago  ::) to Creative Basic facilities.

I wasn't sure I could do it, but it worked out OK, and if anything I think it works better than the original.
Certainly, the morse timing is better, and the sending practice is easier.

There are some interesting effects built in.  Try the 'Preferences - Speed' menu option ..  :)

Also, most working pages are gradient filled, and appear to have a top description bar.  In fact the 'bar' is drawn as part of the fill - how it works I've no idea - but it seemed interesting ..  :)

It's quite a big program, and you may find some way to 'break' it.  If you find any funny happenings, let me know ..  :)

all the best,

Graham
Tomorrow may be too late ..

tbohon

Great timing, Graham ... I'm about finished with my study for my Extra upgrade and will then be jumping into Morse Code with both feet.  This is sure to help.

Kind of sorry they removed the Morse Code requirement for the higher level licenses ... but QRP Morse Code and Emergency Communications are the two reasons I finally got my license so I'm going to learn it in spite of the FCC!

73,

Tom / KE7EJJ
"If you lead your life the right way, the karma will take care of itself ... the dreams will come to you."  -- Randy Pausch, PhD (1961-2008)

GWS

That's excellent Tom ..  :)

I've been up close and personal with it for quite a while, so I'll be interested if you find it useable and helpful.

best wishes,

Graham (G4EVW)

Tomorrow may be too late ..

JoaoAfonso

As military officer, and remembering history of my country, the maximum speed of 20 words per minute is too slow. Good operators were trained to reach 60 per minute, and certain very good persons could even go up to 90 per minute. Also the sound used to 'beep' fades away abit, which is not good for morse... it should just be a tone. All in all, morse was good (and still used in modern armies) and could be used in very long distances (via radio) because of such characteristics - even with lots of noise and interferences, it can be heard very clearly.

I am not wanting to be unpolite: I have even done a morse key too in IB STD once (it is in standard archive collected by Joske, if I am not wrong), but this one is much more better. I like yours much more :) Please understand my comments as incentives to make your program better.
Also Q code is used by civilians, but there is a NATO manual that explains every code (it is a very big book!). For amateur and CB communications, though, I guess that your list is what is used.
I dont know also if in other countries you have such codes too, but when operators are listening a radio for morse code, they wait to hear someone opening a connection.
To make an operator ready to read what I am saying (open the connection), it was used VVV and the following -.-.-  (three times). I still remember it from hearing when I learnt it :)

I though in making it to my morse key but run out of patience, but would be an amazing addition to your program if you could make a connection between 2 morse keys programs. That way, if I open a connection with you (via socket, or something), I could send you morse signals and in your computer would appear what I wrote ;)

Thank you for the program.
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

Egil

Thanks for the nice program Graham!

I have seen many similar morse training programs, and this must be one of the best.

I will certainly learn a lot by studying your code. And as I have lately been looking for information on how to make my own midi sound files for an onlline morse code trainer, I hope your code will lead me in the right direction.

Quote from: JoaoAfonso on November 22, 2007, 03:19:26 PM
As military officer, and remembering history of my country, the maximum speed of 20 words per minute is too slow. Good operators were trained to reach 60 per minute, and certain very good persons could even go up to 90 per minute.

Neither I want to be unpolite, but I beleive your memory is a little off the track... One "word per minute" in morse code means transmission of 5 characters including the correct spacing between characters plus one word spacing. So a speed of 20 words per minute means 100 characters per minute.
I agree that for a well trained radio operator this i a little slow, but for the average radio amateur this is more than enough.

73' de LA2PJ
Support Amateur Radio  -  Have a ham  for dinner!

GWS

Hi JoÃÆ'Ã,£o,

Thanks for your comments ..  :)

Morse is an acquired skill.  When I began learning morse, we started at 5 wpm listening to a kind local amateur who spent many evenings sending test transmissions for us.  We gradually increased to 12 wpm at which point we took our morse test to qualify for our senior amateur licence.  It was not easy to get to that speed.

To send faster, people usually invested in electronic keys or computer sent morse.  Only a few went on to 20 wpm and higher.
Like languages, some have the skill to hear morse and understand it in their heads without writing it down.  I found I couldn't do that - I have to jot down what I copy.  For me 15 wpm is about my limit ..  :) - a nice leisurely pace, and fun. :)

You are right, the sound is not perfect.  My previous attempt used .wav sounds and a lot of API routines.  It was messy, complicated, and not very satisfying to listen to.  Interrupting and re-starting wav files rapidly gives rise to horrible clicks.

This time I tried the in-built midi facilities.  This gave simpler code, and left only the problem of choosing which 'instrument' to use.  I chose the 'Whistle' midi sound, which seemed about the best.  Obviously if you pick 'piano', a dash sound once started, would fade away too quickly.

Maybe in future, we shall see an inbuilt sound generating tone system which would be better ..  ;)

I've based the program on ARRL standards.  To make a new contact myself, I use: CQ CQ de G4EVW on a clear frequency ..  :)
You never know who might reply ..

Connecting two 'stations' over the internet is a nice idea, but would be difficult.  I have a 'radio station' program which I can't get to work because my internet connection uses a router.  The outside World does not know my true IP address and so I can not receive incoming communications directly.  I'll see if I can figure something out ..  :)

Egil>  you're welcome ..  :)  The midi sound system seems quite interesting - I'm going to play with it some more ..  :)

all the best,

Graham







Tomorrow may be too late ..

JoaoAfonso

GWS: check no-ip. I have a game myself in a pc under a router, and registering and using noip client can do that as you wish. Also, with sound, I used a tone setup program and created a sound in my morse key that lasts less than a second in the same frequency, so each time one hits ENTER, it gives a very similar sound as a true morse key, and in my key did not mess with anything. I will put it attached.

Egil: I have read what you told and was more a confusion I made than a lack of memory. I commented 20 WPM is few but I understud it as characters per minute, as you stated. My appologies.

Thank you all again.
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

GWS

Thanks JoÃÆ'Ã,£o,

Yes, I was able to generate pure .wav tones - the problem is controlling them into fast pulses for dits and dahs ..  :)
That's the difficult bit.

I found a comment in Wikipeadia:

QuoteThe fastest speed ever sent by a straight key was achieved in 1942 by Harry Turner W9YZE (d. 1992) who reached 35 WPM in a demonstration at a U.S. Army base.

That sounds about right ..  :)

My main satisfaction with this program was demonstrating that yet again, simple Creative Basic was up to the job. :)

best wishes,

Graham
Tomorrow may be too late ..

JoaoAfonso

Again I could do it with that simple .wav file. Just need to check if key is down, and while is down play the wav. As it is the same tone and a very short sound, again even less than 1 second, what you hear is dits and dahs depending on how much time you press the key.
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

Egil

Quote from: JoaoAfonso on November 23, 2007, 07:44:23 AM
Egil: I have read what you told and was more a confusion I made than a lack of memory. I commented 20 WPM is few but I understud it as characters per minute, as you stated. My appologies.
Well, that's what I thought. but still I hoped your statement was true.... :D

But, to get back on track, I have been studying Grahams code thoroughly, but there is something I dont quite understand. Guess the reason is that my Windows system knowledge is next to nothing...

The program lines confusing me are:

declare "WINMM",midiOutOpen(hMidi:pointer,m1:UINT,m2:UINT,m3:UINT,m4:UINT),int
declare "WINMM",midiOutSetVolume(hMidiOut:int,vol:int),int
declare "WINMM",midiOutClose(hMidiOut:int),int
declare "WINMM",midiOutShortMsg(hMidiOut:int,dwMsg:int),int


I understand that external routines are called, but I can't find informatiion about the use of these routines. Any advice on how and where to get this information would be very much appreciated.
And finally, I have to get myself a book or two on Windows programming, which also could double as a reference. Any suggestions??
Support Amateur Radio  -  Have a ham  for dinner!

GWS

Hi Egil,

Well I don't know much more about those API functions than you do - I tend to think of them as 'black box' utilities that just work ..  :)

There is another example in the CBasic samples called 'midisynth.cba' that uses them.

Like all Microsoft systems, their multimedia software in 'winmm.dll' is very complicated, as is writing any Midi programs.

There's heaps of stuff here:

http://msdn2.microsoft.com/en-us/library/ms712636.aspx

but mostly it uses 'C' type syntax that needs converting for use with Basic ..  ::) .. nothing's easy ..  :)

I'm intending to play with it all a bit more, and see if I can make any sense of it .. perhaps one day Paul will wrap some of it in more easily used built-in commands.

Midi API is a bit touchy I've found.  If your program goes wrong in some way, and it doesn't get to a proper close at the 'WaitUntil' statement, the 'midioutclose' is not executed, and the sound channel is not released.  You have to come out of the IDE and re-start to get sound to work again .. what a pain ..  :)

all the best,

Graham
Tomorrow may be too late ..

Egil

Hi Graham,

and thanks for the info. Guess I'll be busy reading until next summer or so...  :D

For the online morse tutor project mentioned above I have used a program called "MorseMidi" to produce the midi files, each containing just one character. But the author of that program has hardcoded an organ voice full of overtones with a kind of "bathroom" effect. That makes the sounds a little funny, so I thought I should give it a try and make a program to roll  my own midi files, and maybe learn something by doing it.

Thanks again!
Support Amateur Radio  -  Have a ham  for dinner!

Egil

After weeks of searching for information I just stumbled into a website which by its autor is called "MIDI Technical Fanatic's Brainwashing Center".
URL: http://www.borg.com/~jglatt/

Among loads of midi information I found a really nice and down to earth explanation og the .MID file.

Maybe the site also ciontains the information you need Graham?

Good luck!
Support Amateur Radio  -  Have a ham  for dinner!

GWS

Thanks Egil .. something for me to read too ..  :)

Yes, an organ would sound very strange ..  ;D
I'll keep looking to find a better sound system - but meanwhile, the 'Whistle' isn't bad..

Graham
Tomorrow may be too late ..

Egil

The whistle is just fine!
Guess the sound quality will depend on what quality your soundcard has.

By the way, her is my test page with the organ sounds.  (The text is in Norwegian)
http://www.la2pj.net/morse/cwkurs1.htm
Support Amateur Radio  -  Have a ham  for dinner!

GWS

Tomorrow may be too late ..

GWS

Hmm .. very interesting  ..  :)

I've been experimenting with using .wav files with sinusoidal tone samples - (thanks to JoÃÆ'Ã,£o for his morse program)  :)

I was amazed to find the length of sample can be reduced to just a single cycle of the waveform ..  :o and PlayWave can handle it.
If you try to listen to it in media player or any sound player, the sound is just meaningless clicks ..  but Playwave on repeat seems to sound it OK.

However, as I seemed to recall from past attempts, when you incorporate the sounds in a fast sequence of dits and dahs, you get what to my ears are unacceptable clicks.  :(

I think this must come from modern digital sound cards trying to respond instantly to fast impulse sounds - starting from silence and going straight to a strong tone output, and then off again.  Maybe the card can do it, but I don't think the amplifier and speaker systems like it.

I tried single cycle sinewaves, three cycle sinewaves, and square waves - finally settling on the 3 cycle wav files.  (The square waves sounded horrible).

So, in the interests of completeness, I attach the modified program using 3 cycle sinewaves and PlayWave statements for the sound system.   The code is simpler, and it works OK - but I'm not happy with the sounds.   See what you think. :)

By the way, I've increased the speeds available up to 30 wpm to keep JoÃÆ'Ã,£o happy ..  :), and the tone frequencies up to 940 cycles per second (apologies to Herr Hertz) .. :)

all the best,

Graham 

Tomorrow may be too late ..

JoaoAfonso

JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

Egil

Graham:
Your latest version of the morse code program is a great idea. But you fell into the key click trap, a well known problem which appears when signal curves have fast raise and decay times. As you probably know, this is easily overcome on telegraphy transmitters by inserting a small capasitor across the morse key teminals.

I guess you canl come around this problem by synthesizing a "capasitor" into your program. This can easily be done by making another wave file edited to reduce the volume from full to zero over a certain amount of cycles, and append it to the end of the end of each dash and dot. How many cycles needed must be found by experimentation, but ten to twenty cycles ought to be enough, and will not be noticeable to the human ear.

If you need an audio file editor for this,  I recommend the "Audacity" program. An excellent piece of work, and it's freeware. http://audacity.sourceforge.net/

By the way, the wav version of your program does'nt work on my computer. The morse code generated is only a random dit every now and then, regardless of what character shown on the screen. But since it appearently work on other computers, it must be something with my setup causing the problem. I do hear the key clicks though...

Egil
Support Amateur Radio  -  Have a ham  for dinner!

GWS

Thanks for the comments Egil ..  :)

Yep, I used Audacity to generate the .wav files.  It is a good program.

I had thought about 'easing' the sounds in and out as you suggest as a sort of 'filter', but it seemed too complicated when all we want is a simple tone.  I think I prefer the Whistle sound myself anyway.  I might try it though when I've got a bit of time ..  :)

I just tried the second version again and it works for me .. I can't think why yours is different.  I'm running Windows XP - maybe you're on a different o/s, although why that should make a difference I've no idea.

While I was playing about with the second version, I also found that several 'Wait' statements I'd inserted in some of the loops, were causing variation of some of the dot / dash durations - pretty well randomly.

So I think these could safely be removed from version 1.  If you do a search for 'Wait' (whole word), and remove them, it will probably sound better ..  :)

best wishes,

Graham
Tomorrow may be too late ..