Jump to content

Photo

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


17 replies to this topic

#1 RevEng OFFLINE  

RevEng

    River Patroller

  • 3,413 posts
  • bit player
  • 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 in any language 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. Yes, 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.
  • 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.

...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. (or every other frame
  rem ** depending on how many non-voiced codes you use.) The easiest way
  rem ** get it to update with each frame 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
    


Lastly, 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.49KB   195 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

  • Topic Starter
  • 3,413 posts
  • bit player
  • Location:Canada

Posted Sun Feb 13, 2011 10:55 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

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


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

  • Topic Starter
  • 3,413 posts
  • bit player
  • Location:Canada

Posted Sun Feb 13, 2011 11:56 AM

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.

#6 stephena OFFLINE  

stephena

    River Patroller

  • 2,534 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Mon Feb 14, 2011 8:56 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

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

  • 933 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

  • Topic Starter
  • 3,413 posts
  • bit player
  • 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

  • Topic Starter
  • 3,413 posts
  • bit player
  • Location:Canada

Posted Sat Jun 4, 2011 12:03 PM

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

#10 Atarius Maximus OFFLINE  

Atarius Maximus

    Stargunner

  • 1,552 posts
  • Load "Atari2600",8,1: SYS32777
  • Location:St. Louis, Missouri USA

Posted Wed Mar 13, 2013 9:46 PM

The pressure is on! :) AA member the.golden.ax is offering real Atarivox hardware to AA members that have previously published games in the AA store to borrow one for development purposes (see his post here: http://www.atariage....x/#entry2715244) and he has agreed to let me borrow one. He's not selling them, it's strictly for development to try and spur development of Avox compatible games. After reading this post I'm ready to dive in and see what I can figure out. He has USB and DB9 versions available, I opted for the USB version to make it easier to try and develop on the PC. Sorry RevEng, but you may be getting a few more posts from me in the future with questions. I'm excited about working with the Avox. :)

EDIT: For clarification, here are the.golden.ax's conditions for asking for a loaner AtariVox:

A) You must have at least one completed title for sale on the Atari Age store now (or in the past) - hacks do count.
-= OR have completed title(s) that are available for download on Atari Age in a thread (send link) - hacks don't count =-

B) The loaner Vox is not for resale - keep it as long as you need for programming - return it, if / when you are done.

#11 Cybearg OFFLINE  

Cybearg

    Dragonstomper

  • 907 posts

Posted Thu Mar 14, 2013 1:53 AM

That's pretty awesome, but what's the point of no one has an AtariVox? I think there's great potential if people can actually hear it, but if not, then it's just a gimmick.

Is AtariAge going to sell AtariVox modules again, like it apparently used to? If the price was reasonable, I'd be very tempted to get one for development purposes, myself.

#12 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,413 posts
  • bit player
  • Location:Canada

Posted Thu Mar 14, 2013 6:40 AM

The original units were on sale for a while. There are AA members with AtariVox units.

the.golden.ax recently received a lot of mostly assembled units from mos6507. Ax plans to sell them to AA members once they're completed.

@Atarius Maximus: bring the questions on! :D

#13 theloon OFFLINE  

theloon

    Quadrunner

  • 7,956 posts

Posted Thu Mar 14, 2013 7:27 AM

Reading through this topic again I've got some questions:

I read a piece of text that says "low voltage serial port". Does that mean I could fry an AtariVox if I try and connect it to a standard PC serial port?

Also, does this thing have the slow, slow latencies of the SaveKey? Meaning my game couldn't be doing fast action AND telling the AtariVox to say "B17 Bomber!"?

#14 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,413 posts
  • bit player
  • Location:Canada

Posted Thu Mar 14, 2013 11:35 AM

Reading through this topic again I've got some questions:

I read a piece of text that says "low voltage serial port". Does that mean I could fry an AtariVox if I try and connect it to a standard PC serial port?


