How do you call and load audio file from saf (and 'load' the audio into the SpeechRecognizer)?

is possible to call audio file and load the format wav u other format?. some example for guide me

SAF is not audio player so it can give you file's uri only.

"How do you call and load audio file from saf?"

Why do you want to access a media file via SAF?
Media files can be accessed from anywhere on all Android versions with READ_EXTERNAL_STORAGE or from Android 13 with READ_MEDIA_AUDIO permission.

my android is 9 and i will load the audio file to convert a text using textbox and speechrecognizer. but i trying to get access for wav file using saf because using other form i cant load the file audio and get the text from speechrecognizer. its not working using permission in screen initialize

Show your blocks.

Android version? Are you testing with Companion or the APK?




i am using apk not companion

Post your blocks before using SAF.

here is my code blocks


when i click in my mobile many times in the button the app go close and i dont know why

use logcat to find out what happens

Taifun

but my app dont work, its just not the click button, its just how can read the wav file and i dont know why didnt work my blocks

My understanding is the SpeechRecognizer only takes input from the Android's microphone.

It can not take input from an audio file. You cannot load an audio file.

GetText() asks the user to speak, and converts the speech to text which is read by the AfterGettingText ( AfterGettingText(result,partial) is a simple event to raise after the SpeechRecognizer has recognized speech from the microphone; not an audio file.

Consequently your code cannot work.
These Blocks are probably wrong.

speechfromaudiofile

You might be able to use the Cloud Speech-to-Text with App Inventor https://cloud.google.com/speech-to-text?hl=en which supposedly can accept audio file input.

1 Like

so its not possible to convert audio to text using speechrecognizer?

I don't think it is possible using App Inventor Blocks.

its working but with errors you could check this but i dont know why the speechrecognizer stop mi dialog. its exist a form to get the speechrecognizer wihout limit time to speak?
mp3audio.aia (6.4 KB)
mp3audio (2).aia (6.5 KB)
mp3audio (1).aia (6.5 KB)

in my computer the aia is working its weird

using the stop block of the speechrecognizer, the speechrecognizer will be open listen or i need to use a timer?