Jump to content



1

bB AtariVox Support, Part 2... Basic Voice Functionality


8 replies to this topic

#1 RevEng OFFLINE  

RevEng

    River Patroller

  • 2,010 posts
  • bit shoveler
  • Location:Canada

Posted Sat Feb 12, 2011 2:10 PM

bB AtariVox Support, Part 2... Basic Voice Functionality
    The AtariVox is capable of quite good sounding speech, but getting good speech out of it is a bit of an art.

    In this part, I'll take a look at how to get basic voice functionality out of the AtariVox; following the steps in this post will produce output on par or only slightly better than basic text to speech systems, like SAM, Speak'N'Spell, etc.

    Just keep in mind that AtariVox can do better than this; I plan to follow-up with another post, with some tips on how to get the AtariVox to sound more natural.
Making Phrases

    Human speech is made up of atomic sounds called phonemes.

    To make the AtariVox speak, instead of sending it english letters, you send it phoneme codes. Because it uses phoneme codes, AtariVox doesn't need to guess if an E is silent, or if a particular C sounds like an S or a K; you're sending it all the information it needs to pronounce the sound.

    The phonemes that AtariVox can say can be found on page 15 of the SpeakJet manual (SpeakJet is the Vox chip in AtariVox) along with the code number for each phoneme.

    There are a few ways one can determine which phonemes are required to say any particular word...

    • The SpeakJet creators, Magnevation, have provided a dictionary of common words and their phoneme composition. Taking the phonemes from the dictionary, you can look up their codes in the SpeakJet manual, and build up a phrase. The dictionary has a very limited number of words, so often you'll be taking phonemes from words with similar sounds.

      All of this is twice as tedious as it sounds.
    • Magnevation has also provided a Windows utility, called the Phrase-a-lator, that will take typed in words and sentences and break them into phoneme codes.

      Using Phrase-a-lator is definitely less tedious than manual entry, but since Phrase-a-lator uses the same limited dictionary from the manual method, there are many words it doesn't understand.
    • batari has created a cross-platform utility called Speak To Me, that can look up your phrase in the SpeakJet dictionary. If a word in the phrase doesn't exist, Speak To Me runs through an algorithm that will attempt a best guess at the phoneme code breakdown.

      Using this utility is my preferred method. I'll take the output from the utility and then begin to tweak any off-sounding phonemes until I'm satisfied with the output.

      [edit]
    • I've created a utility called speakalator that operates similar to Phrasealator for Unix platforms. It incorporates batari's code, so it will make a best guess if a word isn't in the dictionary.
      [/edit]
    ...I invite you to try to use all of these methods, and find the technique that works best for you.

    Running the phrase "game over" through batari's utility or the Phrase-a-lator provides the following codes, which we'll use for our example code in the next section.

    • 08 b2 9a 8c 08 89 07 a6 97
Making AtariVox Say Our Phrase


Alex Herbert's SpeakJet driver will do most of the heavy lifting for us. Here's a minimal example of how to get the AtariVox to say our "game over" phonemes...

  rem ** include the driver
  asm
  include "speakjet.inc"
end

  rem ** The AtariVox driver requires 2 consecutive bytes of ram.
  dim speech_addr=a
  dim speech_addr2=b

  rem ** Point the AtariVox at the "game over" data!
  asm
  SPEAK data_gameover
end
  
mainloop
  scorecolor=$0f
  drawscreen
  goto mainloop

  rem ** The SPKOUT routine needs to happen each frame. The easiest way
  rem ** to do that in bB is to just stick it in vblank...
  vblank
  asm
  SPKOUT temp1
end
  return

rem ** the data ideally starts with 31 to reset the speech frequency, etc.
rem ** it must end with a 255 end-marker, or else bad things will happen.
  data data_gameover
  31
  $08, $b2, $9a, $8c, $08, $89, $07, $a6, $97
  255
end

And that's it!

At the bottom of this post I've included sample code that plays more than one sound... The phoneme codes in the sample are courtesy Alex Herbert, lifted directly from his assemebly language demo.
Points Worth Noting

    While using the AtariVox Voice Function is straightforward, there are a few things to keep in mind:

    • Stella does not emulate the AtariVox Voice function, but instead can send the codes to a real AtariVox attached to a special low-voltage serial port on your PC.

      There used to be a USB AtariVox connector, but its not available for sale presently. Another possibility is to connect to the AtariVox with a special TTL level serial port.
    • AtariVox speech goes into a buffer, so if you send it a bunch of phrases in a short period of time they'll queue up and it will say all of them.

      If you want your phrases to interrupt each other, begin your phrases with the command to clear the speech buffer...

        data gameover
        "\0RX" ; stop speaking and clear the buffer
        $08, $b2, $9a, $8c, $08, $89, $07, $a6, $97 ; game over
        $ff ; end of data
      end
      
AtariVox is the creation of Richard Hutchinson, and the drivers were created by Alex Herbert. All of your thanks should go to these guys. I know mine does!


Attached File  avoxvoice.zip   3.49K   85 downloads

#2 diogoandrei OFFLINE  

diogoandrei

    Chopper Commander

  • 210 posts
  • Location:Brazil

