Can麓t create an AudioRecor der object

by HeHe » Mon, 08 Mar 2010 01:16:04 GMT


Sponsored Links
 what is the value of the variable SAMPLE_RATE?




--



Can麓t create an AudioRecor der object

by Gabriel Sim玫es » Mon, 08 Mar 2010 02:06:15 GMT


 000

On 7 mar, 14:15, HeHe <cnm...@gmail.com> wrote:

--


Sponsored Links


Can麓t create an AudioRecor der object

by Gabriel Sim玫es » Mon, 08 Mar 2010 02:06:50 GMT


 AMPLE_RATE = 8000;

On 7 mar, 14:15, HeHe <cnm...@gmail.com> wrote:

--



Can麓t create an AudioRecor der object

by Gabriel Sim玫es » Thu, 11 Mar 2010 10:29:35 GMT


 ell, after spending my free time for the last 5 days working on the
AudioRecord class Im here again to post my findings.
But first let me make myself clear:

- What Im about to write is the result of my tests and findings after
having a lot of trouble to use the basic routines of the class. I
found a lot of forums posts over the internet about the same problems
so my idea here is to help people so they dont face the same problems
Ive faced.

- It may be beginners stuff, but a lot of people have faced or are
facing the same problems.

- If something here is wrong please dont come here just to say it,
share your knowledge with us and post not only whats wrong but how to
do it right.

- Ive done all tests on the EMULATOR provided by google. Also Im
using the sdk 2.1 (build 7)

Ok, lets go.

Creating an AudioRecord object:

When you create a new instance of AudioRecord there are two ways of
finding out if it was created properly (the device can handle the
audio parameters and resources were trully allocated to your object):
by catching an exception or by verifying the return of the getState()
method.

- Handling the IllegalArgumentException : Well, tricky is what I can
say. Exceptions will only be thrown if any of the parameters you have
used are NOT acceptable by the CLASS (not if the device cant handle
it). For example, a sample rate = 12345 is not a standard value and
then the class will throw an exception. If SR = 44100 is not supported
by the DEVICE, the object will be created and no exception will be
launched.
* An interesting thing is that the official documentation says:
"sampleRateInHz the sample rate expressed in Hertz. Examples of rates
are (but not limited to) 44100, 22050 and 11025."
If you try SR = 11025 the system will throw an exception as it
considers this an illegal parameter. Strange, huh?

- Then ok, you have created an instance of AudioRecord but you dont
know if the parameters you have set are available in an specific
device. What you do? Verify AudioRecord.getState(), right?
Ok then, it works. But if you find out your instance is not ok and
then you have to create a new AudioRecord object you will be in
trouble. Why? Even after running AudioRecord.release() the resources
for the audio input you are interested in will keep being in use and
you wont be abble to recreate your object in a way it would work.
To verify this create an instace of AudioRecord with parameters that
are known not to work on the emulator (ex. SR = 44100). Then verify
the errors on logcat. After that call release() and then try to create
another instance of AudioRecorder with the parameters that work (sr =
8000, mono channel, pcm 16 bits) and check the first error line.

Then how should you find out which parameters the device will allow
you to use? Say with me: AudioRecord.getMinBufferSize() is my
solution!
Loop checking from the best combination of parameters to the worst. If
it returns -2, you should try another combination, if it returns -1
the audio input source is already being in use or isnt even available
for the specific device. If it returns something > 0 then youre ok
and can proceed creating a new AudioRecord object.

AudioRecord notification:

YES, IT WORKS! Believe me. The trick is: the notification will only be
called AFTER you call read() for the first time! And not only one time
(Oo). After a periodic notification you need to read from the audio
bu



Other Threads

1. Market expanding to technically non-compliant devices?

Looking at the Developer's console, I note (correctly) that my
application needs permissions for touch-screen operation.

I don't think it used to do that, but maybe I just didn't notice.

Furthermore, touchscreen is a standard part of the google android
hardware specification, and it is hard to see how it could be a
security issue.

Perhaps the market is being expanded to allow devices without
touchscreen (and hence not android hardware compatible) to
applications that they can run, in much the same manner as the market
will filter out apps that need high res if you are on a low res
phone ?

Why else might they filter on touchscreen?

-- 

2. Lag fix utk samsung galaxy s

Selamat siang...
Saya pengguna samsung galaxy s
Kmrn saya baru saja mengupgret jadi xxjpk. Sblmnya pakai dxjg4.

Sebelumnya saya pakai one click lag fix by ryanza.
Nah sekarang saya coba pakai app yg sama gagal terus lag fixnya.
Ada yang tau kalau mau lag fix pakai apa ya?

-- 
===============
"

3. Duo HTC Desire Mendarat di Indonesia

4. synchornization with gmail account

5. HELP: Aplikasi CCTV for Android

6. Review Delcell Battery Box G2600, Adiknya Delcell P4000 2 Desember 2010

7. Update Garminasus A10 1 Desember 2010 v.5.0.77 Malaysia Version