Research Log of Web Science Students

Computer Science is not simply programming

audio recorder

leave a comment »

As I tried to implement an audio recorder in our application, I encountered a lot of problems. The application would run and it would display the screen, but once I click the record button, it would quit. I looked for the error in the Logcat tab in Eclipse, and it said, “Media Recorder – start in an invalid state:4”. I searched for a solution in Google and most of the sites said something about an sd card. The output file of the recorded audio must start with “/sdcard” (ex. /sdcard/trial.3gp). I did exactly what they said, but it still showed the same error.

It turns out that I still need to make an sd card. These are the steps on how to make an sd card.

Note: I am using a Mac OS.

1.) Open the terminal. Navigate to the directory of your Android SDK.

2.) Type $ cd tools.

3.) Type $ ./mksdcard <size> <filename> (ex. $ ./mksdcard 10M /Users/Username/Desktop/sdcard.img – this creates a card.img file in your desktop, which has a capacity of 10 mb)

To use the sd card in your application:

Note: I am using Eclipse.

1.) Right click on your application name.

2.) Go to Run As > Run Configurations then click the Target tab.

3.) This one is the tricky part. You can’t see the Additional Emulator Command Line Options field. You need to resize your window to see it. (I initially thought there was something wrong with my Eclipse.)

4.) Type -sd <path to your sdcard> (ex. -sd /Users/Username/Desktop/sdcard.img)

5.) Run your program. You can now use a virtual sd card.

Still, after executing everything, there is an error. When I read the developer’s guide, it said that you can’t record an audio or video using an emulator. You need an actual phone.

I just have to wait until Monday (or Tuesday?) to test my recorder.

Advertisements

Written by janinaj

September 5, 2009 at 2:02 pm

Posted in BabyBook

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: