Page 1 of 1

Spoken Rubbish

Posted: Mon Oct 19, 2026 5:45 pm
by Henko
flag=0
if flag then ! list voices ! stop ! end if
randomize
k$="aeiouy" ! m$="bcdfghjklmnprstvwxz"
nk=len(k$) ! nm=len(m$)
t$=""
for nw=1 to 20
lw=1+rnd(4)
w$=mid$(m$,rnd(nm),1)
for i=2 to lw
w$&=mid$(k$,rnd(nk),1)
if i<lw then w$&=mid$(m$,rnd(nm),1)
next i
t$&=w$&" "
next nw
debug pause
say pitch 1.4
say rate .9
say voice "en-us"
say text t$
while saying() ! slowdown ! end while
end

Re: Spoken Rubbish

Posted: Wed Oct 21, 2026 12:30 pm
by Dutchman
The program didn't work; it finished without any speech. I therefore added some code to print the value of SAYING(). This revealed that the first value of SAYING() following the command SAY TEXT T$ was 0.
Consequently, I added a wait loop to the program that continues until SAYING()=1:
DO ! UNTIL SAYING()
Good example for a voice application :!:

Code: Select all

'Spoken rubbish, by Henko, Oct 19, 2026
'https://nitisara.ru/forum/viewtopic.php?f=20&t=2839
flag=0
if flag then ! list voices ! stop ! end if
randomize
k$="aeiouy" ! m$="bcdfghjklmnprstvwxz"
nk=len(k$) ! nm=len(m$)
t$=""
for nw=1 to 20
  lw=1+rnd(4)
  w$=  mid$(m$,rnd(nm),1)
  for i=2 to lw
    w$&=mid$(k$,rnd(nk),1)
    if i<lw then w$&=mid$(m$,rnd(nm),1)
  next i
  t$&=w$&" "
next nw
debug pause
say pitch 1.4
say rate .9
say voice "en-US"
say text t$   
DO ! UNTIL SAYING() ' added for starting
while saying() ! slowdown ! end while
end

Re: Spoken Rubbish

Posted: Thu Oct 22, 2026 6:59 am
by Henko
This is strange.
I dowloaded my version from the forum and the program worked.
Then a downloaded your version from the forum and it worked; after commenting out your “do until” addition, it still worked.

I use iPadOS 17.7.5 (21H420) and SmartBasic 6.9.

(I used the “debug pause” to inspect the contents of the text string)

Re: Spoken Rubbish

Posted: Sat Oct 24, 2026 10:04 am
by Dutchman
I have a 9th-generation iPad. I have updated my iOS version to 27.0.1.
The 'starter loop' no longer seems to be necessary. I cannot explain why.
In the attached version, I have made a small change.
Originally, the words always began with a consonant.
I have adjusted this so that there is now an almost equal probability of a word starting with either a vowel or a consonant.

Code: Select all

'Spoken rubbish, by Henko, Oct 19, 2026
'https://nitisara.ru/forum/viewtopic.php?f=20&t=2839
'modified by Dutchman
flag=0
IF flag THEN ! LIST VOICES ! STOP ! END IF
RANDOMIZE
k$="aeiouy" ! m$="bcdfghjklmnprstvwxz"
nk=LEN(k$) ! nm=LEN(m$)
t$=""
FOR nw=1 TO 20
  w$=MID$(k$&k$&k$&m$,RND(3*nk+nm),1) ' start with vowel or consonant
  lw=1+RND(4)
  w$&=MID$(m$,RND(nm),1)
  FOR i=2 TO lw
    w$&=MID$(k$,RND(nk),1)
    IF i<lw THEN w$&=MID$(m$,RND(nm),1)
  NEXT i
  t$&=w$&" "
NEXT nw
DEBUG PAUSE
SAY PITCH 1.4
SAY RATE .9
SAY VOICE "en-US"
SAY TEXT t$   
WHILE SAYING() ! SLOWDOWN ! END WHILE
END