<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://fweb.wallawalla.edu/class-wiki/index.php?action=history&amp;feed=atom&amp;title=Morse.m_This_is_the_one_from_mathworks</id>
	<title>Morse.m This is the one from mathworks - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://fweb.wallawalla.edu/class-wiki/index.php?action=history&amp;feed=atom&amp;title=Morse.m_This_is_the_one_from_mathworks"/>
	<link rel="alternate" type="text/html" href="https://fweb.wallawalla.edu/class-wiki/index.php?title=Morse.m_This_is_the_one_from_mathworks&amp;action=history"/>
	<updated>2026-06-10T00:28:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://fweb.wallawalla.edu/class-wiki/index.php?title=Morse.m_This_is_the_one_from_mathworks&amp;diff=10356&amp;oldid=prev</id>
		<title>Codlor: Created page with &#039;Matlab/Octave script used to convert text to morse code, and outputed as a wav file. &#039;&#039;&#039; morse.m&#039;&#039;&#039;  &lt;pre&gt; function morse(varargin)   % MORSE converts text to playable morse code…&#039;</title>
		<link rel="alternate" type="text/html" href="https://fweb.wallawalla.edu/class-wiki/index.php?title=Morse.m_This_is_the_one_from_mathworks&amp;diff=10356&amp;oldid=prev"/>
		<updated>2011-12-01T19:56:53Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;Matlab/Octave script used to convert text to morse code, and outputed as a wav file. &amp;#039;&amp;#039;&amp;#039; morse.m&amp;#039;&amp;#039;&amp;#039;  &amp;lt;pre&amp;gt; function morse(varargin)   % MORSE converts text to playable morse code…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Matlab/Octave script used to convert text to morse code, and outputed as a wav file.&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
morse.m&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function morse(varargin)&lt;br /&gt;
 &lt;br /&gt;
