Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How do I extend AGK T2 Android

Author
Message
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 24th Jun 2014 06:33
Hi Everybody,

I'm planning on making an app for Android that needs to access the microphone as well as determine the frequency of the input (think Guitar Tuner). Obliviously this isn't possible in AppGameKit T1, but I haven't had a lot of experience with T2, so I wouldn't know how to go about doing it.

So, how do I import/use external API's with AppGameKit [V1] T2 for use in Android?
Also, what API's can do this for me? Would OpenAL do it?
One last thing, I'd really like to be able to use Android Notifications (such as reminding the user to play the game). Can this be done in AppGameKit T2?


Thanks,
EB

\r\nAudacia Games - Latest WIP - AUTOMAYTE 2.1, AppGameKit one click deploy to Android\r\n"When you\'ve finished 90% of your game, you only have 90% left"
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 24th Jun 2014 07:46
Audio capture is included in the Android SDK no extra APIs needed
http://developer.android.com/guide/topics/media/audio-capture.html

this thread talks about java callbacks
http://forum.thegamecreators.com/?m=forum_view&t=211081&b=41&p=0

You'll need to set those up for any methods (java functions) you create in java to be accessible by the C++ code.
This will allow you to call on any java methods you make in the java code. It's messy and complex.

Best of luck! You can do it!

easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 24th Jun 2014 11:56 Edited at: 24th Jun 2014 11:56
Ok, thanks for the links.
I'm not sure I'll actually end up doing it exactly that way though...
I'll need to be able to detect the frequency of the input, and to do that I'll need an external API anyway.

Anyway, I'll keep looking into it and keep this thread posted on my progress.


Is it any easier to use C++ libraries over Java libraries?


Audacia Games - Latest WIP - AUTOMAYTE 2.1, AppGameKit one click deploy to Android
"When you've finished 90% of your game, you only have 90% left"
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 25th Jun 2014 10:19 Edited at: 25th Jun 2014 10:20
Ok, so I've been Googling around, and it looks like I've got a few different options to detect the frequency. The best lib seems to be Kiss FFT, it's an Android FFT lib made in C++ (to be compiled with NDK). This should make integrating it a breeze, shouldn't it???
After that, all I need to do is get the audio input with the callbacks

Can anybody let me know if it actually will be possible to integrate Kiss FFT? I'd rather not spend hours trying to figure it out myself
Some pointers on how to go about doing it would be great as well


Audacia Games - Latest WIP - AUTOMAYTE 2.1, AppGameKit one click deploy to Android
"When you've finished 90% of your game, you only have 90% left"
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 25th Jun 2014 12:09
Actually it's a C library, which can make things easier. It's set up for GCC, but should okay with a few tweaks.

-- Jim - When is there going to be a release?
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 26th Jun 2014 11:10
Ok, I spent a lot of time on it and made absolutely zero progress not only that, but I also learned that FFT isn't enough to detect the frequency, you also need to do a bit more with it.

Looking around for an alternative, I came across a few posiblities:
dywapitchtrack
BASS lib
aubio
These all look quite a bit better as they actually get the pitch, they don't just FFT it.
Of those, it's hard to say which would be best.
dywapitchtrack says it's really really fast and accurate. But it doesn't explicitly say it'll work on android. It's a C lib and it apparently works on iOS. All the main c file includes is <math.h>, <stdlib.h> and <string.h>, so it doesn't appear to be that platform specific
BASS lib [apparently] has a direct command to get the audio stream from the microphone and detect the pitch. I'm not sure if it'll do this on Android though. Android support is via Java, so that would be more complicated than a C++ lib [I assume]
aubio is written in C, works on android and has direct commands for getting the pitch.

Out of these, BASS lib look the best, but has the difficulties on being written in Java.
I just tried it out and surprise surprise! I got it working on Android (standalone, not integrated with AGK) in about 2 minutes
Looks, Like my problems are mostly sorted then, I'll probably use BASS and follow existing tuts on how to integrate existing Java libs with AppGameKit

Sorry about this post, I've been writing it for about an hour, researching things as I write them

I've got a different T2 question though...
How do you close the android app? obviously there's no 'end' command


Audacia Games - Latest WIP - AUTOMAYTE 2.1, AppGameKit one click deploy to Android
"When you've finished 90% of your game, you only have 90% left"
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 26th Jun 2014 11:17
BASS quite expensive to license for commercial products.

If you understand FFTs you can get the probable fundamental - but it gets complex unless the waveform is simple. You need to look for the highest energy points in the FTT output.

-- Jim - When is there going to be a release?

Login to post a reply

Server time is: 2024-11-25 06:25:20
Your offset time is: 2024-11-25 06:25:20