(Creation of Sam Garvis text2speech program) |
m (added extra info and minor touchups) |
||
Line 3: | Line 3: | ||
% work with a folder of wav files for text2speech use. It can be edited | % 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. | % (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 | %% Sites used | ||
Line 33: | Line 36: | ||
titles = phonems(i,1).name; | titles = phonems(i,1).name; | ||
[~,sound_name,ext] = fileparts(titles); | [~,sound_name,ext] = fileparts(titles); | ||
− | eval([sound_name '= audioread(phonems(i,1).name);']); | + | eval([sound_name '= audioread(phonems(i,1).name);']); |
− | + | ||
end | end | ||
Revision as of 22:08, 23 April 2017
%% 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
fs = 44100;
phonems = dir('*.wav'); numfiles = length(phonems);
for i = 1:numfiles
titles = phonems(i,1).name; [~,sound_name,ext] = fileparts(titles); eval([sound_name '= audioread(phonems(i,1).name);']);
end
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'); parts = strsplit(text); % splits text into readable parts 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