⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ttsnumbers.asv

📁 Numerical Text to Speech Synthesis
💻 ASV
字号:
%Created by Sevakula Rahul Kumar (5464) - 3/4 Btech E.C.E.

y1 = wavread('one'); y2 = wavread('two'); y3 = wavread('three'); y4 = wavread('four'); y5 = wavread('five');
y6 = wavread('six'); y7 = wavread('seven'); y8 = wavread('eight'); y9 = wavread('nine'); y10 = wavread('ten');
y11 = wavread('eleven'); y12 = wavread('twelve'); y13 = wavread('thirteen'); y14 = wavread('fourteen');
y15 = wavread('fifteen'); y16 = wavread('sixteen'); y17 = wavread('seventeen'); y18 = wavread('eighteen'); 
y19 = wavread('nineteen'); y20 = wavread('twenty'); y30 = wavread('thirty'); y40 = wavread('forty');
y50 = wavread('fifty'); y60 = wavread('sixty'); y70 = wavread('seventy'); y80 = wavread('eighty'); 
y90 = wavread('ninty'); y100 = wavread('hundred'); y1000 = wavread('thousand'); y0 = wavread('zero');

lex = {'1';'2';'3';'4';'5';'6';'7';'8';'9';'0','.'}; 
sen = input('Please give a number to be synthesised into speech : ','s');
Fs = 22050;
len = length(sen); %n-words-in-sentence gets the length of the string.
pt = zeros(1,len);
count = 0;

for i = 1:len
    if (sen(i) = '.')
        break;
    else
        count = count + 1;
end loop;
   
x = [0];
for i=1:len
   pt(i) = strmatch(sen(i),lex(:,1),'exact');
 
   if (i == len-1 && pt(i) == 1) 
      pt(i+1) = strmatch(sen(i+1),lex(:,1),'exact');
      switch pt(i+1)
      case 1
         x = cat(1,x,y11);
      case 2
         x = cat(1,x,y12);
      case 3
         x = cat(1,x,y13);
      case 4
         x = cat(1,x,y14);
      case 5
         x = cat(1,x,y15);
      case 6
         x = cat(1,x,y16);
      case 7
         x = cat(1,x,y17);
      case 8
         x = cat(1,x,y18);
      case 9
         x = cat(1,x,y19);
      case 10
         x = cat(1,x,y10);
      end%end for switch
      break;
      
   elseif (i == len-1)
      switch pt(i)
      case 2
         x = cat(1,x,y20);
      case 3
         x = cat(1,x,y30);
      case 4
         x = cat(1,x,y40);
      case 5
         x = cat(1,x,y50);
      case 6
         x = cat(1,x,y60);
      case 7
         x = cat(1,x,y70);
      case 8
         x = cat(1,x,y80);
      case 9
         x = cat(1,x,y90);    
      end;
  
   else
      switch pt(i)
      case 1
         x = cat(1,x,y1);
      case 2
         x = cat(1,x,y2);
      case 3
         x = cat(1,x,y3);
      case 4
         x = cat(1,x,y4);
      case 5
         x = cat(1,x,y5);
      case 6
         x = cat(1,x,y6);
      case 7
         x = cat(1,x,y7);
      case 8
         x = cat(1,x,y8);
      case 9
         x = cat(1,x,y9);
      case 10
          if (len == 1) 
              x = cat(1,x,y0);
          end;
                  
    end%end for switch
   end; 
  if (i == len-2 && pt(i) ~= 10) x = cat(1,x,y100); end;
  if (i == len-3 && pt(i) ~= 10) x = cat(1,x,y1000); end;
end;%end for for

wavwrite(x,Fs,'output');
plot(x)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -