Re: [android-developers] Re: AudioRecord.getMinBufferSize hangs on KitKat

2013-11-10 Thread skooter500
Update:

Sometimes the call to:

AudioRecord.getMinBufferSize(22050, AudioFormat.CHANNEL_CONFIGURATION_MONO, 
AudioFormat.ENCODING_PCM_16BIT);

will succeed only to hang when you go to create the AudioRecord object:

new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, 
AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, 
totalBytes);

Subsequently Shazam wont work and Google Now voice recording stops 
working...

Bryan

On Sunday, 10 November 2013 14:06:31 UTC, Paul-Peter Tournaris wrote:
>
> Maybe the new way that Nexus 5 uses to tunnel the Audio causes this 
> problem!
>
>
> On Sun, Nov 10, 2013 at 2:54 PM, skooter500 
> > wrote:
>
>> Follow up... All audio record API's cause this!
>>
>> For example, this call also hangs:
>>
>> audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, 
>> AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, 
>> totalBytes);
>>
>> Is there something special Im supposed to do on Android 4.4??
>>
>> Bryan
>>
>> On Sunday, 10 November 2013 12:19:41 UTC, skooter500 wrote:
>>>
>>> Hi 
>>>
>>> My Nexus 5 arrived today, however I have noticed a bug that causes my 
>>> app (Tunepal) to hang. It is very simple to reproduce. Just call:
>>>
>>> AudioRecord.getMinBufferSize(22050, AudioFormat.CHANNEL_CONFIGURATION_MONO, 
>>> AudioFormat.ENCODING_PCM_16BIT);
>>>
>>> Changing the sample ate has no effect either
>>>
>>> What the hell Google?! Dont you test stuff before you release it?
>>>
>>> Here is the full code for a simple app to reproduce this:
>>>
>>> https://github.com/skooter500/MinBufferSizeBug
>>>
>>> BTW This code does not cause a hang on my Galaxy Nexus, Nexus 7, HTC 
>>> Desire, HTC Desire HD etc etc.
>>>
>>> I'm investigating a workaround
>>>
>>> Bryan
>>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to 
>> android-d...@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
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Android Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to android-developers+unsubscr...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> *Παύλος-Πέτρος Τουρνάρης*
> *Android  & Software Developer*
>
>- *http://goo.gl/TsJ8u <http://goo.gl/TsJ8u>*
>- *http://acschedule.org <http://acschedule.org>*
>
> 

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [android-developers] Re: AudioRecord.getMinBufferSize hangs on KitKat

2013-11-10 Thread skooter500
Update:

Shazam also hangs... Google Now hangs the device intermittently and wont 
record...

Bryan

On Sunday, 10 November 2013 14:06:31 UTC, Paul-Peter Tournaris wrote:
>
> Maybe the new way that Nexus 5 uses to tunnel the Audio causes this 
> problem!
>
>
> On Sun, Nov 10, 2013 at 2:54 PM, skooter500 
> > wrote:
>
>> Follow up... All audio record API's cause this!
>>
>> For example, this call also hangs:
>>
>> audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, 
>> AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, 
>> totalBytes);
>>
>> Is there something special Im supposed to do on Android 4.4??
>>
>> Bryan
>>
>> On Sunday, 10 November 2013 12:19:41 UTC, skooter500 wrote:
>>>
>>> Hi 
>>>
>>> My Nexus 5 arrived today, however I have noticed a bug that causes my 
>>> app (Tunepal) to hang. It is very simple to reproduce. Just call:
>>>
>>> AudioRecord.getMinBufferSize(22050, AudioFormat.CHANNEL_CONFIGURATION_MONO, 
>>> AudioFormat.ENCODING_PCM_16BIT);
>>>
>>> Changing the sample ate has no effect either
>>>
>>> What the hell Google?! Dont you test stuff before you release it?
>>>
>>> Here is the full code for a simple app to reproduce this:
>>>
>>> https://github.com/skooter500/MinBufferSizeBug
>>>
>>> BTW This code does not cause a hang on my Galaxy Nexus, Nexus 7, HTC 
>>> Desire, HTC Desire HD etc etc.
>>>
>>> I'm investigating a workaround
>>>
>>> Bryan
>>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to 
>> android-d...@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
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Android Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to android-developers+unsubscr...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> *Παύλος-Πέτρος Τουρνάρης*
> *Android  & Software Developer*
>
>- *http://goo.gl/TsJ8u <http://goo.gl/TsJ8u>*
>- *http://acschedule.org <http://acschedule.org>*
>
> 

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] Re: AudioRecord.getMinBufferSize hangs on KitKat

2013-11-10 Thread skooter500
Follow up... All audio record API's cause this!

For example, this call also hangs:

audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, 
AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, 
totalBytes);

Is there something special Im supposed to do on Android 4.4??

Bryan

On Sunday, 10 November 2013 12:19:41 UTC, skooter500 wrote:
>
> Hi 
>
> My Nexus 5 arrived today, however I have noticed a bug that causes my app 
> (Tunepal) to hang. It is very simple to reproduce. Just call:
>
> AudioRecord.getMinBufferSize(22050, 
> AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT);
>
> Changing the sample ate has no effect either
>
> What the hell Google?! Dont you test stuff before you release it?
>
> Here is the full code for a simple app to reproduce this:
>
> https://github.com/skooter500/MinBufferSizeBug
>
> BTW This code does not cause a hang on my Galaxy Nexus, Nexus 7, HTC 
> Desire, HTC Desire HD etc etc.
>
> I'm investigating a workaround
>
> Bryan
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] AudioRecord.getMinBufferSize hangs on KitKat

2013-11-10 Thread skooter500
Hi 

My Nexus 5 arrived today, however I have noticed a bug that causes my app 
(Tunepal) to hang. It is very simple to reproduce. Just call:

AudioRecord.getMinBufferSize(22050, AudioFormat.CHANNEL_CONFIGURATION_MONO, 
AudioFormat.ENCODING_PCM_16BIT);

Changing the sample ate has no effect either

What the hell Google?! Dont you test stuff before you release it?

Here is the full code for a simple app to reproduce this:

https://github.com/skooter500/MinBufferSizeBug

BTW This code does not cause a hang on my Galaxy Nexus, Nexus 7, HTC 
Desire, HTC Desire HD etc etc.

I'm investigating a workaround

Bryan

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] Any problem with the HTC Inspire??

2011-03-02 Thread skooter500
Hi Guys

Ive tested the hell out of my app, Tunepal on many different devices
and its sold about 1000 copies. Ive tested it successfully on
everything from a Samsung Galaxy Europa up to a HTC Desire HD and no
problems so far.

Over the last couple of days however I've been receiving reports from
owners of the HTC Inspire to say that the app crashes on startup. Ive
gotten users to submit crash reports and this is what shows up:

java.lang.RuntimeException: Unable to start activity
ComponentInfo{org.tunepal/org.tunepal.Tunepal}:
java.lang.RuntimeException: Unable to start activity
ComponentInfo{org.tunepal/org.tunepal.MyTunesActivity}:
android.database.sqlite.SQLiteException: no such table: tuneindex: ,
while compiling: SELECT * FROM tuneindex
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2833)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2854)
at android.app.ActivityThread.access$2300(ActivityThread.java:136)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
2179)
at android.os.Handler.dispatchMessage(Handler.java:99)
...
...
...

Basically I have a sqlite database that ships with the app thats
prepopulated. This has been working successfully on devices for the
past year, however on the HTC Inspire I get the exception

Apparently you cant install non-makret apps on these devices (so one
of my users told me anyway), so I cant even send them versions of my
app to test different things.

Just wondering if there is anything strange/wierd about these devices?
Anyone else having problems running their apps on the HTC Inspire?

Bryan

-- 
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: Problem with AudioRecord on Samsung Moment

2010-09-27 Thread skooter500
You might also have a look at this thread:

http://groups.google.com/group/android-developers/browse_thread/thread/a37d61d2135a924/4efd4f33fb6937ab?q=record+problem+LG+Ally#4efd4f33fb6937ab

Which explains a way to record audio on mayn devices including the LG
Ally

Bryan

On Sep 26, 8:05 pm, dan raaka  wrote:
> you should first check if the particular combination is supported or NOT.
>
> Raun "AudioCaps" on this device build and see if the issue causing
> samplerate/encoding combination is supported or NOT.
>
> -Dan
>
> On Sun, Sep 26, 2010 at 2:29 AM, Omer Gilad  wrote:
> > Samsung devices (all of them) have many bugs related to audio API.
> > In our application we've handled this by applying specific solutions
> > to known device models - you will have to investigate and find
> > workarounds for that.
>
> > On Sep 26, 4:05 am, Steve Hugg  wrote:
> > > We have been getting reports of audio recording not working on Samsung
> > > Moment phones on 2.1-update1.
>
> > >  int bufferSize = AudioRecord.getMinBufferSize(sampleRate,
> > > AudioFormat.CHANNEL_IN_MONO,
> > >                                 AudioFormat.ENCODING_PCM_16BIT);
> > >  this.audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
> > > sampleRate,
> > >                                 AudioFormat.CHANNEL_IN_MONO,
> > > AudioFormat.ENCODING_PCM_16BIT, bufferSize);
>
> > > generates these logs:
>
> > > I/AudioPolicyManager( 1889): getInput() inputSource 1, samplingRate
> > > 16000, format 1, channels 10, acoustics 0
> > > W/AudioHardwareALSA( 1889): openInputStream : mInput already exists!!
> > > E/AudioRecord( 2618): Could not get audio input for record source 1
> > > E/AudioRecord-JNI( 2618): Error creating AudioRecord instance:
> > > initialization check failed.
> > > E/AudioRecord-Java( 2618): [ android.media.AudioRecord ] Error code
> > > -20 when initializing native AudioRecord object.
>
> > > I can't find the "mInput already exists" anywhere in the source base,
> > > could this perhaps be an error message included by the OEM?
>
> > > 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
>
>

-- 
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: New countries for paid apps! Maybe Ireland will be included??

2010-09-27 Thread skooter500
Yea all sounds good!

Here's hoping

Bryan

On Sep 25, 7:40 pm, Brad Gies  wrote:
> Yeah.. I got it alsobut I really hope they are doing something to
> reduce the impact of "Spam Apps" at the same time.
>
> My very simple idea to reduce the impact "Spam Apps" have on the market
> would be to only allow an app to show up in the "Just In" category 3
> times a year, and never less than 2 months apart. That should be enough
> for legit developers, and "Spam Apps" would very quickly stop dominating
> the "Just In" list.
>
> I'm betting I could program that logic and implement it on my site in
> slightly less than an hour.
>
> And if the market really wanted to do more than an hour's worth of
> programming... say... two hours of programming... they could add one
> more entry a year for apps that have over 5,000 downloads and a better
> than 3.5 average rating, and give the developer the choice when he/she
> uploads a new version whether they want to use one of their "Just In"
> appearances or save that for a later version.
>
> Ok... we're up to 2 hours programming now :).
>
> Then... for any developer that has more than 10 apps they could reduce
> the number of "Just In" per app to 2 a year.
>
> Wow now 2 1/2 hours of programming Hope Google has allocated
> enough programming resources to the market for this :).
>
> I'm sure with a couple of days worth of programming allotment a much
> better solution could be devised but this would be fairly effective
> for a couple of hours :).
>
> Your thoughts?
>
> Sincerely,
>
> Brad Gies
> ---
> Bistro Bot - Bistro 
> Blurbhttp://bgies.comhttp://bistroblurb.comhttp://ihottonight.comhttp://forcethetruth.com
> ---
>
> Everything in moderation, including abstinence
>
> Never doubt that a small group of thoughtful, committed people can
> change the world. Indeed. It is the only thing that ever has - Margaret Mead
>
> On 25/09/2010 11:12 AM, skooter500 wrote:
>
> > I received this from Google yesterday:
>
> > Hello,
>
> > We're writing to inform you about some changes to Android Market that
> > require your attention.
>
> > Over the next few weeks, we ll be adding paid apps support for
> > additional countries.  If you have selected to publish your paid apps
> > to all locations and intend to support all new locations as we expand
> > the number of supported countries for paid apps, you don t have to do
> > anything.  If you have selected to publish your paid apps to all
> > locations but intend to only target the currently supported 14
> > countries, please update your location selections to target these
> > specific countries.
>
> > Please look for follow-up emails when we introduce paid apps support
> > for specific additional countries in the coming weeks.  At that time,
> > you ll have the option to target these specific countries.
>
> > Thanks, and we look forward to continue working with you on Android
> > Market.
>
> > Sincerely,
> > The Android Market Team
>
> > It seems at last Google are adding new coutries for paid apps! This is
> > pretty exciting news. I wonder what countries will be supported?

-- 
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] New countries for paid apps! Maybe Ireland will be included??

2010-09-25 Thread skooter500
I received this from Google yesterday:

Hello,

We're writing to inform you about some changes to Android Market that
require your attention.

Over the next few weeks, we’ll be adding paid apps support for
additional countries.  If you have selected to publish your paid apps
to all locations and intend to support all new locations as we expand
the number of supported countries for paid apps, you don’t have to do
anything.  If you have selected to publish your paid apps to all
locations but intend to only target the currently supported 14
countries, please update your location selections to target these
specific countries.

Please look for follow-up emails when we introduce paid apps support
for specific additional countries in the coming weeks.  At that time,
you’ll have the option to target these specific countries.

Thanks, and we look forward to continue working with you on Android
Market.

Sincerely,
The Android Market Team

It seems at last Google are adding new coutries for paid apps! This is
pretty exciting news. I wonder what countries will be supported?

-- 
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: Record audio problem on the LG Ally

2010-08-13 Thread skooter500
Jeff

I did some benchmarking first. I have versions of my algorithms in
both C++ and Java. I sample at 22KHz for 12 seconds and perform an
SFTF on 2048 sample frames with a 75% overlap in order to transcribe
what the user has played on their instrument. I do some other stuff on
the spectrum to figure out the F0 and I have a mechanism for filtering
out some of the transcribed notes that I've described in my papers:

http://www.comp.dit.ie/bduggan/research.php

C++ code to do this on the iPhone 3G takes about 12 seconds to do the
DSP. This is about 50% faster on an iPhone 4G
100% Java code to do the identical task on a 1Ghz HTC Desire takes
minutes (running Android 2.1). I dont have the exact numbers, but
basically not practical. The same code running on WIndows 7, JDK takes
a few seconds.
The identical C++ implementation I use on the iPhone I call on Android
using the Android NDK and it only takes a few secomds

Conclusion - Android Java on 2.1 is slow for maths intensive code. DSP
in Java on Android 2.1 or less is not practical. It has to be done in
native code. Thats why Im a bit reluctant to consider a Win Phone 7
version of my app - no native code.

Hope that helps!

Bryan

On Aug 12, 4:04 pm, Jeff Knaggs  wrote:
> I'm curious, you do a copy with C++; did you do this because you
> assumed/thought you needed the extra speed boost?  I.e., not because
> you're then going to use a bunch of other (already written ;-) C++ to
> process the data).  If the answer is YES -- "for speed," did you do
> any benchmarking to see if this was truly an issue? And, if YES, would
> you be willing to share the benchmarking data?
>
> On another note, would you mind if I emailed you directly on some
> question related to audio but unrelated to this thread?  If you decide
> that topic is worthy of being posted/shared in this group, we can move
> it over.
>
> thanks
> jeff knaggs

-- 
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: Record audio problem on the LG Ally

2010-08-11 Thread skooter500
I solved it I am pleased to report and my app now works on all Android
phones Nexus One's LG's, HTC etc:

At last I can answer a question on this forum instead of just posting
them :-) The solution it seems is to request chunks of data from the
record device of size minBufferSize which you get using this code:

static
{
minBufferSize = AudioRecord.getMinBufferSize(sampleRate,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT);
buffer = new byte[minBufferSize];
}

If there isnt minBufferSize bytes left, then you have to request the
amount thats left to read. See how I calculate toRead below.
bufferReadResult will return exactly how many bytes were read and this
is what you use to advance your global buffer counter.  Interestingly,
minBufferSize varies quite a bit on the phones I have tested. I copy
the 16 bit PCM audio data into an array of floats as I perform DSP on
the buffer at a later stage (in C++). If anyone is interested in how I
do this let me know and I'd be happy to explain. Here is the full code
for my Record AyncTask class. If anything is not clear, let me know:

package org.tunepal;

import android.app.AlertDialog;
import android.media.AudioRecord;
import android.os.AsyncTask;
import android.media.*;

/**
 *
 * @author Bryan Duggan
 */
public class Recorder extends AsyncTask
{

static int sampleRate = 22050;
static int recordTime = 12;
static int numSamples = sampleRate * recordTime;

public static float[] signal = new float[numSamples];

static int minBufferSize;
public static byte[] buffer;

static
{
minBufferSize = AudioRecord.getMinBufferSize(sampleRate,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT);
buffer = new byte[minBufferSize];
}

String message;
boolean error = false;

AudioRecord audioRecord = null;
private RecordActivity context = null;



/**
 * @return the recordActivity
 */
public RecordActivity getRecordActivity()
{
return context;
}

/**
 * @param recordActivity the recordActivity to set
 */
public void setRecordActivity(RecordActivity recordActivity)
{
this.context = recordActivity;
}

public Recorder(RecordActivity recordActivity)
{
this.context = recordActivity;
}

@Override
protected void onPostExecute(Void arg)
{
context.progress.setProgress(0);
context.imgRecord.setImageResource(R.drawable.micro_off);
context.txtStatus.setText("");
if (!error)
{
context.finishedRecording();
}
else
{
AlertDialog.Builder builder = new
AlertDialog.Builder(context);
builder.setTitle("Tunepal");
builder.setMessage(message);
builder.setPositiveButton("Ok", null);
builder.setCancelable(true);
builder.show();
}
}

@Override
protected void onPreExecute()
{
context.imgRecord.setImageResource(R.drawable.micro_no);
context.progress.setProgress(0);
context.progress.setMax(sampleRate * recordTime * 2);
context.txtStatus.setText("");


}

@Override
protected void onCancelled()
{
context.progress.setProgress(0);
context.imgRecord.setImageResource(R.drawable.micro_off);
context.txtStatus.setText("");
doneRecording();
}

public synchronized void doneRecording()
{
if (audioRecord != null)
{
try
{
audioRecord.stop();
} catch (IllegalStateException e)
{
System.out.println("ALREADY STOPPED");
}
audioRecord.release();
audioRecord = null;
}
}

 protected void onProgressUpdate(Integer... progress) {
 context.progress.setProgress(progress[0].intValue());
 }

@Override
protected Void doInBackground(Void... arg0)
{
try
{
System.out.println("Recording started");

audioRecord = null;
System.gc();
int totalBytes = sampleRate * recordTime * 2;
audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
Config.getInt("SAMPLE_RATE"), AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, totalBytes);
audioRecord.startRecording();

int startAt = 0;
error = false;
// read in blocks
while (startAt < totalBytes)
{
int toRead = 0;
if (startAt + minBufferSize >= totalBytes)
{
toRead = totalBytes - startAt;
}
else
{
toRead = minBufferSize;
}
int bufferReadResult = audioRecord.read(buffer, 0,
toRead);
if (bufferReadResult ==
AudioRecord.ERROR_INVALID_OPERATION)
{
message = "Sorry! T

[android-developers] Re: Record audio problem on the LG Ally

2010-08-02 Thread skooter500
Giampaolo

Thanks for yoru reply, but that's definitely not the problem. In fact
what you suggest is what I already do. doInBackground is only called
once and System.gc gets called once before the recording starts. The
call audioRecord.read blocks until the appropriate number of bytes is
read. Ive tried this as an alternative:

buffer = new byte[bufferSize];
int startAt = 0;

int minBufferSize =
AudioRecord.getMinBufferSize(sampleRate,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT);
audioRecord = new
AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, bufferSize);
audioRecord.startRecording();

int bufferReadResult = 0;
while (startAt < bufferSize)
{

int toRead = 0;
if (startAt + minBufferSize >= bufferSize)
{
toRead = bufferSize - startAt;
}
else
{
toRead = minBufferSize;
}
System.out.println("Starting at " + startAt + "
reading " + toRead + " bytes");

bufferReadResult = audioRecord.read(buffer, startAt,
toRead);
System.out.println("Read " + bufferReadResult + "
bytes");
if (bufferReadResult ==
AudioRecord.ERROR_INVALID_OPERATION)
{
message = "ERROR_INVALID_OPERATION returned";
error = true;
break;
}
if (bufferReadResult == AudioRecord.ERROR_BAD_VALUE)
{
message = "ERROR_BAD_VALUE returned";
error = true;
break;
}
if (bufferReadResult != toRead)
{
message = "Requested " + toRead + " bytes but read
" + bufferReadResult + " bytes";
error = true;
}
startAt += bufferReadResult;
}

This works fine (as does the previous code) on my HTC desire. I'm
waiting for some feedback from my Lg Ally user to let me know if it
works on his phone. If so, problem solved. If not, I'll remove the
lines:

if (bufferReadResult != toRead)
{
message = "Requested " + toRead + " bytes but read
" + bufferReadResult + " bytes";
error = true;
}

And see if that works. Not all Android phones work the same it would
appear.

Bryan




On Jul 31, 7:47 pm, "Giampaolo Tomassoni" 
wrote:
> > protected Void doInBackground(Void... arg0)
> >     {
> >         System.out.println("Recording started");
> >         audioRecord = null;
> >         System.gc();
> >         int totalBytes = bufferSize;
> >         try
> >         {
> >             buffer = new byte[bufferSize];
>
> I'm not an Android expert, nevertheless I have the feeling that the problem
> is in the System.gc() -> new byte[bufferSize] sequence, which seems to me is
> invoked at every sample cycle.
>
> In many VM, System.gc() may be a performance killer. It may be this applies
> to theLGAlly, too.
>
> If this is the case, the duration of your sampling cycle may be too long to
> sustain the sampling rate, such that the device's hardware buffer gets
> overrun. Then, you're always fetching the maximum size of it, which in case
> of theLGAllycould even be 1024 bytes. If your sampling cycle is long
> enough, you can experience this effect regardless of the sampling rate you
> use.
>
> Instead of a "System.gc()" followed by a "new byte[]", I would instead
> suggest to pre-allocate the byte array and possibly every other memory
> resource you need to perform your task.
>
> Giampaolo

-- 
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: Android Market Licensing: Now Available!

2010-07-31 Thread skooter500
This sounds great, but is completely useless to me as Im in Ireland
and no paid apps available to my potential users, so I've gone ahead
and made my own user registration and payment system based around
PayPal. A complete waste of my time, but what can ya do?

>From Reto Meier:

"Unfortunately I can't give you a time-frame for paid app buyer or
seller support for Ireland either. The team working on that side of
things have a lot on their plates so getting even a rough estimate for
any specific country is near impossible."

Interesting that Apple, Microsoft, Paypal, Nokia etc can manage this
but Google can't even give me date when it might be available. Not
very professional. :-(

Bryan

On Jul 27, 7:39 pm, Anton Persson  wrote:
> That, and the ability for folks to actually access the paid-for apps...
>
> Sweden, like probably many countries still, have no access to the paid
> apps... When will Google understand that this is critical for them to keep
> the momentum? If the status quo persists, people we give up, pack their bags
> and spend their money on iFruits instead...
>
>     Regards
>        Anton
>
> On Tue, Jul 27, 2010 at 8:25 PM, Maps.Huge.Info (Maps API Guru) <
>
> cor...@gmail.com> wrote:
> > Excellent! Now all we need is a subscription payment model and we can
> > actually make some money!
>
> > -John Coryat
>
> > --
> > 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
>
>

-- 
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] Record audio problem on the LG Ally

2010-07-31 Thread skooter500
Hi guys

I have a music recognition app (Tunepal) that records 12 seconds of
audio @ 22KHz (in one second chunks). After each second, the audio is
copied from a byte array into a float array and eventually I perform
some DSP on the float array.

My app is available on the Android Marketplace and is selling ok. I
have tested it on lots of different phones, such as the HTC Desire/
Hero/Motorola Droid etc and everything is fine.

One of my users has an Lg Ally (running Android 2.1 I believe) and the
recording is not working. In fact it's crashing the app. I have
developed a test program that just records some audio and I think I
have isolated the problem. The test program records audio of various
durations and sample rates and then plays it back. This is the crucial
bit of code:

protected Void doInBackground(Void... arg0)
{
System.out.println("Recording started");
audioRecord = null;
System.gc();
int totalBytes = bufferSize;
try
{
buffer = new byte[bufferSize];
audioRecord = new
AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, totalBytes);
audioRecord.startRecording();

int bufferReadResult = audioRecord.read(buffer, 0,
bufferSize);
if (bufferReadResult ==
AudioRecord.ERROR_INVALID_OPERATION)
{
message = "ERROR_INVALID_OPERATION returned";
error = true;
}
if (bufferReadResult == AudioRecord.  ERROR_BAD_VALUE)
{
message = "ERROR_BAD_VALUE returned";
error = true;
}
if (bufferReadResult != bufferSize)
{
message = "Requested " + bufferSize + " bytes but read
" + bufferReadResult + " bytes";
error = true;
}
}
catch (Exception e)
{
message = e.getMessage();
error = true;
}


if (! isCancelled())
{
doneRecording();
}

return null;
}

This code works fine on my HTC Desire, but on the LG Ally, no matter
what the buffer size or sample rate is set to, bufferReadResult always
returns 2048. In other words, the call to:

audioRecord.read(buffer, 0, bufferSize);

Always reads just 1024 samples of audio. Actually I havent tested to
see if the buffer contains anything useful.

I can possibly get around this in my app with a bit of work, but I was
wondering if anyone else has encountered this problem and if there is
a better way to get around it than reading the audio in 2K chunks.

You can try out the test app for yourself here:

http://tunepal.org/tunepal/android/RecordTest.apk

Rotations will screw it up BTW, so keep your phone orientated in
portrait for the test.

Bryan

-- 
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: Android paid apps in Ireland

2010-07-02 Thread skooter500
Hi Shane

I took a look at ZappMarket. A couple of suggestions.

The URL http://zappmarket.com/ just shows the zapp market logo and
nothing else after that.
When I went to upload application I got the message "We have detected
that you are using Internet Explorer" even though I am using Firefox
What are your commissions?
How does a user get the APK onto their machine?
How does a user get updates to their app?
Have you any features to prevent app piracy?

Thanks for the information and best of luck with ZappMarket!

Bryan

On Jul 1, 4:35 pm, Shane Isbell  wrote:
> Thanks for taking a look, Steve. Just to throw some stats your way: Facebook
> has 400 million active users and 70% of the users are outside of the US.
> There are also 100 million users that access FaceBook through their mobile
> device, so it's a great community to sell Android applications into.
>
> It's also a great way to interact with your user base. When you click on an
> app, you see a picture of the dev (with a link to their facebook page),
> giving it far more of a personal feel. Users can see these are real people.
> A face to the apps. And my feeling is that the feedback will be far more
> constructive when they see it's not some faceless entity.
>
> One complaint I've heard from devs is they can't communicate with their user
> base if they find a bug and need to head off the stem of bad reviews or if
> they get a bad review because the user doesn't understand the product. With
> Zapp you can go in and see who left a comment or who bought your apps (with
> a link to their page) and address things quickly.
>
> And then you have the whole viral nature of the app, where friends recommend
> to friends and so on. This provides exposure to apps that traditionally get
> buried in the Android Market.
>
>
>
> On Thu, Jul 1, 2010 at 6:51 AM, gosh  wrote:
> > >sell Android apps into the facebook community, take a look at ZappMarket
>
> > Thats a very cool idea - its given me a whole new perspective on
> > Facebook...
> > I've stayed away from facebook for years, for philosophical reasons:
> > I've always considered it to be an attempt to fence-off the Internet
> > into a private space, one not much different from Microsoft's attempt
> > years ago with MSN. Hated the 'login in' screen before you could see
> > anything at all - at least they've moved away from that.
>
> > BUT, now that Google has shown itself far less International than I
> > would have ever suspected prior to Android app development (re: the
> > hard limit to 9 seller countries), it puts facebook in a whole new
> > light to me. It is effectively a very large social space that crossed
> > those national boundaries that Google has stopped at the border of. So
> > from a commercial point of view, it may well turn out to be the most
> > International player at the top end of the service providers
>
> > Good luck to you with it.
> > Steve
>
> > On Jun 29, 2:26 pm, Shane Isbell  wrote:
> > > If you want to sell Android apps into the facebook community, take a look
> > at
> > > ZappMarket. It has a dozen payment methods including paypal, google
> > > checkout, as well as an offer wall. Pretty much anyone, anywhere will be
> > > able to buy your app. You don't get the instant audience of Android
> > Market
> > > but Zapp is a great way to build a community of users around your app.
> > When
> > > Android Market finally comes to Ireland, you could already have a good
> > user
> > > base built up.
>
> > > Keep in mind, to upload, you will need a facebook account:
>
> > >http://apps.facebook.com/zappmarket/uploads
>
> > > On Mon, Jun 28, 2010 at 8:50 PM, Mathias Lin 
> > wrote:
> > > > Don't expect an answer from Google, cause they won't. Just move to
> > > > another market platform. Google has no interest to offer paid apps
> > > > model in too many countries, as they heavily rely on advertisement
> > > > income.
>
> > > > On Jun 28, 3:15 pm, skooter500  wrote:
> > > > > This is a disgrace! And I cant get an answer from anyone in Google as
> > > > > to when this will be available.
>
> > > > > Oh well. It looks like SlideMe it is
>
> > > > > Bryan
>
> > > > > On Jun 26, 7:43 pm, Tomá¹  Hubálek  wrote:
>
> > > > > > On 21 èvn, 10:37, skooter500  wrote:
>
> > > > > > > (though I have users in 22 countries). I am not going to release
> > it
> > > > > > > for free. It seems

[android-developers] Re: How to dismiss the soft keyboard

2010-06-30 Thread skooter500
Thanks!

I used:

txtQuery.setOnKeyListener(this);
...
...
public boolean onKey(View arg0, int keyCode, KeyEvent event)
{
if ((event.getAction() == KeyEvent.ACTION_UP) && (keyCode ==
KeyEvent.KEYCODE_ENTER))
{
doSearch();
...
...

And used the answer from the previous post to hide the keyboard

Bryan

On Jun 29, 8:17 am, jamesc  wrote:
> Have a look at View.onKeyUp() or View.onKeyDown() to handle to
> keypresses.
>
> As for the IME, take a look at this recent post:
>
> http://groups.google.com/group/android-developers/browse_thread/threa...
>
> On Jun 28, 8:23 am, skooter500  wrote:
>
> > Hi
>
> > I have a TextView and a search button on an activity. When I press the
> > enter key, I want to do something and then dismiss the soft keyboard
> > programatically. I have set the TextView to be single line by using:
>
> > android:singleLine="true", which moves the focus to the next component
> > when you press the enter key
>
> > 1. How do I trap the enter key? A TextWatcher? An OnKeyListener?
>
> > 2. How do I dismiss the soft keyboard programatically?
>
> > Thanks!
>
> > Bryan
>
>

-- 
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 to dismiss the soft keyboard

2010-06-28 Thread skooter500
Hi

I have a TextView and a search button on an activity. When I press the
enter key, I want to do something and then dismiss the soft keyboard
programatically. I have set the TextView to be single line by using:

android:singleLine="true", which moves the focus to the next component
when you press the enter key

1. How do I trap the enter key? A TextWatcher? An OnKeyListener?

2. How do I dismiss the soft keyboard programatically?

Thanks!

Bryan

-- 
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: Android paid apps in Ireland

2010-06-28 Thread skooter500
This is a disgrace! And I cant get an answer from anyone in Google as
to when this will be available.

Oh well. It looks like SlideMe it is

Bryan

On Jun 26, 7:43 pm, Tomáš  Hubálek  wrote:
> On 21 čvn, 10:37, skooter500  wrote:
>
> > (though I have users in 22 countries). I am not going to release it
> > for free. It seems I cant sign up for a google checkout merchant
> > account, because I live in Ireland and there are no paid apps allowed
> > on the Irish Android Marketplace!!!
>
> Welcome to Android World where highest percentage of the apps on the
> market is free... We are going to communism where everything is for
> free and everybody is working for pleasure ;-) And all pigs are equal
> and some of the are more equal ;-)
>
> Tom

-- 
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] Android paid apps in Ireland

2010-06-21 Thread skooter500
Hi guys

I have a popular music search engine app for the iPhone called Tunepal
(http://www.youtube.com/watch?v=Gr0xnlYZ_gM) and in response to
multiple requests I have been working hard to port it Android. The
port will be finished in the coming weeks and I want to sell it on the
Android Marketplace. The majority of my iPhone users are in Ireland
(though I have users in 22 countries). I am not going to release it
for free. It seems I cant sign up for a google checkout merchant
account, because I live in Ireland and there are no paid apps allowed
on the Irish Android Marketplace!!!

The first problem I can get around by using my sisters bank account in
London (why??) but how do I get around the second problem?

1. When will the Android paid app marketplace be available in Ireland
2. If its not going to be for a while, how do I sell my app in Ireland
withough using the Android Marketplace?

Thanks

Bryan

-- 
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