Code covered by the BSD License  

Highlights from
Morse Code

4.14286

4.1 | 7 ratings Rate this file 14 Downloads (last 30 days) File Size: 14.13 KB File ID: #7791

Morse Code

by Fahad Al Mahmood

 

05 Jun 2005 (Updated 08 Jun 2005)

This converts text to playable morse code in wav format.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

MORSE converts text to playable morse code in wav format.

SYNTAX
morse(text)
morse(text,file);

Description:

If the wave file name is specified, then the funtion will output a wav file with that file name. If only text is specified, then the function will only play the morse code wav file without saving it to a wav file.

Examples:

  morse('Hello');
  morse('How are you doing my friend?','morsecode.wav');

Acknowledgements
This submission has inspired the following:
demorse
MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (11)
18 Jul 2005 joe schmoe

Pretty neat, though it has little use now-a-days

17 Aug 2005 Carlo Cauyan

is there a code that does the opposite of this? convert a morse code audio into a alphanumeric message...a reply is greatly appreciated

19 Aug 2005 Osamah Rawashdeh

Awesome, usefull for creating ringtones for my cellphone ... ( SMS, MMS, CQ CQ CQ , etc)

25 Sep 2005 mani khan

how to convert wave file to .mat extension

16 Oct 2005 J Cea

To convert morse audio into text, do a search for "cw get"

24 Jan 2006 senthil raj

hou to convert text into speech more efficiently

30 Mar 2006 Craig Miller K3OOL

Nice program. Brute force method of generating Morse code but it works very well.

11 Aug 2007 Elvin Hai

It's a great program! May I know how the data in the wav.mat was obtained?

08 Mar 2008 Chris Knox  
11 Mar 2008 Chirag Bhatt

Hi , While running this program , I found the following error,
*************************************
??? Index exceeds matrix dimensions.

Error in ==> morse at 23
text = varargin{1};
*****************************************
My version is 7.2(R2006a)
What I have to do?

29 May 2009 Esben

Nice little useful program for training your morse skills:)

I updated the code a little, if anyone is interested... (feel free to add it to the original):

To have smaller spaces between letters, change line 33 from lsp = wav(6176:23022); to lsp = wav(6176:16022);

To add danish letters æ,ø,å (can be done for any additional signs, and I probably will later), add
AE = [Dit;ssp;Dah;ssp;Dit;ssp;Dah]; % danish Æ .-.-
OE = [Dah;ssp;Dah;ssp;Dah;ssp;Dit]; % danish Ø ---.
AA = [Dit;ssp;Dah;ssp;Dah;ssp;Dit;ssp;Dah]; % danish Å .--.-
and change
vars ={'period','comma','question','slash_'}; to
vars ={'period','comma','question','slash_','AE','OE','AA'};
and change
    elseif ismember(text(i),'.,?/')
        x = findstr(text(i),'.,?/');
to
    elseif ismember(text(i),'.,?/ÆØÅ')
        x = findstr(text(i),'.,?/ÆØÅ');

to modify the speed, a resampling is added in the last part (just after the loop):
morsecode=resample(morsecode,Fs,15000); % resample to Fs/15000
if the numberused is higher than Fs, the speed will be higher, if it is lower, the speed will be lower...

Please login to add a comment or rating.
Updates
08 Jun 2005

Added more description to the help section.

08 Jun 2005

Removed the wav file playing if the wav file name is specified.

Tag Activity for this File
Tag Applied By Date/Time
sound Fahad Al Mahmood 22 Oct 2008 07:49:57
morse code Fahad Al Mahmood 22 Oct 2008 07:49:57
audio Fahad Al Mahmood 22 Oct 2008 07:49:57
wav Fahad Al Mahmood 22 Oct 2008 07:49:58
utilities Fahad Al Mahmood 22 Oct 2008 07:49:58
potw Cristina McIntire 07 Nov 2008 13:02:33
pick of the week Jiro Doke 11 Feb 2011 20:17:16
morse code Iroel Miranda Catañeda 15 Dec 2011 11:45:43

Contact us at files@mathworks.com