Smooth Sounds

Up until now there was a delay between direction instructions words, e.g. “within” “800” “meters” “turn right”. Each word was contained in a separate mp3 file in order to maximize flexibility in direction variations. Problem was that there was big delay between words that sometimes led to cases where the instructions were almost irrelevant as you already passed the target point they were aiming at.

I spent the weekend in finding the root cause and trying to solve this issue. Turns out that WP7 has hard times decoding MP3 files and even worse is that you cannot pre-load/decode MP3 file before playing it.

I tried all kind of tricks in order to ‘concatenated words’ with no success:

- Use XNA SoundEffect class won’t work as it only decodes WAV files.

- I’m using MediaElement in order to play MP3, why not instantiate several such objects and play them one by one? because WP7 doesn’t allow several instances to exist – only one is allowed.

- Use playlist (client side playlist) – playlist aren’t supported in WP7.

The main issue here is that I wanted to keep the sound files in MP3 format since Waze downloads the sound files on demand from the server and I no control over the format of the d/l files. This is not quite true as I bring the hebrew and english sound files as part of the XAP file and copy them to isolatedstorage on the first time you run Waze in order to save redundant downloading time and data. So if I go with WAV format, which sould decode faster and probably solve the lagging I will lose the support for other languages’ audio.

I took the chance and converted all MP3 files to WAV files and went for a ride. Guess what? problem solved!

http://meirtsvi.wordpress.com/2011/06/27/waze-for-wp7-downloads/

About these ads
This entry was posted in Waze, WP7 and tagged . Bookmark the permalink.

4 Responses to Smooth Sounds

  1. Pingback: Additional speed improvements | Meir Tsvi's blog

  2. Alon Gil says:

    The program works fine, the only problem I have is – there are no direction instructions. The direction instructions is turned on in the setup window. I have a LG E900 phone with WP7.5 installed. Any idea why this happens?

    Alon

    • Meir Tsvi says:

      Didn’t heard about such issue for almost 6 months now so I guess it might be new issue.
      Please make sure you installed the latest version (currently 0.9.8.8). If you did, my only advice is to reinstall the app. When Waze loads it decides whether to download the sound files or not. Maybe it decided not to download them or something happened during the download and now the sounds are marked as downloaded although they aren’t. Reinstalling the app will trigger their downloading once again.

      • Alon Gil says:

        Thanks,
        I reinstalled the app and for a few days got no sound. Now I can here sound and everything seems to work perfect. Hope it stays this way!
        Thanks again
        Alon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s