[android-developers] sound recognition and FFT problem
Dear all, I am struggling a lot to get sound recognition working. Essentially I would like to use the microphone and recognize when a specific note has been played (as a guitar tuner). I am trying to use GDX library for FFT: http://code.google.com/p/libgdx/ What is happening is that with the same frequency originated from a signal generator, I don't get always the same results. And most of all I get very different results from my ZTE Orange San Francisco versus a Galaxy mobile (although i suspect the ZTE is the one to blame :-) This is my code. private static final int RECORDER_SAMPLERATE = 44100;; private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_CONFIGURATION_MONO; private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT; When I start the 'record' button I initialise the AudioRecorder and start listening into a separate thread: private AudioRecord recorder = null; recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, RECORDER_SAMPLERATE, RECORDER_CHANNELS,RECORDER_AUDIO_ENCODING, bufferSize); and the listening function follows: int MULTIPLIER = 1; // -- I increase this if I wish to concatenate input buffers coming from microphone short[] data = new short[bufferSize]; float[] fft_cpx; float[] tmpR, tmpI; float[] new_array = new float[bufferSize*MULTIPLIER]; double[] real = new double[bufferSize*MULTIPLIER]; double[] imag = new double[bufferSize*MULTIPLIER]; double[] mag = new double[bufferSize*MULTIPLIER]; Log.i(TAG, Ready to go, buffer size: +bufferSize); //--- it is 4096 when using 44Khz, but at each read only 2048 is retreived fft = new FFT(bufferSize*MULTIPLIER, RECORDER_SAMPLERATE); long t1, t2, t3, deltaT; while (isRecording) { t1 = System.currentTimeMillis(); int index = 0; for (int j=0; jMULTIPLIER; ++j) { int n = recorder.read(data, 0, bufferSize); // -- it reads 2048 = n Log.i(TAG, Data read (j=+j+): +n); for ( int z=0; zn; ++z) { new_array[index] = data[z]; ++index; } } t2 = System.currentTimeMillis(); deltaT = t2-t1; Log.i(TAG, Data read in TIME: +deltaT+ (+t1+,+t2+)); Log.i(TAG, Global index: +index); fft.forward(new_array); fft_cpx = fft.getSpectrum(); // Find Max and Max position in CPX tmpR = fft.getRealPart(); tmpI = fft.getImaginaryPart(); arrDet.peakValue = 0; //arrDet is a dummy structure where I store peak value and position for (int i = 0; i new_array.length; i++) { real[i] = (double) tmpR[i]; imag[i] = (double) tmpI[i]; mag[i] = Math.sqrt((real[i] * real[i]) + (imag[i] * imag[i])); if ( mag[i] arrDet.peakValue ) { arrDet.peakValue = mag[i]; arrDet.position = i; } } int FrequencyN = 0; if ( new_array.length!= 0 ) FrequencyN = RECORDER_SAMPLERATE * arrDet.position / new_array.length; //bufferSize; int FrequencyBS = RECORDER_SAMPLERATE * arrDet.position / bufferSize; Log.i(TAG, @ F(N)is: + FrequencyN + \tF (BS)is: +FrequencyBS + \tpos: +arrDet.position ); } Results: For example, if I get: INPUT FREQUENCY = 1000 Log: Frequency (N) is 8010 @ 744 // -- position Or INPUT FREQUENCY = 1000 Log: Frequency (N) is 3003 @ 279 // -- position Or INPUT FREQUENCY = 1000 Log: Frequency (N) is 6007 @ 558 // -- position QUESTIONS: 1) any idea about what I am doing silly? 2) is it enough to read from the microphone only once? Or should I rather concatenate buffers? I am not noticing any more stability to be honest... thanks for any help! Mik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: sound recognition and FFT problem
PS: as signal generator I am using this one: http://www.gwinstek.com.tw/en/product/productdetail.aspx?pid=5mid=73id=105 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Bluetooth Low Energy (BLE) - bluetooth 4.0 support
Dear all, I am looking forward the time when we could connect our android devices towards devices supporting BLE. Obviously I expect that android devices will support Dual profile (capability to connect via bluetooth towards old devices and towards Bluetooth low energy devices). If I understood correctly Android 4.0 platform should be able to handle the Bluetooth Health Device Profile is that bluetooth 4.0? Does anyone know if there is any existing device supporting BLE? Motorola Razr seems to be supporting Bluetooth 4.0 according to theirs specs, but it runs Android 2.3 Did anyone had any experience with this technology? Any clarification to my confused mind is highly appreciated. Thanks, Mik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] ERROR: cannot recover key (Eclipse)
Dear all, Disclaimer: I am not sure this is an ADT/Android tools problem or rather an eclipse one. I went back to my old android app after several months. I had stored the key and alias on a svn server, so that even if corrupted I can always recover them. I have tried now to export a signed version of the same application from Eclipse, as I always did before. It didn't work the first 7-8 times, than it did. After that, it did not work again and it is driving me crazy! If you have any idea please suggest. Few hints: 1. I am sure about the password(s) 2. I am sure about CapsLock 3. I restarted eclipse N times with same results, and ubuntu (hosting system) as well 4. I do not have any other project open in the work space Error message: ERROR: cannot recover key It follows the eclipse .metadata/.log file. Thanks for any suggestion, Mik !SESSION 2011-10-06 07:27:16.498 --- eclipse.buildId=M20100211-1343 java.version=1.6.0_22 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_GB Command-line arguments: -os linux -ws gtk -arch x86 !ENTRY org.eclipse.jface 2 0 2011-10-06 07:27:20.484 !MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation. !SUBENTRY 1 org.eclipse.jface 2 0 2011-10-06 07:27:20.484 !MESSAGE A conflict occurred for ALT+CTRL+I: Binding(ALT+CTRL+I, ParameterizedCommand(Command(org.eclipse.egit.ui.team.Ignore,Ignore, , Category(org.eclipse.egit.ui.commandCategory,Git,null,true), ActionDelegateHandlerProxy(null,org.eclipse.egit.ui.internal.actions.IgnoreAction), ,,true),null), org.eclipse.ui.defaultAcceleratorConfiguration, org.eclipse.ui.contexts.window,,,system) Binding(ALT+CTRL+I, ParameterizedCommand(Command(org.eclipse.team.svn.ui.command.AddToSVNIgnoreCommand,Add to svn:ignore..., , Category(org.eclipse.team.svn.ui.command.category,SVN,null,true), ActionDelegateHandlerProxy(null,org.eclipse.team.svn.ui.action.local.AddToSVNIgnoreAction), ,,true),null), org.eclipse.ui.defaultAcceleratorConfiguration, org.eclipse.ui.contexts.window,,,system) !SUBENTRY 1 org.eclipse.jface 2 0 2011-10-06 07:27:20.484 !MESSAGE A conflict occurred for ALT+CTRL+C: Binding(ALT+CTRL+C, ParameterizedCommand(Command(org.eclipse.egit.ui.team.Commit,Commit, , Category(org.eclipse.egit.ui.commandCategory,Git,null,true), ActionDelegateHandlerProxy(null,org.eclipse.egit.ui.internal.actions.CommitAction), ,,true),null), org.eclipse.ui.defaultAcceleratorConfiguration, org.eclipse.ui.contexts.window,,,system) Binding(ALT+CTRL+C, ParameterizedCommand(Command(org.eclipse.team.svn.ui.command.CommitCommand,Commit..., , Category(org.eclipse.team.svn.ui.command.category,SVN,null,true), ActionDelegateHandlerProxy(null,org.eclipse.team.svn.ui.action.local.CommitAction), ,,true),null), org.eclipse.ui.defaultAcceleratorConfiguration, org.eclipse.ui.contexts.window,,,system) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Newbie Question for phone and tablet apps
If the app should provide the same functionality for both platforms I'd say go for doing one app for both and just tweak the interface to adapt to different screen sizes. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: app doesn't install anymore!
I am starting the app from the view where all the other applications are placed, whatever is called. And even if it displays the icon, it says that the application is not installed. Then if I go in : Settings - Application settings - manage applications my app appears there as installed. Honestly I think we are chasing the problem in the wrong path: even installing from SD card it is perfectly fine, indeed that was the only option I had when I purchased the mobile phone, as it was sim locked with developer options disabled. Then I unlock it and changed OS version (now running 2.2) and I can do the installation in the way you suggest and mostly important the device debugging. But the reason for which the application starts while debugging from eclipse and doesn't when installed is still a mystery. I wonder if it is due to the signature somehow, but again I am using same key + password + alias than before and the error message should be different. Thanks anyway! On Jan 26, 11:25 pm, TreKing treking...@gmail.com wrote: On Wed, Jan 26, 2011 at 5:07 PM, Mik mam.marche...@gmail.com wrote: But then when I try to run it from the GUI menu a toast message tells me: Application is not installed in your phone What GUI Menu? Are you starting it from the Launcher or the home screen? --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: app doesn't install anymore!
SOLVED ! For some reasons I had in my manifest TWICE the tag: activity android:name=.myActivity (It is mostly due to writing code late night...) TreKing: thanks for your help. To learn about the device debugging was surely worthy. Mik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: app doesn't install anymore!
This is very annoying... when debugging on device it works perfectly. So I uninstalled, then I signed the file using eclipse (as always) and then I transfered it into SD card to install it. And again, it appears to install but then when I try to execute it it won't, claiming that it is not installed. I don't understand what is happening. Has anyone seen this? Michele -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: app doesn't install anymore!
I am not sure, I always have done it in this way What is the recommended way? I have got today working for the first time the debugger on device so I wouldn't be surprised if there is a more convenient way to install a signed app On Jan 26, 10:32 pm, Mik mam.marche...@gmail.com wrote: This is very annoying... when debugging on device it works perfectly. So I uninstalled, then I signed the file using eclipse (as always) and then I transfered it into SD card to install it. And again, it appears to install but then when I try to execute it it won't, claiming that it is not installed. I don't understand what is happening. Has anyone seen this? Michele -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: app doesn't install anymore!
unfortunately it didn't work: same result then when installing from SD card: $ sudo platform-tools/adb install /home/mik/workspace/signed/ myapp.apk 1669 KB/s (1453881 bytes in 0.850s) pkg: /data/local/tmp/myapp.apk Success But then when I try to run it from the GUI menu a toast message tells me: Application is not installed in your phone While from Manage Applications menu, I can still see it... Thanks for your help by the way! Mik On Jan 26, 10:41 pm, TreKing treking...@gmail.com wrote: On Wed, Jan 26, 2011 at 4:39 PM, Mik mam.marche...@gmail.com wrote: I wouldn't be surprised if there is a more convenient way to install a signed app adb -d install path to app Of course, uninstalling the previous version that was debug-key-signed. --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] app doesn't install anymore!
Hi guys, I'm confused about the behavior of the new version of my simple app. First two versions were ok, now I've done some changes, I've created using Eclipse a signed file (as before) and when I try to install it on my device (from SD card) it first says: Application installed. Then I try to open it (from installer) and it says: The application package installer (process com.android.packageinstaller) has stopped unexpectedly. Please try again. While if I try to launch it from the main menu it says: application not installed on your phone If I try to install the previous signed version, it still works... I am really confused and blind from the solution... Any idea please? Mik PS: what do you use to read log from device? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: app doesn't install anymore!
On Jan 25, 11:45 pm, TreKing treking...@gmail.com wrote: On Tue, Jan 25, 2011 at 5:42 PM, Mik mam.marche...@gmail.com wrote: Any idea please? Debug your app. Forgot to mention that it works perfectly on the emulator... PS: what do you use to read log from device? The debugger. Or DDMS. Or a LogCat app. I assume you mean on device debugging? I didn't know it was possible (I am a beginner). Thanks I'll search how to do it -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: AdSense for Android: is it available in Europe?
On Jan 18, 6:52 pm, ko5tik kpriblo...@yahoo.com wrote: It is available but not for everybody - you have to meet certain criteria (amount of traffic) to be accepted Ah! Ok thanks. So I guess the solution for developers who are just starting is admob... Mik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] AdSense for Android: is it available in Europe?
Dear all, I am missing something here: when I run apps in my device I see many ads by google. I am using Admob so far but I wish to try something else. I've tried to use AdSense but I didn't manage to find a place from where to download the adsense JAR file. Isn't adSense available in Europe? Thanks, Mik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] No audio in emulator (ubuntu 10.10)
Dear all, I cannot manage to play audio in the android emulator 2.2. I am using ubuntu 10.10. I've tried to launch the emulator with the following audio options (and I tried to use root privileges as well): -audio oss - I get a warning for audio not supported, fair enough -audio esd -audio alsa Nothing happens with the latest two: emulator starts and runs ok, but no audio of any sort is played and even if I try the -verbose mode I don't see any error in the shell. Is this due to ubuntu 10.10 using pulseaudio? Does anyone have any clue? Thanks, Mik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] How does Android decide if an Activity should be restarted after the Activity crashes?
Hello, we are developing an application where we are depending on a native, custom-written library which sometimes crashes. When the Activity crashes (it's the Activity's SurfaceView that crashes, either while resuming or pausing Activity) we would like to automatically restart the Activity that was just running, preferably without seeing the idle screen in between. What we find strange is that sometimes, our Activity is restarted by Android automatically after the crash, and sometimes not. How does Android decide this? Is it somehow dependant on exactly what the Activity was doing at the time of the crash and if that was considered important enough to restart? How can we force a restart to make sure the Activity doesn't quit after a crash? Some notes: Running on device flashed with Android 1.5. The Activity is running as singleInstance. Doesn't seem to make much difference which mode it is though. Other methods we have tried are: 1) Since we can predict when crash is going to happen(but not stop it), use AlamrManager to start the Activity again via an Intent, 3 seconds later. Has the disadvantages that 1) need to be able to predict crash 2) if crash takes longer than 3 seconds (normally about 2s) it won't work 3) Idle screen is seen for about ~1 s, since some slack is needed. 2) Start a Service, then let the Service (which always seems to be restarted by Android after crashing) start the Activity in its onStart method. Has the disadvantage that Android doesn't restart the service until 5 seconds after the crash, so the idle screen is seen quite along time before Activity restarts. Is it possible to modify how long it takes before the Service is restarted by the Android system? Any help would be greatly appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Cannot View Images from SD Card Image on Emulator
Hello all, I have just started learning to develop for the G1 after two weeks of joyful us of my actual G1. I have however, come across a stumbling block in my development learning. I have successfully emulated an SD Card on the emulator. However, now, after saving an image from the browser to the phone I cannot 'View Picture' or 'Crop Picture' for a wallpaper. All I get when trying to access the picture is an error message saying: The application Camera (process com.android.camera) has stopped automatically. Please try again. Does anyone know why this is or how to get around/fix it? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---