Saturday, March 24, 2012

Amazon Kindle Fire Sound Delay

A few weeks ago a customer reported that they couldn't download Kindergarten Math from the amazon market on their kindle fire. I did not have a kindle, so, I did not know what to tell the customer. The next day, I went to Fred Meyer and got a Kindle fire.

Fortunately, there was no problem downloading and running Kindergarten Math. But, there was a peculiar sound cut off on the Kindle. I use multiple sound files that are run one after the other for the complete instruction. The number values come from multiple sound files. This way, I don't need a separate sound file for each of the 50 exercises. But, on the kindle, the sound gets cut off at the wrong point, making it sound jerky.

For the first exercise the sounds are
  •  move
  • five
  • balls into the box, using your finger. Press the number
  • five
  • when done

The end part of each sound was getting cut off. It would sound like
  • mo
  • fi
  • balls into the box using your finger. Press the numb
  • fi
  • when done

There was a delay in the sound being played, but not in the reset() being called on the MediaPlayer. My solution is to use 2 MediaPlayer objects. The first media player plays the 1st, 3rd, and 5th sound. So, the reset on the 1st sound is only called after the 2nd sound is complete. The second media player plays the 2nd and 4rth sound. This removes the cut-off, but leads to a little bit of overlap. Still, it sounds better than what it does currently.

Here is some code for reference, if anyone else is having the same problem, or can suggest a better option - 

public class MediaManager implements OnCompletionListener {

static MediaPlayer mp0 = new MediaPlayer();
static MediaPlayer mp1 = new MediaPlayer();

int[] sounds;

int current = -1;

Context context;
public MediaManager (Context context) {
mp0.setOnCompletionListener(this);
mp1.setOnCompletionListener(this);
this.context = context;
}
public void play(int[] sounds) {
this.sounds = sounds;
this.current = 0; //start from 0
mp0.reset();
mp1.reset();
playAudio(mp0);
}
public void stop() {
if(mp0!=null && mp0.isPlaying())
mp0.stop();
if(mp1!=null && mp1.isPlaying())
mp1.stop();
}

@Override
public void onCompletion(MediaPlayer mp) {
if(current>=0 && current<sounds.length) {
current ++;
if(mp==mp0) {
mp1.reset();
playAudio(mp1);
}
else { //mp==mp1
mp0.reset();
playAudio(mp0);
}
}
}
private void playAudio(MediaPlayer mp) {
try {
if(current>=0 && current<sounds.length) {
mp.setDataSource(context, Uri.parse("android.resource://..."));
mp.prepare();
mp.start();
}
else {
current = -1;
}
} catch(Exception e) {
Log.e("Media Player","Media player exception", e);
}
}
}

Thursday, March 22, 2012

Learning to Appreciate Customers

My friend thinks I love to complain. When I decided to start working on my own projects, mostly by myself, he quipped - 
  If you are working for yourself, who will you complain about then?
I jokingly replied - 
  Customers
After the failure of my first few projects, the only think I had to complain about customers... is that I had none. I learnt quickly to appreciate the users of Kindergarten Math. Now, I wouldn't dream of complaining about them. Many are thoughtful and appreciative. Some of the recent comments that I especially appreciate are - 
The product got here quickly. Once it was here, my son and I had a ton of fun playing with them. Putting the balls into the bin is great! Makes the concept of addition and subtraction very hands on for him. Which he needs. Great for kids with Autism. Which is what i found good about this for my son.
- D. Latowski 
To see the app I built be useful for kids with Autism too, made me cry. It was not something I had expected. I am grateful to the commentor for letting me know.
 I installed this and Kids Numbers and Math Free from intellijoy at the same time. The other app has more options and is more colorful and fun (to me) but to my son - this one took the cake for some reason. :) He did them all and wanted to keep going, so I will be paying to upgrade. I must thank the dev for a respectable price on the full version and NO ADS! Not even in the lite version! Very nice. I did take away one star just because it could be a little more forgiving of little kids touchscreen skills. In the maze, if you bump into another box just barely - it gives you a fail. Disappointing to a child that expected to see they got it right. Also, when adding or taking away balls in some of the other games, the ball doesn't always stay where it's supposed to go. Even I had occasional issues when I wasn't precise. That can be frustrating for a child, especially if they are concerned more with the counting and don't notice the ball didn't "stick" where it needed to be. I am betting this app will evolve well in the future. I am totally happy with it. Great job!
- Linn Anne

Such a thoughtful and detailed comment. I imagine it took her a while to type all that on a touch keyboard. Kids Numbers and Math is a top app on the market for kids. To find that kids like Kindergarten Math more... keeps me going. The criticisms are just as useful. She is helping me improve the app for all kids. I will be fixing the things she pointed out soon as I have time.

Thursday, March 8, 2012

Odd Google Market Search Rankings

Kindergarten Math crossed 1000 downloads yesterday. It was an exciting moment. I was waiting for it for a few days, and hoping that it would get a little bump when it crossed 1000 downloads - same as it did when it crossed 500 downloads.

But, what happened? Kindergarten Math actually fell 10+ places in rankings for keywords Kindergarten Math. It fell in ranking for keyword Kindergarten. It fell a lot in ranking for Kids Math. It is rather surprising and odd behavior from the google market. I am convinced they have a bug in their search algorithm. It seems to be treating it as though its 100 downloads instead of 1000. Being an engineer myself, I know how easy it is to make an order of 10 mistake. Or, maybe treating it as though it is a free app for rankings.

I sent the information to google. But, I am not expecting much. They are secretive about their algorithm. Maybe they don't want people selling more than 1000 copies on purpose. I'll update if I hear anything.

Update on 3/15
Kindergarten Math is back up in rankings. I am not sure if google fixed the problem based on e-mails it received from me and others, or if it was just a problem at 1000 and goes away when it hits 1100. The rankings seem to be more sensitive to daily downloads too since the change over to play.google.com. Is google  trying to copy a page from amazon's book?