Posted Sun Feb 13, 2011 10:37 AM

Hm, sorry to ask this, but I am bit confused. To I have to have a real AtariVox to get this working with Stella? Thanks

#3 RevEng OFFLINE  

RevEng

    River Patroller

  • 2,010 posts
  • bit shoveler
  • Location:Canada

Posted Sun Feb 13, 2011 10:55 AM

View Postdiogoandrei, on Sun Feb 13, 2011 10:37 AM, said:

Hm, sorry to ask this, but I am bit confused. To I have to have a real AtariVox to get this working with Stella? Thanks
That's an excellent question, Diogo - I'll update the main post with this information.

Yes. For Vox operation (unlike the EEPROM access) stella needs a real AtariVox attached to it through a special low-voltage serial port.

At one time the AtariAge store carried a special USB AtariVox that had the port built-in, but I don't think they do now. :(

#4 diogoandrei OFFLINE  

diogoandrei

    Chopper Commander

  • 210 posts
  • Location:Brazil

Posted Sun Feb 13, 2011 11:35 AM

View PostRevEng, on Sun Feb 13, 2011 10:55 AM, said:

View Postdiogoandrei, on Sun Feb 13, 2011 10:37 AM, said:

Hm, sorry to ask this, but I am bit confused. To I have to have a real AtariVox to get this working with Stella? Thanks
That's an excellent question, Diogo - I'll update the main post with this information.

Yes. For Vox operation (unlike the EEPROM access) stella needs a real AtariVox attached to it through a special low-voltage serial port.

At one time the AtariAge store carried a special USB AtariVox that had the port built-in, but I don't think they do now. :(

Hm too bad. I do synthesized voices once in a while at the audio recording studio I work at and I am really thinking about getting an AtariVox to hook it up with our gear (we already have a 2600 in there). Now that we will be able to program for the AtariVox with Visual bB, things couldn't be easier!

I read in the other thread that maybe Ax will produce some... hope that really happens, I'll probably get one! Maybe he could also run some USB versions ;)

#5 RevEng OFFLINE  

RevEng

    River Patroller

  • 2,010 posts
  • bit shoveler
  • Location:Canada

Posted Sun Feb 13, 2011 11:56 AM

View Postdiogoandrei, on Sun Feb 13, 2011 11:35 AM, said:

I read in the other thread that maybe Ax will produce some... hope that really happens, I'll probably get one! Maybe he could also run some USB versions ;)
Yeah, that would be cool. I'd buy one!

Failing that, with a small bit of modification you could take a cheap USB serial port like this and it would be able to drive a standard AtariVox too.

Edited by RevEng, Sun Feb 13, 2011 12:14 PM.


#6 stephena OFFLINE  

stephena

    Stargunner

  • 1,967 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Mon Feb 14, 2011 8:56 AM

View Postdiogoandrei, on Sun Feb 13, 2011 10:37 AM, said:

Hm, sorry to ask this, but I am bit confused. To I have to have a real AtariVox to get this working with Stella? Thanks
As mentioned above, yes, you need a real device to get sound output. There was initially some work on adding SpeakJet emulation to Stella (ie, the chip that does synthesized sound in the AVox), but we couldn't get past several major hurdles. And since sound programming, or anything sound related, aren't my strong area, the idea was pretty much shelved.

You don't need an AVox or SaveKey for EEPROM access, though; access to this part of the device is emulated. In fact, even if you do have the actual hardware, access is still emulated - it never touches the EEPROM at all. Support for the AVox is kind of weird in Stella. You need actual hardware for sound, as we couldn't properly emulate it. But we don't touch the EEPROM at all, because the required code to do isn't released under the GPL, and can't be included in Stella.

#7 Richard H. OFFLINE  

Richard H.

    Dragonstomper

  • 827 posts
  • VecMulti Vectrex cart
  • Location:UK

Posted Mon Feb 14, 2011 9:23 AM

I sent my remaining batch of USB interfaces to Glenn a while back, so hopefully either he or Axe will start sellling them in the future (I'll let Axe have the PCB and firmware files if he wishes to make those too).

It's basically just a USB to serial convertor (based on the FT232R), but also powers the AVox and has the EEPROM wired through too.

Any adaptor can be made to work. You would just need to steal 5V from the USB to power the unit.

This is a good one. All the connections are easy to get at.

BTW, if you double click on the phonemes in PhraseAlator, they are entered into the say data window. I find it quicker to make new words that way.

Edited by Richard H., Mon Feb 14, 2011 9:49 AM.


#8 RevEng OFFLINE  

RevEng

    River Patroller

  • 2,010 posts
  • bit shoveler
  • Location:Canada

Posted Sun May 8, 2011 8:12 AM

I've updated the "points worth noting" in the first post with info on how to stop AtariVox from talking, instead of queuing up the phrases.

I used this in my AtariVox Spell&Speak toy, so the user can get a Max Headroomish effect by pressing the "speak" button repeatedly.

#9 RevEng OFFLINE  

RevEng

    River Patroller

  • 2,010 posts
  • bit shoveler
  • Location:Canada

Posted Sat Jun 4, 2011 12:03 PM

I've updated the first post with information on speakalator.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users