Sign in to follow this  
Followers 0
Lakes

Speech Toy

7 posts in this topic

This works (wouter`s code)

Local $o_speech = ObjCreate ("SAPI.SpVoice")

For $i = 0 To $o_speech.GetVoices().Count() - 1
    
    $voice = $o_speech.GetVoices().Item($i)
    
    $o_speech.Voice = $voice

    $o_speech.Speak ('I am a ' & $voice.GetAttribute("Gender") & ' and my name is ' & $voice.GetAttribute("Name") & '. <rate speed="6">I can talk really fast</rate> <rate speed="-9">but also very slowly</rate>. By the way, i <pitch middle="50">can also talk high</pitch> <pitch middle="-50">and talk low.</pitch> Cool.', 8)

NextoÝ÷ ح§"Úò¶§r[yªbµÈ¢{k¢X§)Þ×+jÈ^±«­¢+Ø9½QÉå%½¸(¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì)¥´ÀÌØíÙ½¥ô=©
ÉÑ ÅÕ½ÐíMÁ¤¹MÁY½¥ÅÕ½Ðì¤(ÀÌØíÉɽÈô=©Ù¹Ð ÅÕ½ÐíÕѽ%йÉɽÈÅÕ½Ðì°ÅÕ½ÐíÉÉÕ¹ÅÕ½Ðì¤((ìôôU$¹ÉÑÝ¥Ñ -½ôô¤ì(ÀÌØíMÁ¡Q½äôU%
ÉÑ ÅÕ½ÐíMÁ¡Q½äÅÕ½Ðì°ÐÄÌ°ÈÔÈ°ÄàÜ°ÈÈÀ¤(ÀÌØíÑáÐôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐíQáÐѼMÁ ÅÕ½Ðì°à°à°ÌÈä°ÈÄ°ÀÌØí]M}I=U@°ÀÌØí]M}a}
1%9Q¤(ÀÌØíMÁ¬ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMÁ¬ÅÕ½Ðì°ÌÐаà°ÔÜ°ÐÔ¤(ÀÌØíÁ¥Ñ ôU%
Ñɱ
ÉÑM±¥È à°àÀ°ÈØÔ°ÌÀ°    ¥Ñ=H ÀÌØíQ    M}Q=@°ÀÌØíQ    M}1P°ÀÌØí]M}I=U@¤¤)U%
Ñɱ
ÉÑ1° ÅÕ½ÐíA¥Ñ ÅÕ½Ðì°à°ØаÌà°ÈÀ°ÀÌØí]M}I=U@¤)U%
ÑɱMѽ¹Ð ´Ä°ÄÀ°àÀÀ°À°ÅÕ½Ðí5LM¹ÌMÉ¥ÅÕ½Ðì¤)U%
Ñɱ
ÉÑ1° ÅÕ½ÐíY½±ÕµÅÕ½Ðì°à°ÄÜØ°ÔØ°ÈÀ°ÀÌØí]M}I=U@¤)U%
ÑɱMѽ¹Ð ´Ä°ÄÀ°àÀÀ°À°ÅÕ½Ðí5LM¹ÌMÉ¥ÅÕ½Ðì¤)U%
Ñɱ
ÉÑ1° ÅÕ½ÐíIÑÅÕ½Ðì°à°ÄÈÀ°ÌÜ°ÈÀ°ÀÌØí]M}I=U@¤)U%
ÑɱMѽ¹Ð ´Ä°ÄÀ°àÀÀ°À°ÅÕ½Ðí5LM¹ÌMÉ¥ÅÕ½Ðì¤((ÀÌØíÉÑôU%
Ñɱ
ÉÑM±¥È à°ÄÌØ°ÈØÔ°ÌÀ°  ¥Ñ=H ÀÌØíQ    M}Q=@°ÀÌØíQ    M}1P°ÀÌØí]M}I=U@¤¤)U%
ÑɱMÑ1¥µ¥Ð ÀÌØíÉÑ°ÔÀ°´ÔÀ¤)U%
ÑɱMÑÑ ÀÌØíÉÑ°À¤((ÀÌØíÙ½°ôU%
Ñɱ
ÉÑM±¥È à°ÄäÈ°ÈØÔ°ÌÀ°  ¥Ñ=H ÀÌØíQ    M}Q=@°ÀÌØíQ    M}1P°ÀÌØí]M}I=U@¤¤)U%
ÑɱMÑ1¥µ¥Ð ÀÌØíÙ½°°ÄÀÀ°Ä¤)U%
ÑɱMÑÑ ÀÌØíÙ½°°ÄÀÀ¤(ÀÌØíY½°ÄôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°Èàà°ÈÀÀ°Ðä°ÈÄ°ÀÌØí]M}I=U@°ÀÌØí]M}a}
1%9Q¤(ÀÌØíIÑÄôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°Èàà°ÄÐаÐä°ÈÄ°ÀÌØí]M}I=U@°ÀÌØí]M}a}
1%9Q¤(ÀÌØíA¥Ñ ÄôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°Èàà°àà°Ðä°ÈÄ°ÀÌØí]M}I=U@°ÀÌØí]M}a}
1%9Q¤)U%MÑMÑÑ¡M]}M!=¤()]¡¥±Ä($ÀÌØíIÑIôU%
ÑɱI ÀÌØíÉѤ¼ÄÀ(%U%
ÑɱMÑÑ ÀÌØíÉÑÄ°ÀÌØíIÑI¤($($ÀÌØíY½±IôU%
ÑɱI ÀÌØíÙ½°¤(%U%
ÑɱMÑÑ ÀÌØíY½°Ä°ÀÌØíY½±I¤($($ÀÌØíA¥Ñ¡IôU%
ÑɱI ÀÌØíÁ¥Ñ ¤(%U%
ÑɱMÑÑ ÀÌØíA¥Ñ Ä°ÀÌØíA¥Ñ¡I¤$($(MÝ¥Ñ U%Ñ5Í ¤(
ÍÀÌØíU%}Y9Q}
1=M(á¥Ð(
ÍÀÌØíMÁ¬(MÁ¬¡U%
ÑɱI ÀÌØíÑáФ°ÀÌØíIÑI°ÀÌØíY½±I°ÀÌØíA¥Ñ¡I¤(¹MÝ¥Ñ )]¹()Õ¹MÁ¬ ÀÌØíÑáаÀÌØíÉÑôÄ°ÀÌØíY½°ôÄÀÀ°ÀÌØíÁ¥Ñ ôÔÀ¤(ÀÌØíÙ½¥¹IÑôÀÌØíÉÑ(%ÉɽÈQ¡¸IÑÕɸ(ÀÌØíÙ½¥¹Y½±ÕµôÀÌØíY½°(%ÉɽÈQ¡¸IÑÕɸ($ìÀÌØíÙ½¥¹A¥Ñ ôÀÌØíÁ¥Ñ Q¡¥Ì¥ÙÌÉɽȴ$èôôÐìQ¡ÉÅÕÍÑÑ¥½¸Ý¥Ñ Ñ¡¥Ì½©Ð¡Ì¥±¸è(í%ÉɽÈQ¡¸IÑÕɸ$(1½°ÀÌØíÑ}Ù½¥ôÀÌØíÙ½¥¹ÑY½¥Ì ÅÕ½Ðí9µõ5¥É½Í½ÐM´ÅÕ½Ðì°ÅÕ½Ðí1¹ÕôÐÀäÅÕ½Ð줹%Ñ´ À¤(%ÉɽÈQ¡¸IÑÕɸ(ÀÌØíÙ½¥¹Y½¥ôÀÌØíÑ}Ù½¥(%9½ÐÉɽÈQ¡¸ÀÌØíÙ½¥¹MÁ¬ ÀÌØíÑáФ)¹Õ¹ìôôÐíMÁ¬

So, what is the format to alter the pitch this way?

Thanks!


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites



I thought I would try to approach this another way, by putting the pitch variable into the string, so that this:

$Text = '<pitch middle="50">can also talk high</pitch>'oÝ÷ Ù·¢g¬²¶§X¤zØb±«­¢+ØÀÌØíQáÐôÅÕ½Ðì±ÐíÁ¥Ñ µ¥±ôÅÕ½ÐìµÀìÌäìÅÕ½ÐìÀÌØíÁ¥ÐÅÕ½ÐìÌäìµÀìÌäìÐìÌäìµÀìÀÌØíÑáеÀìÅÕ½Ðì±Ðì½Á¥Ñ ÐìÅÕ½Ðì

But I can`t work the right way to do it... ;)

