Speechrecognition in anvil webapp

Actually, I am trying to create a webapp which will take the voice of speaker & convert it to text which will be used for sentiment analysis.

Now the server code is throwing following error:

OSError: No Default Input Device Available

Can we do anything about this error?

Can we install something on server side so that it will recognize the local machine microphone on which app is being run?

have you thought about getting the audio from the client code?

Text-to-speech/speech-to-text - #3

1 Like

Hi Leader,

Thanks for reply.

Is there any way that client code may access the microphone of the machine on which app is being run? So as to get the audio which one may speak into the microphone of the machine.

Please suggest something.

I think this will require some interesting Javascript meets Anvil… maybe the anvil team could help with this one…

@goldiesahni as an option could you break it down into uploading a file using the file uploader… component - restrict this to file types audio/*

send this audio file to the server and work with your speech recognition…

Then the second part will be working out how to use the browser microphone…

Some other linked topics:

Recording and playing audio - #2 by campopianoa

Simple Audio Player - #5 by robert

1 Like

HTML5 tags support getting audio from the microphone.

<input type="file" accept="audio/*;capture=microphone">

So implementing this is quite similar to the “Simple Audio Player” topic mentioned above. Javascript will most likely be required since you will need to pull the audio from the browser into Python and then to a server module.

1 Like

Fun fact: Because the HTML file input is how the FileUploader component works, you can achieve what @robert suggests without writing any HTML or JS, by setting the file_types property to "audio/*;capture=microphone"!

However, for what @goldiesahni wants, I would definitely suggest using the browser’s speech recognition APIs via Javascript - that’s what they’re there for :slight_smile:

4 Likes