Voice recognition with AudioRecord

brelto85

Active Member
Licensed User
Longtime User
Hi,

there's a way (and the example) to register audio (in VOICE_RECOGNITION mode) and capture the voice in a string?
would be perfect if there was no need to save it to a wav file, but listening in real time

I looked the AudioRecord library and test project but i can't retrieve the string during the registration

thanks
 

brelto85

Active Member
Licensed User
Longtime User
Remember though that you had responded to a few posts, that the only way was to use AudioRecord to record a voice continuously.

The library voicerecognition and similar, listens for a given time
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I had a look at the android developers site, it appears that the Voice recognition uses audiorecord to capture the voice, but there doesn't appear to be any way to interact with that process. It's all done within the Voice recognition itself.

If you can find any examples done in Java, it might give a clue if it can be done, but I couldn't see one.
 
Upvote 0

brelto85

Active Member
Licensed User
Longtime User
but if AudioRecord library has the AudioSource property (with A_SRC_VOICE_RECOGNITION value) and is possible retrieve the buffer like this way,

B4X:
Dim RecData() As Byte
RecData=AR.ReadBytes(0,BufferSize)

...recdata should contain the buffer of the voice recognition bytes?
Doing after a conversion, could be possible retrieve a string
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The Audio source is described here, it's not a different buffer, but just allows recording from a device that is tuned for voice recognition.
 
Upvote 0

brelto85

Active Member
Licensed User
Longtime User
ok, and this buffer is possible to convert it in a string?

For example:

if "AudioRecord" records "ciao", in the buffer there's a bytes array of "ciao"....right?
if yes, there's a way to convert the byte array to retrieve the string "ciao"?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
No, it doesn't seem like it is possible to access the recorded data when using voice recognition.
 
Upvote 0

brelto85

Active Member
Licensed User
Longtime User
maybe i explained evil, but I do not want to use the library voicerecognition during recording.

I want to record voice and recover the spoken word in a string.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Perhaps I am not understanding you properly, but the SpeechRecognizer is a complete process, there doesn't appear to be any interface other than the provided one which does the recording it needs.

It doesn't seem possible to feed a pre-recorded file into the recognizer object.
 
Upvote 0

brelto85

Active Member
Licensed User
Longtime User
i'm sorry, probably my english is not good

The problem is that the SpeechRecognizer, listens only for a given period and not continuously.
I was able to do a listen continuously, restarting the listening in "SpeechRecognizer_Results" event

My goal is to run a service in background that listens a command (es: "CALL ....." , "SEND ....")
not knowing when the user speak, i've need to run this service in a continuous way
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I haven't come across anything that can do that so far.
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
My goal is to run a service in background that listens a command (es: "CALL ....." , "SEND ....")
not knowing when the user speak, i've need to run this service in a continuous way

I don't think it's possible because your device will always in "listen mode" that drain the battery and occupy the microphone. As you can see all voice recognition apps have a button like "press and speak".
 
Upvote 0

brelto85

Active Member
Licensed User
Longtime User
Determined that the AudioRecord library cannot convert the recording into a string, i found these library on the Android API documentation

Analizying this example, i think it is possible start the trigger that listens continuously the speech.

Even if the example writes a speech into a text, you can create a library for B4A based on this?
 
Upvote 0
Top