AudioRecorder Library V1.00

XverhelstX

Well-Known Member
Licensed User
Longtime User
Heey all!

I present you, my second library :D

BIG UPDATE:

AudioRecorder has been completely updated to 2.0
It is much more clear now on how to work with it.
You can record in various file formats including wav, mpeg4, 3gp, etc.
Also a much easier way to make your custom AudioRecorder with:

- AudioEncoder:

int AAC AAC audio codec
int AMR_NB AMR (Narrowband) audio codec
int AMR_WB AMR (Wideband) audio codec
int DEFAULT

e.g all Audioencoder, AudioSources (mic, ...),... types will have a prefix of AE_name

for example:

AS_MIC (AudioSource Microphone)
AE_AAC (AudioEncoder AAC Audio codec)

A sample/example file is delivered with the libraries.
All methods are explained in the library.
Please post feedback.

If possible Erel, Do I have to make documentation for it?

Thanks,

XverhelstX



There should be (almost) no bugs.

XverhelstX
 

Attachments

  • AudioRecorder2.00.zip
    269.9 KB · Views: 1,960
  • AudioRecorder210.zip
    333.3 KB · Views: 2,199
Last edited:

susu

Well-Known Member
Licensed User
Longtime User
Woah! It looks great, thank for your sharing :D
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
Your welcome ;)

Note that all sounds will be stored on your SD card and make sure it's not connet with usb storing on, otherwise you will have an error.

XverhelstX

EDIT: Note: if you want to hear the captured sound, it's best to use quicktime player cause i think it's the only one who is possible to decode it. (According to what encode you use.)
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
Great, thank you, something else interesting to play with. At this rate, I'm going to be busy until 2014 at least.:)

Steve
 

susu

Well-Known Member
Licensed User
Longtime User
I tried the sample code but the recorded file name is "Recorder10438.3gp" instead of "Recorder.3gp", is it right?
 

susu

Well-Known Member
Licensed User
Longtime User
Thank you. Could you please create the libraries that support streaming audio/video?
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
Ok, I quickly tried to make this and I was quite surprised, cause i had to go now.

the startStreaming works good, but it takes long to stream.

There's still an bug in stopStream I think.

Only works for AUDIO!

remember that you can't stream youtube vids but only website that ends with an extension like .mp3/.wav

XverhelstX
 

Attachments

  • Streamer.zip
    5.3 KB · Views: 554

susu

Well-Known Member
Licensed User
Longtime User
You're Superman! I wish for this function for a long time. Streaming audio works very well! Hope you can make more perfect. Thank you sooo much :D
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
Hehe thanks :)

I'm adding now a lot of new features like isStreaming and duration etc

I hope it works, cause I write libraries now for like 4-5 days and I'm starting to like it.

It actually quite easy if you can understand it.

I'll write a basic tut later.

XverhelstX
 

susu

Well-Known Member
Licensed User
Longtime User
I'm waiting for you for a whole day. I hope can get your library now. A tutorial is great too :D
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
Sorry, I'm currently in examens period for another week, and I had a soccer match today, so I couldn't go online.

I'll make a new topic Streamer library.

Altough I do think there are still a few bugs that I seem to cannot solve.


XverhelstX
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
@ erel, Agraham or some one else.

I use this:

mSampleFile = File.createTempFile(Filename, extension, sampleDir);

in the library to save the generated file on the SD Card, but how does it come, just like Susu stated, that it gets a new name like: Recorder10438.3gp" instead of "Recorder.3gp".

How do i fix this?

XverhelstX
 

agraham

Expert
Licensed User
Longtime User
If you look in the Android documentation for File the signature for createTempFile is not as you assume but is
public static File createTempFile (String prefix, String suffix, File directory)
Since: API Level 1 Creates an empty temporary file in the given directory using the given prefix and suffix as part of the file name. If suffix is null, .tmp is used.
It's just doing what it does!
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
pff, I really don't get it :s

This is my code now:

B4X:
    public void startRecording(int outputfileformat, String extension, String Filename) {
        stop();
        
        if (mSampleFile == null) {
            File sampleDir = Environment.getExternalStorageDirectory();
            if (!sampleDir.canWrite()) // Workaround for broken sdcard support on the device.
                sampleDir = new File("/sdcard/sdcard");
            
            try {
               mSampleFile = new File(sampleDir, Filename + extension) ;
               
               if (mSampleFile.exists())
                {
                  mSampleFile.createNewFile();
               }
            } catch (IOException e) {
                setError(SDCARD_ACCESS_ERROR);
                return;
            }
        }

I also tried with your succes boolean, but it still recorded with numbers behind it.

XverhelstX
 

lumene

New Member
Licensed User
Longtime User
Hello :)

I'm programming an App with the sound recorder library under the Android emulator, but i get an error when i try to record.
Is there something i should setup that i'm missing ?
 
Top