Active Topics

 



Notices


Reply
Thread Tools
Posts: 137 | Thanked: 150 times | Joined on Jan 2010
#81
Originally Posted by Android_808 View Post
The config.xml simply tells what files are linked with each maneuver action.
Well, there is a bit more to it than that, but I guess we can ignore the complicated state and sentence construction logic for now

The decision of when to play sounds is indeed very dumb, and should take speed into account, but I fear accuracy is going to be a problem.

So has anyone got one of the sound files to play from within Ovi Maps? I tried an embed tag but I can't seem to get it to work.

Also does anyone have Ovi Maps for a Symbian phone? It might help figure out the logic in config.xml.
 

The Following User Says Thank You to CormacB For This Useful Post:
Posts: 244 | Thanked: 354 times | Joined on Jul 2010 @ Scotland
#82
Originally Posted by CormacB View Post
Also does anyone have Ovi Maps for a Symbian phone? It might help figure out the logic in config.xml.
Pretty certain I've got an old 5230 kicking around somewhere. I'll have a look and see if I can extract something for you.
 

The Following User Says Thank You to gregoranderson For This Useful Post:
Posts: 137 | Thanked: 150 times | Joined on Jan 2010
#83
I've gone through config.xml for the nokia speech and I think this is how it works.
This does not describe the text section as it is not interesting for speech.

How to evaluate:

1. Get the next element
2. If it is a link element define a function and don't evaluate it
3. If the element has an action then perform it
4. Evaluate any tests associated with it. If the result is true:
a. descend into the child elements
b. start from step 1 with the child elements
c. return true (ignoring result of child elements - except for links)
5. Else go to step 1

The evaluation of elements is basically like:
{
if (element1) return true;
if (element2) return true;
if (element3) return true;
return false;
}



Elements

link: defines a function which evaluates its children and returns true if one of them return true else false. id attribute is the name of the function
ref: calls a function defined by a link element. If the function result is true then evaluate the child elements and then return true
dummy: evaluates the child elements, but returns false. This allows us to test two independent conditions.
soundfile: plays the sound specified in the val attribute. returns false
state: tests if the state object contains the value in the val attribute. logic attribute modifieds the check somehow?. logic values of 1 and 2 are used. If true evaluates children then returns true else returns false
flags: tests if the flags object contains the value in the val attribute. If true evaluates children then returns true else returns false
distancetomaneuver: tests the distance to the current maneuver. min and max can be tested. Distance is in meters?? If true evaluates children then returns true else returns false
maneuver: tests if the current maneuver type is the one specified in the val attribute. Seems to be related to Maneuver._action
turn: tests if the current maneuver turn is the one specified in the val attribute. Seems to be related to Maneuver._turn
nextmaneuver: tests if the next (the one after the current maneuver) maneuver type is the one specified in the val attribute. This is used for chaining message like "turn left *and then* turn right"
nextturn: tests if the next (the one after the current maneuver) maneuver turn is the one specified in the val attribute.
setstate: sets the state contained in setflagp or clears it if setflagn is used. Values such as MANEUVER_ANNOUNCE are used but never seem to be used in tests, se they are for the benefit of something external to the script. I think this state might be a single value state that is not related to the state object used by the "state element"
setflags: sets the flag contained in setflagp or clears it if setflagn is used.
distanceposition: tests the distance to the maneuver and from the previous maneuver. minto and maxto refer to the current maneuver and minfrom and maxfrom the maneuver that we just passed.testflagn and setflagp seem to check bits set in a numeric state flag (separate from that used by the setstate and state elements). If any of the bits passed to testflagn are set then the test fails. setflagp ORs the bits with the current flags.
timeposition: same as distanceposition but using a time calculation. I'm not sure what the units are. (it could be tricky to get a reasonably accuarate time estimate)


The flags used by distanceposition and timeposition seem to support 4 types of voice commands:
Announce maneuver (MANEUVER_ANNOUNCE) if 1100 clear set bit 0010 -> reminder 2 (MANEUVER_ALL) if 1100 clear set bit 1000 -> reminder 1 (MANEUVER_ALL) if 0100 clear set bit 0100 -> command (MANEUVER_COMMAND) if 0001 clear set 1111


The main "entry point" when evaluating is the check that we have the WITH_ROUTE state. Then it checks that we are on target and don't have invalid junctions. Then it checks for various distance and times to maneuvers and decides what, if anything, to say. I guess that this should be evaluated on every position update.
 

The Following 9 Users Say Thank You to CormacB For This Useful Post:
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#84
Wow, got a bit more advanced than me. I was just skimming over it and hadn't read that far through it. Had a *very* quick look through the latest Ovi Maps beta, and found an index.html. Majorly different to the one were working with. For starters it uses *.css and *.js files rather than bloating the file with a huge <style> definition. I've done this as well so I've attached a copy. Seems to work OK.

I think your on the right lines with the logic. Seems it does do more than describe the audio files.

<!-- Distance for a Command -->: From what I can make out, the logic here would help solve the current issue with waypoints right on top of each other. As both python and js can parse XML files, what would be the easiest option.

Has anyone tried the <audio> html tag? I've tried to get it to play a pre-specified file on my desktop but with no joy yet. According to www.html5test.com MicroB supports <audio> with PCM files. Does this apply to Maps as well? <embed> will probably require an extension to be loaded. Talking of which, making a xpcom library/extension for audio playback would probably solve the issue. If only js could execute shell commands...

Recently posted html.zip, all style code removed to a separate file.
Attached Files
File Type: zip html.zip (222.8 KB, 119 views)

Last edited by Android_808; 2011-01-14 at 16:52.
 

The Following 4 Users Say Thank You to Android_808 For This Useful Post:
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#85
Originally Posted by CormacB View Post
The main "entry point" when evaluating is the check that we have the WITH_ROUTE state. Then it checks that we are on target and don't have invalid junctions. Then it checks for various distance and times to maneuvers and decides what, if anything, to say. I guess that this should be evaluated on every position update.
I'm gonna try looking into this a bit more over the weekend. I think updatePosition is a good assumption. May try to create a small subset of the functionality in js for now. Don't like hard-coding it because it won't aid il8n support.
 

The Following User Says Thank You to Android_808 For This Useful Post:
Posts: 137 | Thanked: 150 times | Joined on Jan 2010
#86
http://pastebin.com/c66yxAeK Javascript parser/evaluator for config.xml. I think some of it is right
What is most definitely wrong is distanceposition/timeposition elements and logic attribute.

http://pastebin.com/A5eq7CDr Simple test webpage. edit the eg object in the js file to try to generate different directions. Currently all sounds are playing at once
 

The Following 3 Users Say Thank You to CormacB For This Useful Post:
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#87
Ah. I was kind of expecting that. I was going to edit the python script and send the filenames to be played by a cli gstreamer app but decided against it.

Looking at embed's event callbacks at the moment. There is an onended method. Could we during parsing add all files to be played to an array. Then play the first element and use onended to iterate over the array to play the rest.
 

The Following User Says Thank You to Android_808 For This Useful Post:
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#88
Originally Posted by CormacB View Post
http://pastebin.com/c66yxAeK Javascript parser/evaluator for config.xml. I think some of it is right
What is most definitely wrong is distanceposition/timeposition elements and logic attribute.

http://pastebin.com/A5eq7CDr Simple test webpage. edit the eg object in the js file to try to generate different directions. Currently all sounds are playing at once
I've downloaded both files, renamed one evalspeech.js, the other test.html. Put in a directory with a folder called english, containing the xml file and folder english_male containing voice files.

When opening it doesn't seem to be able to get
Code:
if (xmlhttp.readyState==4 && xmlhttp.status==200)
to return true. Any ideas?
 

The Following User Says Thank You to Android_808 For This Useful Post:
Posts: 137 | Thanked: 150 times | Joined on Jan 2010
#89
I think you'll need to put the files in a webserver, not just read them from the filesystem.
 

The Following User Says Thank You to CormacB For This Useful Post:
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#90
Ok, that worked. Had to add file extension to get it to play using your code. Would probably be better with type= added to the <embed> arguements so that original voice files don't have to be modified.

Going back to the all at once problem, I know embed has an autoplay arguement, so adding new elements will trigger the autoplay. Is there a function to play at will so only one element need be used. If not, it could be removed then readded with next sound file.
 

The Following User Says Thank You to Android_808 For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 12:07.