AudioRecorder Library V1.00

Highwinder

Active Member
Licensed User
Longtime User
I have no intention of making a nuisance of myself, sorry if it seems that way.

All I'm trying to do is use Steve's AudioTrack library to play a file (any file) created by Tomas's AudioRecord library. I really don't care about the file format anymore. I just want to get this working.
 

Highwinder

Active Member
Licensed User
Longtime User
...The only way (that i have found until now in b4a) to record pure wav audio is Stevel05's AudioRecord library. With short wavs Audiorecord works fine and is easy to use. Things get a little bit more complicated, when it comes to recording long wav files (threading required)...:

Djembefola,

How long (in seconds) of a WAV file can the AudioRecord library record before threading is required?
 

Highwinder

Active Member
Licensed User
Longtime User
For the AudioRecorder, i'm using the MediaRecorder interface.
You should take a look here:
MediaRecorder | Android Developers

B4X:
public void setOutputFormat (int output_format)

Since: API Level 1
Sets the format of the output file produced during recording. Call this after setAudioSource()/setVideoSource() but before prepare().

It is recommended to always use 3GP format when using the H.263 video encoder and AMR audio encoder. Using an MPEG-4 container format may confuse some desktop players.

So indeed, mp3 is not supported by this library.

XverhelstX,

I noticed that the followng are included in the Android documentation for MediaRecorder interface:

setAudioSource
setOutputFormat
setAudioEncoder
setOutputFile
prepare()
start()
stop()
reset() // Missing in the AudioRecorder library
release() // Missing from AudioRecorder library

Also: Is it possible to record uncompressed audio (wav) using AudioRecorder library? Very important, we need to know this.

Thanks!
 

Highwinder

Active Member
Licensed User
Longtime User
From Steve's comments about the MediaRecorder class being used in the AudioRecorder library from Tomas, I decided to really dig into what makes this class tick. I'm no Java guy, but I can poke my way around and see waht there is to see.

Here's an interesting and unfortunate discovery I made while digging around in the Android dev forums and dev wikis:

"...MediaRecorder can't be used because it doesn't support either WAV or MP3 formats..."


So far, the AudioRecorder library is good for 2 things:

1. Monitoring MIC level (MaxAmplitude)
2. Recording to 3GP audio files only (will not do any other standard/recognizable format)

And that's that. :mad: :sign0010: :BangHead: :sign0148:

What's sad is the B4A strugglers who will have to read this far into this thread to come to this discovery. But at least it's been clarified.

Heads up Steve - Here I come with a bunch of questions about AudioRecord. :D
 
Last edited:

Highwinder

Active Member
Licensed User
Longtime User
Hey Highwinder,

I have updated the library to Version 2.10.
Not many changes has been made, but it should be easier to create the output file. (It does work for me.)

Tomas

Tomas,

Again, thanks for the update. Think we can get another update out of you to be able to add the Release() and Reset() functions in AudioRecorder?

Java example:

public void stop() {
if (mRecorder != null) {
mRecorder.stop();
mRecorder.Reset();
mRecorder.release();
mRecorder = null;
}
}


Source: Click Here

This would be incredibly helpful.

Thanks!
 
Last edited:

trebun

Member
Licensed User
Longtime User
Hi,

at first: :sign0098:

I love this library!

I'm not sure if I found a bug:

I start a recording with
B4X:
AR.MaxDuration = 10000
the recording will stop after ten seconds, but
B4X:
Log(AR.isRecording)
returns furthermore true (from a timer_tick).

Is it a bug or I'm an idiot and don't know to use this lib... ;-)

Regards,
trebun
 

pacoMx

Member
Licensed User
Longtime User
Hello, after changing activity the library will allow me to record new sounds.

The thing is was getting some complains (0x1, media not prepared) while trying to play them.

After having a look in media explorer, outside my project, I can see that the file is there, but can't be played, so I imagine somehow it gets corrupted.

I can make new recordings if I don't change activity. Any ideas of what might cause this?

Thanks
 

madSac

Active Member
Licensed User
Longtime User
when i recorded using below code
B4X:
AR.AudioSource = AR.AS_MIC
      AR.OutputFormat = AR.OF_THREE_GPP
      AR.AudioEncoder = AR.AE_AMR_NB
      DateTime.DateFormat = "yyMMddHHmmss"
      AR.setOutputFile(File.DirRootExternal,"/Recordings/"& DateTime.date(DateTime.now) & ".wav")
      AR.prepare
      AR.start
i cannot hear my voice ...i can only haer noise...nothing is clear not even a single word.
 

hanyelmehy

Active Member
Licensed User
Longtime User
When I try :
B4X:
AR.AudioSource = AR.AS_VOICE_CALL
application hang up
i try to record call
any help:sign0085:
 

ChemiOne

New Member
Licensed User
Longtime User
Error example "AudioRecorder210.zip"

Hello.

There is a problem with the sample code "AudioRecorder210.zip" since it fails if you try to start the recording on a second occasion.

The sequences I've tried are:
1st: Prepare - Start - Stop - Prepare - Star = Error
2nd: Prepare - Start - Stop - Star = Error

In addition to these sequence've tried several solutions exist via code without.

I could tell how to record and stop several times without error the program.

Thanks and regards.
 

dreamworld

Active Member
Licensed User
Longtime User
my device is android 2.3.5. when i recorded with amr wb and playback, the voice speed became very fast. however the voice speed of amr nb is normal. does android 2.3.5 support amr wb?
 

ComposerB4A

Member
Licensed User
Longtime User
Hi, es very good library, one question please
¿Which version (of Android) is the minimum for this Library?
 

ComposerB4A

Member
Licensed User
Longtime User
Thanks,
i was looking this library because i want measure volume (in real time), one question ¿With AudioStreamer is possible measure in real time?
i look other libraries but es more slow the detection.
 

ComposerB4A

Member
Licensed User
Longtime User
Thanks,
i went to review the Audiostreamer library but i not found examples of access to "raw data" and "format of datas".
 
Last edited:

Kwame Twum

Active Member
Licensed User
Longtime User
I tried downloading the zipped files but they're not able to open... any ideas why?
 

stevel05

Expert
Licensed User
Longtime User
they're not able to open... any ideas why?

They work for me I just tried it. Try downloading them again.
 

Kwame Twum

Active Member
Licensed User
Longtime User
good timing, but it still doesn't open even with different browsers and unzippers (I've tried Chrome and Firefox, tried Winrar and Windows' Decompressor)
Untitled.png
 
Top