Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert_chunk': undefined method []' for nil:NilClass #14

Open
hoblin opened this issue Mar 20, 2013 · 2 comments
Open

convert_chunk': undefined method []' for nil:NilClass #14

hoblin opened this issue Mar 20, 2013 · 2 comments

Comments

@hoblin
Copy link

hoblin commented Mar 20, 2013

hoblin@ubuntu:~/src/stt$ ffmpeg -version
ffmpeg version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 18:03:14 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
ffmpeg 0.8.5-4:0.8.5-0ubuntu0.12.04.1
libavutil    51. 22. 1 / 51. 22. 1
libavcodec   53. 35. 0 / 53. 35. 0
libavformat  53. 21. 1 / 53. 21. 1
libavdevice  53.  2. 0 / 53.  2. 0
libavfilter   2. 15. 0 /  2. 15. 0
libswscale    2.  1. 0 /  2.  1. 0
libpostproc  52.  0. 0 / 52.  0. 0
hoblin@ubuntu:~/src/stt$ flac -v
flac 1.2.1
hoblin@ubuntu:~/src/stt$ ruby -v
ruby 2.0.0p57 (2013-03-12 revision 39784) [i686-linux]
hoblin@ubuntu:~/src/stt$ gem list speech2text

*** LOCAL GEMS ***

speech2text (0.3.6)
hoblin@ubuntu:~/src/stt$ speech2text test.wav 

/usr/local/lib/ruby/gems/2.0.0/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:69:in `convert_chunk': undefined method `[]' for nil:NilClass (NoMethodError)
    from /usr/local/lib/ruby/gems/2.0.0/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:34:in `block in to_json'
    from /usr/local/lib/ruby/gems/2.0.0/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:32:in `each'
    from /usr/local/lib/ruby/gems/2.0.0/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:32:in `to_json'
    from /usr/local/lib/ruby/gems/2.0.0/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:20:in `to_text'
    from /usr/local/lib/ruby/gems/2.0.0/gems/speech2text-0.3.6/bin/speech2text:11:in `<top (required)>'
    from /usr/local/bin/speech2text:23:in `load'
    from /usr/local/bin/speech2text:23:in `<main>'
@vmeng
Copy link

vmeng commented Jul 11, 2013

👍
I also have this problem. This is because i use an empty or only noisy audio file to post to google. And google return {"status":5,"id":"d67b8bcf33e6d87ccce91839671bad2c-1","hypotheses":[]}

My error log is :
NoMethodError: undefined method []' for nil:NilClass /Users/viki/Documents/Project/vendor/ruby/1.9.1/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:78:inconvert_chunk'
/Users/viki/Documents/Project/vendor/ruby/1.9.1/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:40:in block in to_json' /Users/viki/Documents/Project/vendor/ruby/1.9.1/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:36:ineach'
/Users/viki/Documents/Project/vendor/ruby/1.9.1/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:36:in to_json' /Users/viki/Documents/Project/vendor/ruby/1.9.1/gems/speech2text-0.3.6/lib/speech/audio_to_text.rb:21:into_text'

I puts some log, the line num may not correct.

Is any body can fix it ?

@bartolsthoorn
Copy link

Checked the source code because I also ran in this error just today. It only happens when Google was unable to convert the audio to text. You should check your audio input and try again with a different file. Make sure it's loud and clear and in wav format. Also try to run the sample wav files from the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants