Friday, November 21, 2008

tinkering with the RecordControl and Player

Well I have been seeking better performance. In order to find out where the code is inefficient, I tried the Nokia SDK with it's profiling tools. But that was unsuccessful.

I had the idea of putting some timestamp code in the recording loop. But I had a problem, I wasn't sure how to get the timestamps out of my non-MIDlet class.

A penpal of mine who is a very experienced programmer and lives in Deutscheland (not far from where my car was made) gave me some very helpful tips(Hi Frank). Now I've broken out my non-MIDlet classes into separate source files and made them public. That allowed me to get my timestamp data back into the MIDlet to display.

The other problem that I had was that I was not initializing my array of longs correctly. I was using the array as a sequence of timestamps, longs that are Epoch time.

By looking at these times I was able to find a call that took over 2 seconds. I have moved that code to a place before the recording loop starts in hopes of only having to do it once. However, the RecordControl and Player API aren't responding correctly yet.

The idea is to record for about 200 or 300 ms, then hand off the data to the http POST thread, and loop on this until told to stop.

So far the performance has been great, things are working in terms of tens of milliseconds. But there is still not something right with the RecordControl/Player sequence.

I'm glad to have a couple of gurus now that I can bug when I get stuck! It's a great gift.

Monday, November 10, 2008

looking for performance

I spent some time last Friday trying to find some more performance on the audio recording section of talkLock. That didn't go well, all of my builds were broken. But I was hanging out with some buddies, so it was hard to focus. But I did realize by the end of the night that by moving some declarations out of the while(){} in my Class's run(), I should be able to save quite a bit of memory allocation time when it's time to record. I might have to learn more about Player()s. If I could get the audio recording to drop out between chunks for 100ms-200ms, I would be very happy I think. I realize that that might be really bad, but I'll figure that out when I get there.

I also learned that Knudsen is still really smart. His book says that my trick with "implements Runnable" can be used in your MIDlet. So your MIDlet can have a run() method, and you can do a Thread(this). That is so freakin sick that I love it, and yet it is very perverse. Even more perverse is that it took me like 10 months to discover the Runnable trick, and the whole time it's been in the Knudsen book on my desk in the Man Room.

I took a basic handgun/concealed carry certification over the weekend, and am in the Cisco Certified Network Asskisser class all week this week. I am not very thrilled with my instructor for the CCNA, I think that when I pass the test this time, it will be in spite of that guy. But the shooting and handgun instruction was great. I shot the S&W M&P 9mm very well, I was even asked if I was in military or law enforcement.

I really shouldn't hack any this week with the class going on, but for my sanity I think I probably will at some point.

BTW, talkLock has been ranked as high as 2477th or so on Sourceforge! Anywhere from 1 to 9 downloads a day during the last month or so. The demand for this technology is there. When I hit 1.0 I think that even I will be surprised at the response.