BBC BASIC for Windows
« A short story: VOICE ( part 3 is on the 4th post) »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:01pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: A short story: VOICE ( part 3 is on the 4th post)  (Read 622 times)
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx A short story: VOICE ( part 3 is on the 4th post)
« Thread started on: Sep 25th, 2016, 05:29am »

I decided to experiment with the voice example included with BBC4W
..
If you think this mod has potential, let me know. Story telling and possible therapy application.
(the story is mine.. the code is part of the BBC4W samples)
Code:
      INSTALL @lib$+"COMLIBA"

      ON ERROR PROC_comexit : PRINT 'REPORT$ : END
      ON CLOSE PROC_comexit : QUIT

      PROC_cominit

      Pitch% = 0
      Speed% = -2
      Voice$ = ""

      REPEAT
        READ phrase$
  
        PROCspeak(phrase$,Pitch%,Speed%,Voice$)
        WAIT 100
  
      UNTIL phrase$ = ""
      PROC_comexit
      END
      DATA close your eyes
      DATA IMAGINE YOU ARE IN A NICE HOT SHOWER
      DATA NOW INCREASE THE NOISE OF THE WATER AND IMAGINE THE HUMID WARM AIR
      DATA breeth THE HUMID AIR and FEEL the WARM WATER AS it GENTLY MASSAGES
      DATA AS YOU RELAX YOU OPEN YOUR EYES AND SEE THAT YOU ARE NOW IN A NATURAL EARTHEN HEATED SWAMP.
      DATA STRANGE EYES PEER DOWN AT YOU AND DEEP HEAVING WOOD BENDING SOUNDS ECHO IN THE DARKENING DEPTHS
      DATA CROW LIKE SOUNDS ABRUPTLY CHANT AT YOU AS YOU NOW REALIZE YOU ARE BURDENED WITH A SUIT OF HEAVY ARMOR
      DATA AS YOU EXTEND YOUR HAND TO GRAB A PROTRUSION YOU DISLODGE A SWORD AND RAISE THE RUSTY METAL IN FRONT OF YOU
      DATA THE RUST SLIDES OFF THE SWORD AS THOUGH it WAS WATER AND it BEGINS TO SHINE.
      DATA SEEING NO USE FOR it, YOU THROW it AND it SLAMS INTO A TWISTED TREE
      DATA THE SWORD DISLODGES AND FLOATS TOWARDS YOU AND THE BURDEN OF YOUR ARMOR WILLS YOU TO PICK it up
      DATA You advance slowly, and soon the muddy shore greets you and you crawl to a dry clearing
      DATA

      DEF PROCspeak(phrase$,pitch%,speed%,voice$)
      tts% = FN_createobject("Sapi.SpVoice")
      IF tts% THEN
        LOCAL qual$
        qual$ = "<PITCH ABSMIDDLE="""""+STR$pitch%+"""""/><RATE ABSSPEED="""""+STR$speed%+"""""/>"
        IF voice$<>"" qual$ += "<VOICE REQUIRED=""""NAME="+voice$+"""""/>"
        PROC_callmethod(tts%, "Speak("""+qual$+phrase$+""")")
        PROC_releaseobject(tts%)
        ENDPROC
      ENDIF
      tts% = FN_createobject("Speech.VoiceText")
      IF tts% THEN
        PROC_callmethod(tts%, "Register("""",""COMLIB demo"")")
        PROC_putvalue(tts%, "Enabled(BTRUE)")
        PROC_putvalue(tts%, "Speed("+STR$INT(150*3^(speed%/10))+")")
        PROC_callmethod(tts%, "Speak("""+phrase$+""", 1)")
        REPEAT
          SYS "Sleep", 150
        UNTIL FN_getvalueint(tts%, "IsSpeaking") = 0
        PROC_releaseobject(tts%)
        ENDPROC
      ENDIF
      ENDPROC

 
« Last Edit: Oct 10th, 2016, 10:34pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
Ric
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 136
xx Re: A short story: VOICE
« Reply #1 on: Sep 28th, 2016, 6:57pm »

Interesting, can you get it to put inflection into the speech, it would sound much less computed?

Ric
User IP Logged

It's always possible, but not necessarily how you first thought. Chin up and try again.
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: A short story: VOICE
« Reply #2 on: Sep 29th, 2016, 02:16am »

I adjusted the pitch to 0.. so it should sound less computer generated.
If I had some more voices to add, then I could make a cool story with characters.

Here is part 2:
Code:
      INSTALL @lib$+"COMLIBA"

      ON ERROR PROC_comexit : PRINT 'REPORT$ : END
      ON CLOSE PROC_comexit : QUIT

      PROC_cominit

      Pitch% = 0
      Speed% = -2
      Voice$ = ""

      REPEAT
        READ phrase$
  
        PROCspeak(phrase$,Pitch%,Speed%,Voice$)
        WAIT 100
  
      UNTIL phrase$ = ""
      PROC_comexit
      END
      DATA Part two
      DATA many dry branches are strewn all around the area
      DATA You immediately gather them and vigorously use your camping skills to start a fire.
      DATA As you sit on a rock, a bunch of rat like creatures gather around the fire
      DATA The rats suddenly begin to sing in weak voices and dance wildly swinging their limbs around.
      DATA They squeal loudly and scurry away like rabbits into the darkness.
      DATA Feeling disturbed, you rise to your feet and draw your sword.
      DATA You scream like a warlord into the skies and your voice echos like thunder in the distance.
      DATA You then stomp out the fire and run frantically into the woods
      DATA You begin to slash down the trees and your mighty sword doesnt even pause as it effortlessly cuts through the dense wood.
      DATA Grunts begin to echo, getting louder and louder
      DATA you now know you have awoken something and the ground begins to shake

      DATA

      DEF PROCspeak(phrase$,pitch%,speed%,voice$)
      tts% = FN_createobject("Sapi.SpVoice")
      IF tts% THEN
        LOCAL qual$
        qual$ = "<PITCH ABSMIDDLE="""""+STR$pitch%+"""""/><RATE ABSSPEED="""""+STR$speed%+"""""/>"
        IF voice$<>"" qual$ += "<VOICE REQUIRED=""""NAME="+voice$+"""""/>"
        PROC_callmethod(tts%, "Speak("""+qual$+phrase$+""")")
        PROC_releaseobject(tts%)
        ENDPROC
      ENDIF
      tts% = FN_createobject("Speech.VoiceText")
      IF tts% THEN
        PROC_callmethod(tts%, "Register("""",""COMLIB demo"")")
        PROC_putvalue(tts%, "Enabled(BTRUE)")
        PROC_putvalue(tts%, "Speed("+STR$INT(150*3^(speed%/10))+")")
        PROC_callmethod(tts%, "Speak("""+phrase$+""", 1)")
        REPEAT
          SYS "Sleep", 150
        UNTIL FN_getvalueint(tts%, "IsSpeaking") = 0
        PROC_releaseobject(tts%)
        ENDPROC
      ENDIF
      ENDPROC
 
« Last Edit: Sep 29th, 2016, 02:44am by michael » User IP Logged

I like making program generators and like reinventing the wheel
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: A short story: VOICE ( part 3 is on the 4th po
« Reply #3 on: Oct 10th, 2016, 10:35pm »

The story gets more complicated:

Code:
      INSTALL @lib$+"COMLIBA"

      ON ERROR PROC_comexit : PRINT 'REPORT$ : END
      ON CLOSE PROC_comexit : QUIT

      PROC_cominit

      Pitch% = 0
      Speed% = -2
      Voice$ = ""

      REPEAT
        READ phrase$
  
        PROCspeak(phrase$,Pitch%,Speed%,Voice$)
        WAIT 100
  
      UNTIL phrase$ = ""
      PROC_comexit
      END
      DATA before you can focus your gaze on it, you are wrapped in thorny vines that drop you on your back and drag you into the vegetation
      DATA the rat like creatures jump on you and frantically scratch your face as they giggle in a frenzy
      DATA Your body is viciously pounded on the ground and lashed through the trees
      DATA It becomes a blur and you lose conscientiousness
      DATA when you awaken, you find yourself in a dark slimy chasm
      DATA you quickly realize you are not alone
      DATA a damsel in dirty rags is trapped in a jagged enclosure and she is frantically trying to say something
      DATA but you can not hear anything. In fact, you can not even utter a word even as you try to scream
      DATA you extend your hand into the enclosure and she grabs it in desperation
      DATA you can see the expression as tears roll down her face as she panicks as she looks into the darkness behind her.
      DATA the shadow nears her and surrounds and pulls her hand away from you into the blackness
      DATA everything becomes pitch black as you desperately search for a path to exit the new hell you are in.
      DATA

      DEF PROCspeak(phrase$,pitch%,speed%,voice$)
      tts% = FN_createobject("Sapi.SpVoice")
      IF tts% THEN
        LOCAL qual$
        qual$ = "<PITCH ABSMIDDLE="""""+STR$pitch%+"""""/><RATE ABSSPEED="""""+STR$speed%+"""""/>"
        IF voice$<>"" qual$ += "<VOICE REQUIRED=""""NAME="+voice$+"""""/>"
        PROC_callmethod(tts%, "Speak("""+qual$+phrase$+""")")
        PROC_releaseobject(tts%)
        ENDPROC
      ENDIF
      tts% = FN_createobject("Speech.VoiceText")
      IF tts% THEN
        PROC_callmethod(tts%, "Register("""",""COMLIB demo"")")
        PROC_putvalue(tts%, "Enabled(BTRUE)")
        PROC_putvalue(tts%, "Speed("+STR$INT(150*3^(speed%/10))+")")
        PROC_callmethod(tts%, "Speak("""+phrase$+""", 1)")
        REPEAT
          SYS "Sleep", 150
        UNTIL FN_getvalueint(tts%, "IsSpeaking") = 0
        PROC_releaseobject(tts%)
        ENDPROC
      ENDIF
      ENDPROC
 
User IP Logged

I like making program generators and like reinventing the wheel
DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: A short story: VOICE ( part 3 is on the 4th po
« Reply #4 on: Oct 12th, 2016, 12:44pm »

Hi Michael,

Is the idea that you will have a set of locations, perhaps encoded as structures, with some descriptive text, and a way of recording objects that are present and/or can be interacted with? Will you deal with other players/characters separately? Presumably the player will be able to move between locations, finding things and interacting with other characters?

Best wishes,

D
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: A short story: VOICE ( part 3 is on the 4th po
« Reply #5 on: Oct 13th, 2016, 01:48am »

Yes. This will evolve into a game. But this is only the introduction to a choose your own adventure series.
User IP Logged

I like making program generators and like reinventing the wheel
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls