File Exchange

image thumbnail

Morse Code

version 1.0 (14.1 KB) by

This converts text to playable morse code in wav format.

4.14286
7 Ratings

5 Downloads

Updated

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

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');

Comments and Ratings (13)

genial aporte

Sandeep Kaur

can anyone tell me how to convert speech to text?

Esben

Esben (view profile)

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...

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?

Chris Knox

Elvin Hai

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

Craig Miller K3OOL

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

senthil raj

hou to convert text into speech more efficiently

J Cea

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

mani khan

how to convert wave file to .mat extension

Osamah Rawashdeh

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

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

joe schmoe

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

Updates

Added more description to the help section.

MATLAB Release
MATLAB 7 (R14)
Acknowledgements

Inspired: demorse, Morse/Demorse unleashed

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video