% MORSE converts text to playable morse code in wav format&lt;br /&gt;
% &lt;br /&gt;
% SYNTAX&lt;br /&gt;
% morse(text)&lt;br /&gt;
% morse(text,file);&lt;br /&gt;
% &lt;br /&gt;
% Description:&lt;br /&gt;
% &lt;br /&gt;
%   If the wave file name is specified, then the funtion will output a wav&lt;br /&gt;
%   file with that file name.  If only text is specified, then the function&lt;br /&gt;
%   will only play the morse code wav file without saving it to a wav file.&lt;br /&gt;
%&lt;br /&gt;
% Examples:&lt;br /&gt;
% &lt;br /&gt;
%   morse(&amp;#039;Hello&amp;#039;);&lt;br /&gt;
%   morse(&amp;#039;How are you doing my friend?&amp;#039;,&amp;#039;morsecode.wav&amp;#039;);&lt;br /&gt;
%&lt;br /&gt;
%   Copyright 2005 Fahad Al Mahmood&lt;br /&gt;
%   Version: 1.0 $  $Date: 05-Jun-2005&lt;br /&gt;
 &lt;br /&gt;
text = varargin{1};&lt;br /&gt;
if nargin==2&lt;br /&gt;
    file = varargin{2};&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
Fs=11025;&lt;br /&gt;
load wav;&lt;br /&gt;
Dit = wav(1106:2121);&lt;br /&gt;
ssp = wav(2121:3133);&lt;br /&gt;
Dah = wav(3133:6176);&lt;br /&gt;
lsp = wav(6176:23022);&lt;br /&gt;
 &lt;br /&gt;
% Defining Characters &amp;amp; Numbers&lt;br /&gt;
A = [Dit;ssp;Dah];&lt;br /&gt;
B = [Dah;ssp;Dit;ssp;Dit;ssp;Dit];&lt;br /&gt;
C = [Dah;ssp;Dit;ssp;Dah;ssp;Dit];&lt;br /&gt;
D = [Dah;ssp;Dit;ssp;Dit];&lt;br /&gt;
E = [Dit];&lt;br /&gt;
F = [Dit;ssp;Dit;ssp;Dah;ssp;Dit];&lt;br /&gt;
G = [Dah;ssp;Dah;ssp;Dit];&lt;br /&gt;
H = [Dit;ssp;Dit;ssp;Dit;ssp;Dit];&lt;br /&gt;
I = [Dit;ssp;Dit];&lt;br /&gt;
J = [Dit;ssp;Dah;ssp;Dah;ssp;Dah];&lt;br /&gt;
K = [Dah;ssp;Dit;ssp;Dah];&lt;br /&gt;
L = [Dit;ssp;Dah;ssp;Dit;ssp;Dit];&lt;br /&gt;
M = [Dah;ssp;Dah];&lt;br /&gt;
N = [Dah;ssp;Dit];&lt;br /&gt;
O = [Dah;ssp;Dah;ssp;Dah];&lt;br /&gt;
P = [Dit;ssp;Dah;ssp;Dah;ssp;Dit];&lt;br /&gt;
Q = [Dah;ssp;Dah;ssp;Dit;ssp;Dah];&lt;br /&gt;
R = [Dit;ssp;Dah;ssp;Dit];&lt;br /&gt;
S = [Dit;ssp;Dit;ssp;Dit];&lt;br /&gt;
T = [Dah];&lt;br /&gt;
U = [Dit;ssp;Dit;ssp;Dah];&lt;br /&gt;
V = [Dit;ssp;Dit;ssp;Dit;ssp;Dah];&lt;br /&gt;
W = [Dit;ssp;Dah;ssp;Dah];&lt;br /&gt;
X = [Dah;ssp;Dit;ssp;Dit;ssp;Dah];&lt;br /&gt;
Y = [Dah;ssp;Dit;ssp;Dah;ssp;Dah];&lt;br /&gt;
Z = [Dah;ssp;Dah;ssp;Dit;ssp;Dit];&lt;br /&gt;
period = [Dit;ssp;Dah;ssp;Dit;ssp;Dah;ssp;Dit;ssp;Dah];&lt;br /&gt;
comma = [Dah;ssp;Dah;ssp;Dit;ssp;Dit;ssp;Dah;ssp;Dah];&lt;br /&gt;
question = [Dit;ssp;Dit;ssp;Dah;ssp;Dah;ssp;Dit;ssp;Dit];&lt;br /&gt;
slash_ = [Dah;ssp;Dit;ssp;Dit;ssp;Dah;ssp;Dit];&lt;br /&gt;
n1 = [Dit;ssp;Dah;ssp;Dah;ssp;Dah;ssp;Dah];&lt;br /&gt;
n2 = [Dit;ssp;Dit;ssp;Dah;ssp;Dah;ssp;Dah];&lt;br /&gt;
n3 = [Dit;ssp;Dit;ssp;Dit;ssp;Dah;ssp;Dah];&lt;br /&gt;
n4 = [Dit;ssp;Dit;ssp;Dit;ssp;Dit;ssp;Dah];&lt;br /&gt;
n5 = [Dit;ssp;Dit;ssp;Dit;ssp;Dit;ssp;Dit];&lt;br /&gt;
n6 = [Dah;ssp;Dit;ssp;Dit;ssp;Dit;ssp;Dit];&lt;br /&gt;
n7 = [Dah;ssp;Dah;ssp;Dit;ssp;Dit;ssp;Dit];&lt;br /&gt;
n8 = [Dah;ssp;Dah;ssp;Dah;ssp;Dit;ssp;Dit];&lt;br /&gt;
n9 = [Dah;ssp;Dah;ssp;Dah;ssp;Dah;ssp;Dit];&lt;br /&gt;
n0 = [Dah;ssp;Dah;ssp;Dah;ssp;Dah;ssp;Dah];&lt;br /&gt;
 &lt;br /&gt;
text = upper(text);&lt;br /&gt;
vars ={&amp;#039;period&amp;#039;,&amp;#039;comma&amp;#039;,&amp;#039;question&amp;#039;,&amp;#039;slash_&amp;#039;};&lt;br /&gt;
morsecode=[];&lt;br /&gt;
for i=1:length(text)&lt;br /&gt;
    if isvarname(text(i))&lt;br /&gt;
    morsecode = [morsecode;eval(text(i))];&lt;br /&gt;
    elseif ismember(text(i),&amp;#039;.,?/&amp;#039;)&lt;br /&gt;
        x = findstr(text(i),&amp;#039;.,?/&amp;#039;);&lt;br /&gt;
        morsecode = [morsecode;eval(vars{x})];&lt;br /&gt;
    elseif ~isempty(str2num(text(i)))&lt;br /&gt;
        morsecode = [morsecode;eval([&amp;#039;n&amp;#039; text(i)])];&lt;br /&gt;
    elseif text(i)==&amp;#039; &amp;#039;&lt;br /&gt;
        morsecode = [morsecode;ssp;ssp;ssp];&lt;br /&gt;
    end&lt;br /&gt;
    morsecode = [morsecode;lsp];&lt;br /&gt;
end&lt;br /&gt;
if exist(&amp;#039;file&amp;#039;,&amp;#039;var&amp;#039;)&lt;br /&gt;
    wavwrite(morsecode,11025,16,file);&lt;br /&gt;
else&lt;br /&gt;
    wavplay(morsecode);&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the license that comes with the file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Copyright (c) 2009, Fahad Al Mahmood&lt;br /&gt;
All rights reserved.&lt;br /&gt;
&lt;br /&gt;
Redistribution and use in source and binary forms, with or without&lt;br /&gt;
modification, are permitted provided that the following conditions are&lt;br /&gt;
met:&lt;br /&gt;
&lt;br /&gt;
    * Redistributions of source code must retain the above copyright&lt;br /&gt;
      notice, this list of conditions and the following disclaimer.&lt;br /&gt;
    * Redistributions in binary form must reproduce the above copyright&lt;br /&gt;
      notice, this list of conditions and the following disclaimer in&lt;br /&gt;
      the documentation and/or other materials provided with the distribution&lt;br /&gt;
     &lt;br /&gt;
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &amp;quot;AS IS&amp;quot;&lt;br /&gt;
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&lt;br /&gt;
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE&lt;br /&gt;
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE&lt;br /&gt;
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR&lt;br /&gt;
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF&lt;br /&gt;
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS&lt;br /&gt;
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN&lt;br /&gt;
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)&lt;br /&gt;
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE&lt;br /&gt;
POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Codlor</name></author>
	</entry>
</feed>