AudioRecorder Library V1.00

lumene

New Member
Licensed User
Longtime User
I've just forgotten to activate recording and playing sound in the android emulator... sorry.

But now, i can't get no sound.
Can you help me ?
This is my source code :

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim TurnOn As AudioRecorder
   Dim Value As Int
   Dim maxi As Int
   Dim maxstr As StringBuilder
   Dim MediaPlayer1 As MediaPlayer
   Dim cpt As Int
   Dim sd As StringBuilder
End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim On As Button
   Dim Off As Button
   Dim Clear As Button
   Dim quit As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
   MediaPlayer1.Initialize
   activity.LoadLayout("l1")
   maxi=0
   cpt=1
   sd.Initialize
   If File.ExternalWritable Then 
      sd.Append(File.DirDefaultExternal)
   Else
      Msgbox("No SDCARD access !","Error")
      ExitApplication
   End If
   Do While cpt<=1000 AND maxi=0
      maxstr.Initialize
      maxstr.Append("mikemy")
      maxstr.Append(cpt)
      If File.Exists(sd,maxstr)=False Then
         maxi=cpt-1
      End If
      cpt=cpt+1
   Loop
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub On_Click
   Dim MP3 As Int
   If maxi<1000 AND TurnOn.state=0 Then
      If MediaPlayer1.IsPlaying=True Then MediaPlayer1.Stop
      maxi=maxi+1
      maxstr.Initialize
      maxstr.Append(sd)
      maxstr.Append("/mikemy")
      maxstr.Append(maxi)
      TurnOn.startRecording(MP3,".mp3",maxstr)
   End If
End Sub
Sub Off_Click
   If maxi>0 Then
      If TurnOn.state=1 Then
         TurnOn.stopRecording
         TurnOn.startPlayback
         Value=Rnd(1,maxi)
         maxstr.Initialize
         maxstr.Append("mikemy")
         maxstr.Append(Value)
         maxstr.Append(".mp3")
         'MediaPlayer1.Load(sd, maxstr)
         'MediaPlayer1.Play
      End If
   End If
End Sub
Sub quit_Click
   ExitApplication
End Sub
Sub Clear_Click
   For i=1 To 1000
      maxstr.Initialize
      maxstr.Append("mikemy")
      maxstr.Append(i)
      maxstr.Append(".mp3")
      If File.Exists(sd,maxstr)=True Then File.Delete(File.DirRootExternal,maxstr)
   Next
End Sub
 

lumene

New Member
Licensed User
Longtime User
I think my problem is to find the path of the recorded sound file.
Someone knows ?
 

Highwinder

Active Member
Licensed User
Longtime User
Feature Request

Good job!

Request:

Could you update this library to make it possible to use internal storage instead of only SD card?

This would make the library usable on all devices without having to put technical limitations on the user/device (worry free).
 

mistermentality

Active Member
Licensed User
Longtime User
Very impressed by all the new features, I have a quick question though. Is this library only to be used in an activity?

I have been trying it in a widget service where the widget is clicked on to start or stop audio recording and I get this error:

android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@46c61a20 is not valid; is your activity running?

always related to this specific line of code....

B4X:
AR.prepare

I only dabble in coding so I might be wrong in my reasoning but could this error be because B4A is expecting the above line of code to be run from an activity rather than a service?

Thanks for the great library :)

Dave
 

brainfart

Member
Licensed User
Longtime User
Which parameters to choose for 16bit PCM Wave file recording

Hello.
I have tried some research but I can't figure out which encoder and output format to choose for an uncompressed PCM Wave recording format.
I would like to record 16 bit (mono or stereo) PCM at approximately 22000s/s

Please advice.
:BangHead:
Thank you.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm being told by one of my users that this library may be crashing on devices that doesn't have a microphone. Is there a way to check before starting it?
 

mearleybrook

Member
Licensed User
Longtime User
I have tried all the permutations I can think of and can not seem to be able to record in WAV format - has anybody done it?
 

gehrlekrona

Member
Licensed User
Longtime User
Volume?

It works great. The only thing I can't figure out is the volume. It is really low and I don't know what to do. Is it the phone? I am using the microphone setting so do I need to turn up the phpone volume or what do I do?
 

cjungee

New Member
Licensed User
Longtime User
voice record and recogniation

Is it possible to make voicerecorder and voice recognition work at the same time? If so, how?
 

stevel05

Expert
Licensed User
Longtime User
voice record and recognition

It doesn't look like they can use the microphone at the same time. And as far as I can see there is no way of feeding the speech recognition from anything except the microphone. So no recording first then passing it through.
 

cjungee

New Member
Licensed User
Longtime User
Voice record and recognition

In the library of audiorecorder, there is 'AS_VOICE_RECOGNITION As Int'. Does it make any room for combining recorder and recognition? The reason why I am asking this question is that non-english speakers often have pronunciation errors. So, it'd be better having features to record what voice recognition users speak and make them hear it. And I would like to make a simple app to test that feature..
 

stevel05

Expert
Licensed User
Longtime User
Have you tried it? That's the best way to find out really, otherwise someone else will have to set up a project to let you know.

If you have problems setting it up,someone will give you some timely pointers (me if I'm on the forum when you post). You'll need to zip and post your project so we can see what you've tried.
 
Last edited:

cookyrag

New Member
Licensed User
Longtime User
Errors on second attempt

Has anyone managed to do a second recording using AudioRecorder , the documentation says that after a AR.Stop then you have to configure it again as if its just been constructed. I reset all the encoder, source and output variables but the second time I run the AR.Start I get an error.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
It doesn't look like they can use the microphone at the same time. And as far as I can see there is no way of feeding the speech recognition from anything except the microphone. So no recording first then passing it through.

I too would like this ability.
I'm told the RecognitionListener/SpeechRecognizer objects can do it somehow
 

stevel05

Expert
Licensed User
Longtime User
I too would like this ability.
I'm told the RecognitionListener/SpeechRecognizer objects can do it somehow

I can find nothing obvious in the documentation, but I did find iSpeech free for mobile devices, that may do what you want.
 
Top