Error using speech2text

Hi
When I downloaded speech2text in MATLAB 2018a and trying to run I am getting the following error:
Output argument "tableOut" (and maybe others) not assigned during call to
"BaseSpeechClient/speechToText".
Error in speech2text (line 45)
tableOut = connection.speechToText(y,fs,timeOut)
Error in stt (line 7)
outInfo = speech2text(speechObject,samples,fs,'HTTPTimeOut',25)
Immediate help is required

2 Commenti

Adam Danz
Adam Danz il 6 Dic 2019
Are you using this file exchange submission ? Your error indicates
Error in speech2text (line 45)
but speech2text() from that submission only has 40 lines. So either you're working with a different function or a different version of the function. If this is the correct file exchange submission you may want to download the newest version of the code and follow the instructions in the setup() file included with that submission.
Just FYI, I have never used this submission nor have I downloaded it.
Hi Adam
I have downaloded the latest version from this file exchange submission.
I have created .m file (say, stt.m) and have the following code of 6 lines:
clc;
clear all;
[samples, fs] = audioread('on.wav');
soundsc(samples, fs)
speechObject = speechClient('Google','languageCode','en-US','maxAlternatives',3)
outInfo = speech2text(speechObject,samples,fs)
Now the same below error is thrown
Output argument "tableOut" (and maybe others) not assigned during call to
"BaseSpeechClient/speechToText".
Error in speech2text (line 39)
tableOut = connection.speechToText(y,fs,timeOut);
Error in stt (line 6)
outInfo = speech2text(speechObject,samples,fs)

Accedi per commentare.

Risposte (3)

Adam Danz
Adam Danz il 6 Dic 2019
Modificato: Adam Danz il 13 Dic 2019
Update: checklist of requirements
I am not a contributor to the speech2text FEX submission. Here is a list of requirements summarized from the comments below this answer.
Since several functions in the speech2text submission are protected by p-codes or interface with 3rd party APIs, troubleshooting capabilities are limited.
At the bare minimum you must satisfy these equirements.
Original Answer below
Hmmm..... it still looks like you're not using the most recent version.
In this section of your error stack
Error in speech2text (line 39)
tableOut = connection.speechToText(y,fs,timeOut);
the tableOut variable is assigned on line 39 but in the latest version of the code, that line of code is on line 45. I think you have the old and the new versions of the files on your matlab path but matlab is still using the old version.
Based on comments left on the file exchange page, I suggest taking the following steps.
  1. Remove the old file from your matlab path (keep it for now but just remove it so matlab doesn't have access to it).
  2. Shut down and restart Matlab
  3. Add the path to the new files
  4. run the setup.m file that came with that submission
  5. try your code again
Please let me know if that worked or not in the comment below.
For what it's worth, I tried the submission but I don't have a Google authorization file (JSON file) so I could not proceed past the window that requests the file:

8 Commenti

Hi Adam
I have deleted all the previous versions of speech2text from the Matlab path and then restarted the application.
I have gone to this file exchange submission and downloaded the ZIP file and extracted to the "documents/MATLAB/addons/toolboxes" path. I have deleted all previous keys, created a new Google API key and downloaded .json file. I tried to follow the instructions that are present in the speech2text_example.mlx of examples folder.
  1. Run setup.m
  2. Downloaded .json
  3. speechObject = speechClient('Google','languageCode','en-US')
  4. [y,fs] = audioread('00b01445_nohash_0.wav');
  5. tableOut = speech2text(speechObject,y,fs);
All the above steps are done from the command prompt.
For the step 5, the output should be the text of what the speech file (.wav) is. But it is throwing out the same error as below,
Output argument "tableOut" (and maybe others) not assigned during call to
"BaseSpeechClient/speechToText".
Error in speech2text (line 45)
tableOut = connection.speechToText(y,fs,timeOut);
I think it is something to do with BaseSpeechClient.p that comes with the package that the owners should update with. I have seen the comments on the same error in this file exchange submission but there seems to be no reply.
Please help me to solve this.
Adam Danz
Adam Danz il 6 Dic 2019
Well, it's not exactly the same error as you had before. This time it confirms that you're using the updated files since the line numbers are correct in your new error message.
The speech2text() function contains a variable timeOut and according to comments within that file, it's a 10 second timeout period (by default). This variable is sent to connection.speechToText which appears to be an interface with a 3rd party Speech Recognition APIs which I do not have access to.
My bet is that if some response doesn't happen within the timeout period, the interface gives up and that is why the tableOut output is never assigned.
Since I do not have access to connection.speechToText and since much of the code is protected in pcode files (which we cannot access), I've hit a dead end in terms of troubleshooting.
I can leave a comment on the file exchange and point the author(s) to this conversation in hopes for a response.
Thank You Adam.
Hoping that they should respond.
Adam,
I have one doubt.
In order to use Google speech to text cloud API, do we need to pay some amount or just that API key in .json file is enough.
"Since each of the APIs support varied number of input parameters and the parameters have different names, you are expected to provide the correct input for the API. If the API returns any error due to incorrect input parameters, then the speech2text function captures and reports the error."
What does the above line mean in the speech2text_example.mlx of examples folder, because as it is said it is reporting an error at speech2text.
Adam Danz
Adam Danz il 6 Dic 2019
Based on the "try it for free" button on the main web page it seems to be a paid service.
Adam Danz
Adam Danz il 13 Dic 2019
Akshatha Prasad's answer moved here as a comment.
Hi Adam,
Did you find any solution for this.
Adam Danz
Adam Danz il 13 Dic 2019
Modificato: Adam Danz il 13 Dic 2019
Hi Akshatha,
As I mentioned a few comments above, since I don't have access to the Speech Recognition API nor to the content of the p-codes within the speech2text files, I can't really offer more advice than I already have.
At the bare minimum you must verify with 100% certainty the following requirements.
Lastly, go to the speech2text FEX page and select the "Examples" tab. It provides detailed instructions on how to set up the API.
If you have verified those requirements, the problem likely resides within the code and since much of it is encrypted, my hands are tied.
Akshatha Prasad
Akshatha Prasad il 13 Dic 2019
Thanks Adam for your reply.
I have verified all the requirements that you have listed out.
As far as I know there is some error in those .p files. I have also noticed that few people have asked same question in many forums but no proper solution for that. I think authors of the submission should consider this and revise the code or respond as to what to do additionaly in order to make that code work.

Accedi per commentare.

jibrahim
jibrahim il 13 Dic 2019

0 voti

Hi Akshatha,
I am trying to get to the bottom of this. Can you please let me know what you get qwith the following:
1) which GoogleSpeechClient -all
How many hits do you get? I wonder if you have multiple clashing versions.
2) ver('audio')
What is the output of this function?
3) Please try to execute this line of code to make sure you have a license to execute functionality from audio toolbox:
mfcc(randn(1e5,1),44100);