I don't know for sure. The 2600 pinouts are different than a standard DB9 serial pinout, so the best case scenario is it won't work. Worst case is you'll be potentially sending +12v and -12v through certain pins, depending on how your PC serial port is implemented.


Also, does this thing have the slow, slow latencies of the SaveKey? Meaning my game couldn't be doing fast action AND telling the AtariVox to say "B17 Bomber!"?


It's not particularly fast, but not as slow as accessing the eeprom.

There are two Vox specific calls we use in bB: SPEAK, which sets pointers to the voice data you want to use, and SPKOUT, which sends 1 byte of your voice data to the Vox per call.

SPEAK is fast, as it's just setting a few 6502 bytes.

SPKOUT needs to be called ~once per frame and takes about 600 cycles. This will fit comfortably into most kernel's spare vblank time (the notable exception here is DPC+). If you need to call SPKOUT from your regular bB code you'll need to factor it in; most kernels have around 2100 free cycles in overscan. (where bB code runs)

#15 stephena OFFLINE  

stephena

    River Patroller

  • 2,534 posts
  • Stella maintainer
  • Location:Newfoundland, Canada

Posted Thu Mar 14, 2013 12:25 PM

I don't know for sure. The 2600 pinouts are different than a standard DB9 serial pinout, so the best case scenario is it won't work. Worst case is you'll be potentially sending +12v and -12v through certain pins, depending on how your PC serial port is implemented.


Don't connect the AVox directly to your serial port; use a serial-USB converter instead. Take my word on this :)

EDIT: It's actually been some time since I hooked this up to my computer, as I originally plugged it in years ago and it's still there :) I might be remembering things incorrectly, and a standard USB-serial converter might not work either. I'm actually using a USB-AVox interface from Richard H. as described in the next post.

#16 Richard H. OFFLINE  

Richard H.

    Dragonstomper

  • 933 posts
  • VecMulti Vectrex cart
  • Location:UK

Posted Mon Mar 18, 2013 2:25 PM

This is the circuit for the USB to AtariVox interface.

The chip also needs programming. This is done through the USB once the circuit is built. You will need to download a programming utility from the FTDI site. I will send you my .ept file (won't let me attach it here).

Attached Thumbnails

  • AVox_USB.gif


#17 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 3,413 posts
  • bit player
  • Location:Canada

Posted Fri Apr 19, 2013 9:02 AM

Some more thoughts around the cycle requirements...

I've been looking at doing a pole position voice hack, and it seems that there's only enough free time for the 600 cycles SPKOUT takes in every other vblank frame. (pole position runs some routines during even frames, and others during odd) This led me to evaluate how often you actually need to call SPKOUT. (recall that SPKOUT is responsible for sending 1 byte to the AtariVox every time its called.)

Standard practice is to call SPKOUT every frame, which is about every 16.66ms. The routine needs to be called at a shorter interval than the time AtariVox takes to voice the phonemes, otherwise there will be short unnatural breaks or pops between phonemes, as AtariVox stops talking and waits for more data.

I looked at my final Game Over example, which sends a lot of extra control bytes to change each individual phoneme pitch and speed, and it sends 18 bytes of data to produce 890ms of speech, for an average speed of 49.4 ms per byte.

Using that average as a guideline, I think it's pretty safe to call SPKOUT every other frame, ie. every 33.33ms. Just test and use your ears as a guide. If there are break ups, try changing the voice speed at the beginning of the data so its a bit slower, or use your control bytes more sparingly in the affected areas.

Calling SPKOUT every 4th frame may work too, though its more likely to require a combination of slowing the voice down and minimizing non-voiced control data.

I added a note about this in the code comments in the first post

#18 the.golden.ax OFFLINE  

the.golden.ax

    Tear down this temple

  • 12,424 posts
  • I'll rebuild it in 3 days

Posted Fri Apr 19, 2013 9:26 AM

They are being sold now. If you need something PM me ;)




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users