Revision as of 22:34, 23 April 2017 by Sgarvis (Talk | contribs)

%% Information % Here is the text2speech program for Sam Garvis, this program will only % work with a folder of wav files for text2speech use. It can be edited % (via wav files) to add more sounds and or edit current sounds.

% added length to certain files in order for them to be picked up % by audio converter

%% Sites used

% http://www.auburn.edu/academic/education/reading_genie/spellings.html

% https://online-voice-recorder.com/

% http://online-audio-converter.com/

% https://www.mathworks.com/help/matlab/ref/audioread.html

% https://www.mathworks.com/help/matlab/ref/dir.html

% https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html

% https://www.mathworks.com/help/matlab/ref/fileparts.html

% https://www.mathworks.com/help/matlab/ref/genvarname.html

%% Loading data from folder clear,clc % clear space

fs = 44100; % frequency

phonems = dir('*.wav');  % checks current directory for .wav files numfiles = length(phonems); % finds number of wav files

% converts each wav file into its coresponding variable with name for i = 1:numfiles

   titles = phonems(i,1).name;
   [~,sound_name,ext] = fileparts(titles);
   eval([sound_name '= audioread(phonems(i,1).name);']);   

end

%input section input_phonems = ['Input the word you want in the form\n of the phonems shown'...

   'as wav files with\n 1 space inbetween each phonem\n'];

% text = input(input_phonems,'s');

text = 'ha eh ll O wu er ll du th ii ss wu aa eh zz du nn bu I ss aa mm gu ar vv ii ss'; % this is hear for the example

parts = strsplit(text); % splits text into readable parts

speech = []; % creates speech bracket space

% adds on to previous speech in order to make the speech for j = 1:length(parts)

   eval(['section = ',char(parts(j)),';']); % evaluates each section and returns the double struct
   speech = [speech; section];   

end

sound(speech,fs) % plays text plot(speech) title('Speech') xlabel('time (s)') ylabel('Amplitude') % example: ha eh ll O wu er ll du - hello world

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang