Jump to content
Brian Enos's Forums... Maku mozo!

Open Source Shot Timer


adweisbe

Recommended Posts

Thanks Chris. I will debug it on my coworker's phone on Monday. I'll bet that I set the expected Android version too high. It is set 2.1 and I can probably get away with a much lower version.

Edited by adweisbe
Link to comment
Share on other sites

  • Replies 220
  • Created
  • Last Reply

Top Posters In This Topic

Hi all,

The new timer is available here:

http://code.google.com/p/openshottimer/downloads/list

android_ost.png

I buckled down today and went as far as I could with the app given that the emulator won't let me record audio. It should use audio support if it is available but I have no idea if it will work. If it is too sensitive or not sensitive enough play with your microphone volume. I will add a slider for that later.

If if it can't access the audio hardware an error will pop up and it will start generating fake shots just to prove that the UI works. I will try it out on my co-workers Droid on Monday.

Ariel

Ariel,

Installs just fine on 2.1.... For those that want to try, make sure you go to settings/applications/ and turn on *other sources* first.

Installed, launched, came up with the shot timer screen. No hand clapping would cause anything (course, I don't know how to make it work). pressed the *buzz!* button, and got a loud beep from the phone an error that said it couldn't access the hardware, and would use an alternate stream to test, then it ran thru a few shots until I pressed the Quit button.

Might it be that you didn't set the flag in the manifest to allow hardware access? Just a guess as I've dabbled a bit with Android software dev.

Thanks and let me know when new version is available to try.

Alan

Link to comment
Share on other sites

I made a mistake exporting the application. After I exported it I renamed it and then ran zipalign on it which is reported to not work (didn't need to anyways because Eclipse runs zipalign). I exported the version for Android 2.1 again and uploaded to google code. I tried to target Android 1.5 and there are one or two small things that need to change. This is what I am using in the manifest, perhaps I need additional permissions.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.ost"
     android:versionCode="1"
     android:versionName="1.0">
   <application android:icon="@drawable/icon" android:label="@string/app_name">
       <activity android:name=".OpenShotTimer"
                 android:label="@string/app_name">
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>

   </application>
   <uses-sdk android:minSdkVersion="7" />

[color="#FF0000"]<uses-permission android:name="RECORD_AUDIO"></uses-permission>[/color]

</manifest>

I probably won't get it working on 1.5 until tomorrow afternoon. It should be possible since I think it has the required API.

As far as how it works. It doesn't start listening for shots until you hit buzz (at which point you get the beep and it starts listening for shots). If you hit end string it stops listening for shots allowing the device to conserve battery power. If you want to shoot another string you just hit buzz again. It is not necessary to hit End String before hitting Buzz. End string is just there to allow it to stop listening and conserve battery power. It throws up the error message when it can't open an audio device for recording and instead uses a fake stream of shots to drive the GUI.

Edited by adweisbe
Link to comment
Share on other sites

I uploaded a 1.0.1 file that is packaged to work with Android 2.0 and up. I tried to do 1.5, but ran in to a few snags that I might be able to address tomorrow. If I don't have the permissions right in the manifest it will probably have to wait until Monday when I can futz with a device.

Edited by adweisbe
Link to comment
Share on other sites

As a quick follow up... I uninstalled the 2.1 version, installed the 2.0 version just because it had a higher version number. Still same issue on a Google phone - no access to the hardware, so it an alternate sound file to playback shots.

looks like you'll need to debug on an actual phone...

Sorry as well, as I don't know what the strings are that you might need in the manifest for this to function.

Alan

Link to comment
Share on other sites

Hi all,

I fixed the permission issue. I was using

<uses-permission android:name="RECORD_AUDIO"></uses-permission>

instead of

<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>

It is now also compatible with Android 1.6 and up. I got it to detect real finger flicks, but it was very picky about the mic volume settings. The app basically expects a square waveform to be a shot so the mic volume has to be high enough that shots come out square but not so sensitive as to make other ambient noise come out square. I talked with Alex Brown and he has some ideas for how to do shot detection so it will improve.

http://openshottimer.googlecode.com/files/open-shot-timer.1.0.3.apk

Edited by adweisbe
Link to comment
Share on other sites

Adweisbe, I appreciate all the hard work you are putting into this app. :cheers: But it still doesnt work with my HTC Eris, which is running 1.5. It's rumored to be upgraded to 2.0 / 2.1 by the end of the month, or sometime in the 1st quarter of 2010 so I am keeping my fingers crossed that I can use your app soon. Do you have any recent screen shots?

Link to comment
Share on other sites

Hi all,

I fixed the permission issue. I was using

<uses-permission android:name="RECORD_AUDIO"></uses-permission>

instead of

<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>

It is now also compatible with Android 1.6 and up. I got it to detect real finger flicks, but it was very picky about the mic volume settings. The app basically expects a square waveform to be a shot so the mic volume has to be high enough that shots come out square but not so sensitive as to make other ambient noise come out square. I talked with Alex Brown and he has some ideas for how to do shot detection so it will improve.

http://openshottimer.googlecode.com/files/open-shot-timer.1.0.3.apk

Yup, that fixed the hardware issue, but now, the sensativity is way to high... where the heck do you turn that down on android? I just get a constant running list of shot times once I click buzz...

Alan

Link to comment
Share on other sites

Chris,

Try this one http://openshottimer.googlecode.com/files/open-shot-timer.1.0.4.apk

It still targets 1.6 but declares 1.5 as the minimum. It can't hurt to see if it runs and I can bypass the Eclipse error by still targeting 1.6.

I posted a screenshot here http://www.brianenos.com/forums/index.php?showtopic=86330&view=findpost&p=1139277

Link to comment
Share on other sites

Chris,

I will clean the UI up once using your suggestion once I get it detecting shots. I dug around and it looks like you can't adjust the mic volume on Android.

If someone could send me a recording, preferably in an uncompressed format of flicking the mic that would be a big help along with some cloth rubbing etc. Right now I can get it to work well on my laptop in a very narrow range of volume settings, but I will have to do something different if the phone doesn't have a volume adjustment.

This app records uncompressed audio. It will be interesting to see what sample rates are supported, because the emulator only supports 8k audio.

http://www.androlib.com/android.application.uk-ac-cam-cl-dtg-android-audionetworking-hertz-qzmC.aspx

I can use that to develop a test case that runs shot detectors against the audio to see if they come up with the right results and then play around till I get one that works.

Link to comment
Share on other sites

Very cool. I'm looking forward to this.

I tried both 1.0.3 and 1.0.4 and they both give me the following when I hit the Buzz! button:

Sorry!

The application Open Shot

Timer (process org.ost) has

stopped unexpectedly. Please

try again.

(Force close)

I'm running a Droid,

firmware version 2.0.1

kernel version 2.6.29-omap1-g0dd7e0b

android-build@apa26 #511

build number ESD56

Thanks for doing this!

Link to comment
Share on other sites

I reproduced the crash on my coworker's phone which is also uses 2.0.1 but I couldn't do it on the emulator even when I downloaded and installed the actual package from Google code. I won't be working on this much until next weekend.

Link to comment
Share on other sites

Apparently the audio is little-endian. Would have been nice of them to document it but apparently that isn't their style.

The shot detector passes the unit tests for the old audio samples I took as well as the test audio I got from a phone.

http://openshottimer.googlecode.com/files/open-shot-timer.1.1.0.apk

Also got a copy of EZWinscore today =)

Edited by adweisbe
Link to comment
Share on other sites

I got 9 splits ..... some at 0.12, some at 0.13, and 1 at 0.05 and then it was fine. The next time I tried it I got 2 splits - 1 at 0.05, and the other at 0.17 then I could use it.

Sounds like it's still too sensitive, as it's picking up it's own buzzers start signal. :unsure: Not sure how you adjust sensitivity in the development mode, but the user should be able to adjust the sensitivity as well.

Otherwise I like it! :) I like how you made the BUZZ button much bigger, which keeps those of us with FFD (fat finger disease) from accidentally hitting the END or QUIT buttons.

Very nice adweisbe! :cheers:

Link to comment
Share on other sites

I played around with the volume settings on my Droid, and it appears to be tied to the ALARM VOLUME, instead of Media or Ringtone volumes. So I turned the volume down about 3 notches (approx -42%), and played around with the Shot Timer, and it works much better, but that still would seem to be a sensitivity issue.

Keep working on it, we all appreciate your efforts!

Link to comment
Share on other sites

Chris,

Are you talking about the volume of the buzzer? That is something I can add a slider for. I can't decide where/how to place the button for the configuration menu. It looks so clean the way it is.

As for it picking up the buzzer as shots. For now I will shorten the buzzer to .75 seconds and have it ignore the first second. If you can draw and shoot faster then that then god bless. The long term solution is to do a fourier transform and filter out.

http://openshottimer.googlecode.com/files/open-shot-timer.1.1.1.apk

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...