10 Commenti

Hi jibrahim,
  1. With 'which GoogleSpeechClient -all' on command window I got,
C:\Users\vaksh\Documents\MATLAB\Add-Ons\Toolboxes\GoogleSpeechClient.p % GoogleSpeechClient constructor
2. ver('audio')
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.4.0.813654 (R2018a)
Operating System: Microsoft Windows 10 Home Single Language Version 10.0 (Build 18362)
Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
Audio System Toolbox Version 1.4 (R2018a)
3. mfcc(randn(1e5,1),44100);
This command ran succesfully without any errors.
Adam Danz
Adam Danz il 17 Dic 2019
The following comments were moved here from a series of answer/comments that have been deleted.
jibrahim's Comment
Hi Akshatha,
Interesting. I can't see how the source code would behave this way.
Let's try this:
1) Under Home -> Preferences -> General: Make sure 'Enable toolbox path cache' is unchecked. If it is checked, uncheck it and restart MATLAB
2) I have attached a modified version of a couple of files that hopefully will give us more details about what went wrong. Can you please replace your versions of those two files and see what you get?
Adam Danz
Adam Danz il 17 Dic 2019
Akshatha Prasad's comment
Hi jibrahim,
  1. I have unchecked 'Enable toolbox path cache'.
  2. I have replaced the files that you have sent and got the same error.
I am attaching the screenshot of what I am doing and what error I am getting.
image.png
Adam Danz
Adam Danz il 17 Dic 2019
jibrahim's Comment
OK Akshatha,
I've attached a modified version. Please let me know how that one goes.
Adam Danz
Adam Danz il 17 Dic 2019
Akshatha Prasad's comment
No jibrahim. Even that is showing the same error.
I have even changed the audio file and tested but the same error pops up.
Is this working successfully from your side.
Adam Danz
Adam Danz il 17 Dic 2019
jibrahim's Comment
Hi Akshatha,
Yes, this is working from my side.
Adam Danz
Adam Danz il 17 Dic 2019
My comment
@ jibrahim, all of these comments that are entered as answers might cause some confusion to future readers who may want to follow the discussion. Answers are resorted after an answer is accepted or voted. Then we lose the linear progression of comments while reading through the steps taken during troubleshooting.
If you agree, I'd like to clean this up by editing this thread so that all of the answer/comments are rewritten as comments under your first answer. Then when a conclusion is reached, you could edit your original answer to show the final solution. I won't do that without your OK but I think it's worth the time to keep it organized for future visitors.
Adam Danz
Adam Danz il 17 Dic 2019
jibrahim's Comment
Hi Adam,
Absolutely, please go ahead and edit at will, and thank you for taking the time to organize this. Sorry, I am a MATLAB answers newbie :)
Akshatha Prasad
Akshatha Prasad il 17 Dic 2019
Modificato: Akshatha Prasad il 17 Dic 2019
Hi jibrahim,
Then where is the problem.
How to resolve this issue.
I have deleted previously generated .json file.
I have tried to generate new API key from google cloud and downloaded new .json file and tried with that.
same error pops out.
I want this speech2text conversion in my MATLAB project.
Is there any other alternative.
Akshatha Prasad
Akshatha Prasad il 17 Dic 2019
Modificato: Akshatha Prasad il 17 Dic 2019
What does the below lines mean?
"Since each of the APIs support varied number of input parameters and the parameters have different names, you are expected to provide the correct input for the API. If the API returns any error due to incorrect input parameters, then the speech2text function captures and reports the error."
I have found these lines from the example section of the speech2text file exchange.
Also I have another doubt,
Do we need to give billing information compulsorily in order to use Google's Speech to text API in our application.

Accedi per commentare.

Akshatha Prasad
Akshatha Prasad il 19 Dic 2019

0 voti

Hi,
My problem got resolved with IBM Watson speech to text service.
I have tried with google but that is popping out an error. I think it is something to do with GoogleSpeech.p file where it is showing the error.
Thanks for helping me to understand the issue,

1 Commento

Adam Danz
Adam Danz il 19 Dic 2019
It may be helpful to share the full copy-pasted error message.

Accedi per commentare.

Prodotti

Richiesto:

il 6 Dic 2019

Commentato:

il 19 Dic 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by