Thanks as always.


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

I thought I would try to approach this another way, by putting the pitch variable into the string, so that this:

$Text = '<pitch middle="50">can also talk high</pitch>'oÝ÷ Ù·¢g¬²¶§X¤zØb±«­¢+ØÀÌØíQáÐôÅÕ½Ðì±ÐíÁ¥Ñ µ¥±ôÅÕ½ÐìµÀìÌäìÅÕ½ÐìÀÌØíÁ¥ÐÅÕ½ÐìÌäìµÀìÌäìÐìÌäìµÀìÀÌØíÑáеÀìÅÕ½Ðì±Ðì½Á¥Ñ ÐìÅÕ½ÐìoÝ÷ Ø­!Ƨ÷«p¢¹-êâpk+hv­N§Æ¬jÊÏêº^«¨µÉnLªºpk*v§ØbºØ­Â䱫­¢+Øì9½QÉå%½¸(¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì(ÀÌØíÙ½¥ô=©
ÉÑ ÅÕ½ÐíMÁ¤¹MÁY½¥ÅÕ½Ðì¤(ÀÌØíAMÑÉ¥¹ôÅÕ½ÐìÌäì´ÄÀÌäìÐì°Ìäì´ÈÀÌäìÐì°Ìäì´ÌÀÌäìÐì°Ìäì´ÐÀÌäìÐì°Ìäì´ÔÀÌäìÐì°ÌäìÀÌäìÐì°ÌäìÄÀÌäìÐì°ÌäìÈÀÌäìÐì°ÌäìÌÀÌäìÐì°ÌäìÐÀÌäìÐì°ÌäìÔÀÌäìÐìÅÕ½Ðì(ÀÌØíAMÑÉ¥¹ôMÑÉ¥¹MÁ±¥Ð ÀÌØíAMÑÉ¥¹°ÅÕ½Ðì°ÅÕ½Ðì¤(($ÀÌØíA¥Ñ¡IMÑÈôÅÕ½ÐìÀÅÕ½Ðì($ÀÌØíA¥Ñ¡IQMÐôÅÕ½Ðì±ÐíÁ¥Ñ µ¥±ôÅÕ½Ðì$($ÀÌØí
±ÍQôÅÕ½ÐìÐìÅÕ½Ðì($ÀÌØíÑáÐôÅÕ½Ðì$¸±Í¼Ñ±¬¡¥ ÅÕ½Ðì$($ÀÌØíA¥Ñ¡IQ¹ôÅÕ½Ðì±Ðì½Á¥Ñ ÐìÅÕ½Ðì((ìôôU$¹ÉÑÝ¥Ñ -½ôô¤ì(ÀÌØíMÁ¡Q½äôU%
ÉÑ ÅÕ½ÐíMÁ¡Q½äÅÕ½Ðì°ÐÄÌ°ÈÔÈ°ÄàÜ°ÈÈÀ¤(ÀÌØíÑáÐôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐíQáÐѼMÁ ÅÕ½Ðì°à°à°ÌÈä°ÈÄ°ÀÌØí]M}I=U@°ÀÌØí]M}a}
1%9Q¤(ÀÌØíÍÁ¬ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMÁ¬ÅÕ½Ðì°ÌÐаà°ÔÜ°ÐÔ¤(()U%
Ñɱ
ÉÑ1° ÅÕ½ÐíA¥Ñ ÅÕ½Ðì°à°ØаÌà°ÈÀ°ÀÌØí]M}I=U@¤)U%
ÑɱMѽ¹Ð ´Ä°ÄÀ°àÀÀ°À°ÅÕ½Ðí5LM¹ÌMÉ¥ÅÕ½Ðì¤)U%
Ñɱ
ÉÑ1° ÅÕ½ÐíY½±ÕµÅÕ½Ðì°à°ÄÜØ°ÔØ°ÈÀ°ÀÌØí]M}I=U@¤)U%
ÑɱMѽ¹Ð ´Ä°ÄÀ°àÀÀ°À°ÅÕ½Ðí5LM¹ÌMÉ¥ÅÕ½Ðì¤)U%
Ñɱ
ÉÑ1° ÅÕ½ÐíIÑÅÕ½Ðì°à°ÄÈÀ°ÌÜ°ÈÀ°ÀÌØí]M}I=U@¤)U%
ÑɱMѽ¹Ð ´Ä°ÄÀ°àÀÀ°À°ÅÕ½Ðí5LM¹ÌMÉ¥ÅÕ½Ðì¤((ÀÌØíÉÑôU%
Ñɱ
ÉÑM±¥È à°ÄÌØ°ÈØÔ°ÌÀ°  ¥Ñ=H ÀÌØíQ    M}Q=@°ÀÌØíQ    M}1P°ÀÌØí]M}I=U@¤¤)U%
ÑɱMÑ1¥µ¥Ð ÀÌØíÉÑ°ÔÀ°´ÔÀ¤)U%
ÑɱMÑÑ ÀÌØíÉÑ°À¤((ÀÌØíÙ½°ôU%
Ñɱ
ÉÑM±¥È à°ÄäÈ°ÈØÔ°ÌÀ°  ¥Ñ=H ÀÌØíQ    M}Q=@°ÀÌØíQ    M}1P°ÀÌØí]M}I=U@¤¤)U%
ÑɱMÑ1¥µ¥Ð ÀÌØíÙ½°°ÄÀÀ°Ä¤)U%
ÑɱMÑÑ ÀÌØíÙ½°°ÄÀÀ¤((ÀÌØíA¥Ñ ôU%
Ñɱ
ÉÑM±¥È à°àÀ°ÈØÔ°ÌÀ°    ¥Ñ=H ÀÌØíQ    M}Q=@°ÀÌØíQ    M}1P°ÀÌØí]M}I=U@¤¤)U%
ÑɱMÑ1¥µ¥Ð ÀÌØíA¥Ñ °Ô°´Ô¤)U%
ÑɱMÑÑ ÀÌØíA¥Ñ °À¤((ÀÌØíY½°ÄôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°Èàà°ÈÀÀ°Ðä°ÈÄ°ÀÌØí]M}I=U@°ÀÌØí]M}a}
1%9Q¤(ÀÌØíIÑÄôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°Èàà°ÄÐаÐä°ÈÄ°ÀÌØí]M}I=U@°ÀÌØí]M}a}
1%9Q¤(ÀÌØíA¥Ñ¡%¸ôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°Èàà°àà°Ðä°ÈÄ°ÀÌØí]M}I=U@°ÀÌØí]M}a}
1%9Q¤)U%MÑMÑÑ¡M]}M!=¤()]¡¥±Ä($ÀÌØíQáÑIôU%
ÑɱI ÀÌØíÑáФ($($ÀÌØíIÑIôU%
ÑɱI ÀÌØíÉѤ¼ÄÀ(%U%
ÑɱMÑÑ ÀÌØíÉÑÄ°ÀÌØíIÑI¤($($ÀÌØíY½±IôU%
ÑɱI ÀÌØíÙ½°¤(%U%
ÑɱMÑÑ ÀÌØíY½°Ä°ÀÌØíY½±I¤($($ÀÌØíA¥Ñ¡IôU%
ÑɱI ÀÌØíA¥Ñ ¤(%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤($)M±Ð(%ÍÀÌØíA¥Ñ¡Iô´Ä($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÅt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤(%ÍÀÌØíA¥Ñ¡Iô´È($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÉt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤(%ÍÀÌØíA¥Ñ¡Iô´Ì($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÍt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤(%ÍÀÌØíA¥Ñ¡Iô´Ð($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÑt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤(%ÍÀÌØíA¥Ñ¡Iô´Ô($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÕt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤(%ÍÀÌØíA¥Ñ¡IôÀ($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÙt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤(%ÍÀÌØíA¥Ñ¡IôÄ($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÝt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤(%ÍÀÌØíA¥Ñ¡IôÈ($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lát($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤$(%ÍÀÌØíA¥Ñ¡IôÌ($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹låt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤(%ÍÀÌØíA¥Ñ¡IôÐ($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÄÁt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤$(%ÍÀÌØíA¥Ñ¡IôÔ($$ÀÌØíA¥ÑIMÑÈôÀÌØíAMÑÉ¥¹lÄÅt($%U%
ÑɱMÑÑ ÀÌØíA¥Ñ¡%¸°ÀÌØíA¥Ñ¡I¤)¹M±Ð(ÀÌØíµÍôU%Ñ5Í ¤)M±Ð(%
ÍÀÌØíµÍôÀÌØíÍÁ¬(MÁ¬ ÀÌØíQáÑI°ÀÌØíIÑI°ÀÌØíY½±I¤$(%
ÍÀÌØíµÍôÀÌØíU%}Y9Q}
1=M(á¥Ð$)¹M±Ð$$()]¹$()Õ¹MÁ¬ ÀÌØíÑáаÀÌØíÉÑôÄ°ÀÌØíY½°ôÄÀÀ¤(ÀÌØíÙ½¥¹IÑôÀÌØíÉÑ(%ÉɽÈQ¡¸IÑÕɸ(ÀÌØíÙ½¥¹Y½±ÕµôÀÌØíY½°(%ÉɽÈQ¡¸IÑÕɸ($ìÀÌØíÙ½¥¹A¥Ñ ôÀíQ¡¥Ì¥ÙÌÉɽȴ$èôôÐìQ¡ÉÅÕÍÑÑ¥½¸Ý¥Ñ Ñ¡¥Ì½©Ð¡Ì¥±¸è(í%ÉɽÈQ¡¸IÑÕɸ$(1½°ÀÌØíÑ}Ù½¥ôÀÌØíÙ½¥¹ÑY½¥Ì ÅÕ½Ðí9µõ5¥É½Í½ÐM´ÅÕ½Ðì°ÅÕ½Ðí1¹ÕôÐÀäÅÕ½Ð줹%Ñ´ À¤(%ÉɽÈQ¡¸IÑÕɸ(ÀÌØíÙ½¥¹Y½¥ôÀÌØíÑ}Ù½¥($ÀÌØíMÁ­QáÐôÀÌØíA¥Ñ¡IQMеÀìÀÌØíA¥ÑIMÑȵÀìÀÌØíÑáеÀìÀÌØíA¥Ñ¡IQ¹(%%9½ÐÉɽÈQ¡¸ÀÌØíÙ½¥¹MÁ¬ ÀÌØíMÁ­Qáаà¤)¹Õ¹ìôôÐíMÁ¬

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

the proper way to format the line you showed is this

$Text = '<pitch middle="'&$pit&'">' &$text &"</pitch>"

;)

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

the proper way to format the line you showed is this

$Text = '<pitch middle="'&$pit&'">' &$text &"</pitch>"

;)

Thanks, I`ll try this tommorow :lmao:

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Thanks to theGuy0000 posting, this is a much neater way of doing things.. ;)

;#NoTrayIcon
#include <GUIConstants.au3>
$voice = ObjCreate("Sapi.SpVoice")

; == GUI generated with Koda ==);
$SpeechToy = GUICreate("SpeechToy", 413, 252, 187, 220)
$SpkText = "Welcome to the Text to Speech Toy, you can alter the Pitch, rate, and Volume by adjusting the relative sliders here."
$Text = GUICtrlCreateEdit($SpkText, 16, 8, 313, 49, $WS_GROUP, $WS_EX_CLIENTEDGE)
$speak = GUICtrlCreateButton("Speak", 344, 8, 57, 45)

GUICtrlCreateLabel("Pitch", 8, 64, 38, 20, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Volume", 8, 176, 56, 20, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Rate", 8, 120, 37, 20, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

$rate = GUICtrlCreateSlider(8, 136, 265, 30, BitOR($TBS_TOP,$TBS_LEFT,$WS_GROUP))
GUICtrlSetLimit($rate, 50, -50)
GUICtrlSetData($rate, 0)

$vol = GUICtrlCreateSlider(8, 192, 265, 30, BitOR($TBS_TOP,$TBS_LEFT,$WS_GROUP))
GUICtrlSetLimit($vol, 100, 1)
GUICtrlSetData($vol, 50)

$Pitch = GUICtrlCreateSlider(8, 80, 265, 30, BitOR($TBS_TOP,$TBS_LEFT,$WS_GROUP))
GUICtrlSetLimit($Pitch, 50, -50)
GUICtrlSetData($Pitch, 0)

$Vol1 = GUICtrlCreateInput("", 288, 200, 49, 21, $WS_GROUP, $WS_EX_CLIENTEDGE)
$Rate1 = GUICtrlCreateInput("", 288, 144, 49, 21, $WS_GROUP, $WS_EX_CLIENTEDGE)
$PitchIn = GUICtrlCreateInput("", 288, 88, 49, 21, $WS_GROUP, $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)

While 1
    $TextRead = GUICtrlRead($text)
    
    $RateRead = GUICtrlRead($rate) / 10
    GUICtrlSetData($rate1, $RateRead)
    
    $VolRead = GUICtrlRead($vol)
    GUICtrlSetData($Vol1,$VolRead)
    
    $PitchRead = GUICtrlRead($Pitch)
    GUICtrlSetData($PitchIn,$PitchRead)
    
$msg = GUIGetMsg()
Select
    Case $msg = $speak
         Speak($TextRead, $RateRead, $VolRead)  
    Case $msg = $GUI_EVENT_CLOSE
         Exit   
EndSelect        

WEnd     

Func Speak($text, $rate = 1, $Vol = 100 )
    $voice.Rate = $rate
    If @error Then Return
    $voice.Volume = $Vol
    If @error Then Return
    ;$voice.Pitch = 0  ;This gives error -  : ==> The requested action with this object has failed.:
    ;If @error Then Return  
    Local $t_voice = $voice.GetVoices ("Name=Microsoft Sam", "Language=409").Item (0)
    If @error Then Return
    $voice.Voice = $t_voice
    $SpkText = '<pitch middle="'&$PitchRead&'">' &$text &"</pitch>"
    If Not @error Then $voice.Speak ($SpkText,8)
EndFunc ;==>Speak

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Thanks to theGuy0000 posting, this is a much neater way of doing things.. ;)

CODE
;#NoTrayIcon
#include <GUIConstants.au3>
$voice = ObjCreate("Sapi.SpVoice")

; == GUI generated with Koda ==);
$SpeechToy = GUICreate("SpeechToy", 413, 252, 187, 220)
$SpkText = "Welcome to the Text to Speech Toy, you can alter the Pitch, rate, and Volume by adjusting the relative sliders here."
$Text = GUICtrlCreateEdit($SpkText, 16, 8, 313, 49, $WS_GROUP, $WS_EX_CLIENTEDGE)
$speak = GUICtrlCreateButton("Speak", 344, 8, 57, 45)

GUICtrlCreateLabel("Pitch", 8, 64, 38, 20, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Volume", 8, 176, 56, 20, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Rate", 8, 120, 37, 20, $WS_GROUP)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

$rate = GUICtrlCreateSlider(8, 136, 265, 30, BitOR($TBS_TOP,$TBS_LEFT,$WS_GROUP))
GUICtrlSetLimit($rate, 50, -50)
GUICtrlSetData($rate, 0)

$vol = GUICtrlCreateSlider(8, 192, 265, 30, BitOR($TBS_TOP,$TBS_LEFT,$WS_GROUP))
GUICtrlSetLimit($vol, 100, 1)
GUICtrlSetData($vol, 50)

$Pitch = GUICtrlCreateSlider(8, 80, 265, 30, BitOR($TBS_TOP,$TBS_LEFT,$WS_GROUP))
GUICtrlSetLimit($Pitch, 50, -50)
GUICtrlSetData($Pitch, 0)

$Vol1 = GUICtrlCreateInput("", 288, 200, 49, 21, $WS_GROUP, $WS_EX_CLIENTEDGE)
$Rate1 = GUICtrlCreateInput("", 288, 144, 49, 21, $WS_GROUP, $WS_EX_CLIENTEDGE)
$PitchIn = GUICtrlCreateInput("", 288, 88, 49, 21, $WS_GROUP, $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)

While 1
    $TextRead = GUICtrlRead($text)
    
    $RateRead = GUICtrlRead($rate) / 10
    GUICtrlSetData($rate1, $RateRead)
    
    $VolRead = GUICtrlRead($vol)
    GUICtrlSetData($Vol1,$VolRead)
    
    $PitchRead = GUICtrlRead($Pitch)
    GUICtrlSetData($PitchIn,$PitchRead)
    
$msg = GUIGetMsg()
Select
    Case $msg = $speak
         Speak($TextRead, $RateRead, $VolRead)  
    Case $msg = $GUI_EVENT_CLOSE
         Exit   
EndSelect        

WEnd     

Func Speak($text, $rate = 1, $Vol = 100 )
    $voice.Rate = $rate
    If @error Then Return
    $voice.Volume = $Vol
    If @error Then Return
    ;$voice.Pitch = 0  ;This gives error -  : ==> The requested action with this object has failed.:
    ;If @error Then Return  
    Local $t_voice = $voice.GetVoices ("Name=Microsoft Sam", "Language=409").Item (0)
    If @error Then Return
    $voice.Voice = $t_voice
    $SpkText = '<pitch middle="'&$PitchRead&'">' &$text &"</pitch>"
    If Not @error Then $voice.Speak ($SpkText,8)
EndFunc ;==>Speak
you're welcome :lmao::evil:

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0