文字转语音的问题-更改暴力 [英] Problem with text to speech - changing vioces

查看:62
本文介绍了文字转语音的问题-更改暴力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名作家,并且更新了我几年前使用vb6.0与vb 2013一起运行的应用程序,该应用程序读取文本文件以帮助校对我的作品.该应用程序应该按照语音指示器"指示更改声音.但是, 不.这曾经在vb6.0中完美地工作过.下面是执行语音更改和阅读/朗读的代码.对于在Visual Basic 2013中如何使该应用程序正常运行的任何建议,我将不胜感激.

 

子read_chapter()             

     text_file =""       

     mainform.OpenFileDialog1.FileName =没什么      

     mainform.OpenFileDialog1.InitialDirectory = target_dir      

     mainform.OpenFileDialog1.DefaultExt =".txt"       

     mainform.OpenFileDialog1.Title =选择要读取的文件";       

     mainform.OpenFileDialog1.ShowDialog()      

     text_file = mainform.OpenFileDialog1.FileName '获取源文本      

    选择案例text_file          

                       情况为"="                             

               b msg_text =读取章节进程已取消";                             

退出子      

结束选择

      chapter_name = Path.GetFileName(text_file)  '设置要转换的文本文件名      

     昏暗的objReader = My.Computer.FileSystem.OpenTextFileReader(text_file)

     不要做objReader.EndOfStream         

            stringReader = objReader.ReadLine          

            Dim Char_one = Mid $(stringReader,1,1)

            Dim seprater As String = InStr(stringReader,``/'')          

           昏暗的eov_seprater作为字符串= InStr(stringReader,>")

           选择Case Char_one              

情况为=<".                    

voice_nbr = Val(Mid $(stringReader,2,seprater-1))   

talking_speed = Val(Mid $(stringReader,seprater + 1,eov_seprater-1))          b    

strVoice = voice_tbl(voice_nbr)

案例其他              

               b text_to_speak = stringReader              b

               b p_objSynth.Rate = talking_speed'.ToString            b

               b p_objSynth.SelectVoice(strVoice)            b

               b p_objSynth.SpeakAsync(text_to_speak)          

结束选择      

         循环   

结束子

 

解决方案

也许它曾经在安装了多种声音的OS的VB6中完美运行.但是我怀疑它会在目前操作系统上的VB6中完美无瑕地改变声音.由于vb6应用程序可以在Win 7和Win 8上运行.

您应该查看您的操作系统是否安装了多种声音.我的不是. Windows 7 64位家庭版.微软也没有为此提供更多的声音.只有第三方的其他声音可用.


I am a would be writer and have UPDATED an app I wrote years ago using vb6.0 to run with vb 2013 that reads text files to help with proofreading my work.  The app is supposed to change voices as indicated by 'voice indicators'   However, it doesn't.  This used to work flawlessly in vb6.0. The code that performs the voice change and read/speak is below.  I would appreciate any suggestions as to how to make this would app work in visual basic 2013.

 

Sub read_chapter()                

      text_file = ""        

      mainform.OpenFileDialog1.FileName = Nothing        

      mainform.OpenFileDialog1.InitialDirectory = target_dir        

      mainform.OpenFileDialog1.DefaultExt = ".txt"        

      mainform.OpenFileDialog1.Title = "Select file to be read"        

      mainform.OpenFileDialog1.ShowDialog()        

      text_file = mainform.OpenFileDialog1.FileName   'gets the source text        

      Select Case text_file            

               Case Is = ""                

                      msg_text = "Read Chapter Process cancelled"                

                     Exit Sub        

              End Select        

       chapter_name = Path.GetFileName(text_file)  'sets the text file name to be converted        

       Dim objReader = My.Computer.FileSystem.OpenTextFileReader(text_file)        

       Do While Not objReader.EndOfStream            

             stringReader = objReader.ReadLine            

             Dim Char_one = Mid$(stringReader, 1, 1)            

             Dim seprater As String = InStr(stringReader, "/")            

             Dim eov_seprater As String = InStr(stringReader, ">")            

             Select Case Char_one                

                       Case Is = "<"                    

                       voice_nbr = Val(Mid$(stringReader, 2, seprater - 1))                    

                       talking_speed = Val(Mid$(stringReader, seprater + 1, eov_seprater - 1))                    

                       strVoice = voice_tbl(voice_nbr)                

              Case Else                    

                      text_to_speak = stringReader                    

                      p_objSynth.Rate = talking_speed '.ToString                    

                      p_objSynth.SelectVoice(strVoice)                    

                      p_objSynth.SpeakAsync(text_to_speak)            

              End Select        

           Loop    

End Sub

 

解决方案

Maybe it used to work flawlessly in VB6 on an OS that had multiple voices installed. But I doubt it would run in VB6 on a current OS with regard to flawlessly changing voices. As vb6 apps can supposedly run on Win 7 and Win 8.

You should see if your OS has mutliple voices installed. Mine does not. Window 7 64bit home edition. Nor does Microsoft provide more voices for it. Only 3rd party additional voices are available.


这篇关于文字转语音的问题-更改暴力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