This module adds text-to-speech function to the website. We can show a block of speech controls to read main content of the page.

WebSpeech (http://www.eguidedog.net/WebSpeech.php) is a free javascript library for web developers who want to write pages with voice. I am the author of original library. I write this module in order to make it easier for Drupler to use it.

Project home: http://drupal.org/sandbox/hgneng/1932690

Git:

 git clone --branch 7.x-1.x http://git.drupal.org/sandbox/hgneng/1932690.git webspeech

Drupal version: 7

Already self-review with Coder module and http://ventral.org/pareview/httpgitdrupalorgsandboxhgneng1932690git-7x-1x-0.

Another project I've applied before (but fail because of already has similar project in older Drupal version):
http://drupal.org/node/1470288

Thanks!

Cameron

Comments

strakkie’s picture

StatusFileSize
new9.22 KB

Hi hgneng,

First of all, have a look at your project page, try to make it usefull for people who visit it:
See: http://drupal.org/node/997024

Second, your module is still using the master branch as default. you can delete this, the 7.x-1.x branch will automatticly set as default when this is done.

.info file
You can remove the quotes around the text in your .info file.

Also, add a package line to the .info file to group your module.

.module file
Add comments to the webspeech_config and webspeech_config_submit functions. Even if a function is created by yourself it is important for other developers to be able to see what the function does.

I am also getting a lot of erros when setting Coder to strict (minor) mode. Have a look at these errors, i will attach them.

ankitchauhan’s picture

Status: Needs work » Needs review

please get a review bonus first. Then try to fix issues raised by automated review tools:
http://ventral.org/pareview/httpgitdrupalorgsandboxhgneng1932690git

ankitchauhan’s picture

Status: Needs review » Needs work
alfababy’s picture

Status: Needs review » Needs work

Hi hgneng,

Maybe you can move WebSpeech.js to "sites/all/libraries/webspeech/webspeech.js". And use Libraries API module.

hgneng’s picture

Status: Needs work » Needs review

@alfababy
used Libraries API now. Please download latest WebSpeech library from http://sourceforge.net/projects/e-guidedog/files/WebSpeech/

@ankitchauhan
tidied up code now.

@strakkie
more detail project description is added.
removed master branch.
>You can remove the quotes around the text in your .info file.
I don't think this is a must.
>Also, add a package line to the .info file to group your module.
No package yet. It will be Others if it must belong one.
commented added to functions.
Fixed coding standard issues.

hgneng’s picture

Issue summary: View changes

change git command to clone 7.x branch

ycshen’s picture

you'd better move admin config form page to admin.inc file.
the path is 'admin/config/webspeech'.

hgneng’s picture

@ycshen
Thank you for the recommendation! I've moved config form to webspeech.admin.inc

sfox2681’s picture

Category: task » bug

I have installed WebSpeech on my localhost drupal site. I installed libraries version 7.x-2.1. Then I used your GIT CLONE command to install WebSpeech. I also download the WebSpeech library files to site/all/libraries/WebSpeech

When I go to Help > WebSpeech and select the WebSpeech demo, I get the following error messages:

Warning: Invalid argument supplied for foreach() in libraries_invoke() (line 161 of /vagrant/public/drupal7/sites/all/modules/libraries/libraries.module).
Notice: Undefined index: installed in libraries_load() (line 621 of /vagrant/public/drupal7/sites/all/modules/libraries/libraries.module).

I am working with other Drupal programmers in this review and we suspect that something in the WebSpeech module is not properly passing information to libraries_invoke() function.

hgneng’s picture

Category: bug » task

Thanks for the bug report!

I only tested on libraries 1.x before and I found that it doesn't work on libraries 2.x. I've fixed it now.

kappaluppa’s picture

Category: task » bug
Status: Needs review » Needs work

Hi,
I'm on the team working with @sfox2681 reviewing your module.

I tried adding hook_libraries_info and the error went away, but it still does not play for me. This is what I added:

    function webspeech_libraries_info() {
      $libraries['WebSpeech'] = array(
        'version arguments' => array(
          'file' => 'WebSpeech.js',
          'pattern' => '@version ([0-9\.a-z]+)@',
          'lines' => 19,
        ),
      );

      return $libraries;
    }

I noticed you have a jquery function in drupal_get_js. It would probably be best to create a separate js file for that and call the file, rather than call the function like that.

I also had trouble getting the WebSpeech.js to be read, and I was getting page not found for the swf file.

I have updated my module to your latest version. I don't get any warnings or notices, but it also does not work. I have enabled it on this site: http://drupalistasgroup.com/project-reviews-web-speech (blog post for my group of issues I ran into). When I push "Read content" I get "Pause", but no sound.

There are a couple of UX suggestions I'd like to make. in the admin menu, I think the appropriate place for the link to the configuration page would be under Configuration -> Web Services, rather than stand alone.

The block name could probably be shorter.

Documentation needs to have more explanation. (We can help you with that if you want.)

Thanks for this module. I'm looking forward to using it.
K

sfox2681’s picture

I did a git pull to retrieve your changes to WebSpeech. The webspeech/demo/simple no longer has any errors, but does not work. I turned Firebug on and found that the WebSpeech.js library is not listed on the page and see a console error that the WebSpeech.setVoice('en') is getting a reference error (not defined).

I looked at webspeech_demo_simple.inc and it invokes webspeech_initialize() in statement 14.

I looked in the webspeech.module, where that function is located, and it is set up to return TRUE or FALSE, if it properly loads the WebSpeech.js library via libraries_load, and later a jQuery.

Since the webspeech_initialize function returns a value of TRUE or FALSE, the webspeech_demo_simple.inc (and other files that you have that invoke the webspeech_initialize function) should check the return code and post an error message).

I have installed the webspeech files at: sites/all/libraries/WebSpeech. Is there where you are expecting the files to be installed? I have installed other library files under sites/all/libraries.

I had gone to the eGuideDog free software site and downloaded: http://sourceforge.net/projects/e-guidedog/files/WebSpeech/WebSpeech-4.0...

Regards,

Sue

sfox2681’s picture

Also see:

http://drupal.org/node/1342238

as this explains why you need a hook_libraries_info() for your WebSpeech.js

Sue

hgneng’s picture

@kappaluppa
>There is a demo page that is set up with the module, and it does not work either.
I think you are referring to this page: http://wa.eguidedog.net/hgneng/. Yes, there is a bug. I shouldn't cache the code of the block for anonymous access because I have some PHP within the block hook. I've fixed now.

>http://drupalistasgroup.com/project-reviews-web-speech
I've taken a look at it. soundmanager2 seems not loaded correctly. Could you please have a check whether following file exists?
sites/all/libraries/WebSpeech/soundmanager2/soundmanager2_flash9.swf

I will address your other comments soon. Thanks!

hgneng’s picture

@kappaluppa
I've put configuration under Web Services (admin/config/services/webspeech). But I keep package in other because WebSpeech has no relation to services package.
I've shorten the block name. Good suggestion. Thanks!

hgneng’s picture

@kappaluppa
I've implemented the libraries API 2.x. Thanks for the webspeech_libraries_info! Besides the code you provided, I also need to add files options. Or no files are loaded which make WebSpeech library fail to load. I also add a event to initialize the library. I hope we can load WebSpeech library correctly now.

>Documentation needs to have more explanation. (We can help you with that if you want.)
Please let me know what explanation you are expecting. Sure, your help will be appreciate!

@sfox2681
I've add some code to check whether WebSpeech is successfully inited.

sfox2681’s picture

I installed a Drupal Site under DrupalPro so that I can do better debugging. I see that you changed the webspeech_libraries_info() and added the files section that points to WebSpeech.js.

I added the control block to my main content, and could see the html script file pointing to the WebSpeech.js file. I get a different error now. In the error log: Page not found: http://testspeech.dev/node/sites/all/libraries/WebSpeech/soundmanager2/s...

message: node/sites/all/libraries/WebSpeech/soundmanager2/soundmanager2_flash9.swf

Looks like the word 'node' is inserted in front of the location of the swf file.

I don't know if it is related, but now I cannot get to the webspeech/demo/simple from the help screen.

hgneng’s picture

@sfox2681
Sorry. It's a path issue. I used a relative path and didn't turn on clean path on my env. Fixed now. Thanks!

sfox2681’s picture

There is progress. When I click on 'read content' on the front page, it speaks the content's text in English except that when it gets to the date and time in 'Submitted by admin on Wed, 03/13/2013 - 19:38' it switches to a woman's voice and sounds like chinese.

I when to the node/1 (entire article) and got the same page not found (node error)
node/sites/all/libraries/WebSpeech/soundmanager2/soundmanager2_flash9.swf

In this new sandbox Drupal that I am using, I only had 'help' enabled. When I downloaded and enabled 'advanced help', the admin menu came up.

It looks like the simple demo is not working. There is nothing in the Drupal log and I am not seeing anything obvious using Firebug. The 'voices' demo is getting page not found (node problem)

webspeech/sites/all/libraries/WebSpeech/soundmanager2/soundmanager2_flash9.swf

I will update the others on our progress.

Sue

hgneng’s picture

@sfox2681
Yes. Currently, it will read number in Chinese because the default voice is Chinese+English. I will add an option to configuration page to set default voice.

>I when to the node/1 (entire article) and got the same page not found (node error)
Could it be a cache issue? Have you tried to flush cache?

Thanks a lot for your time!

hgneng’s picture

@sfox2681
>I only had 'help' enabled. When I downloaded and enabled 'advanced help', the admin menu came up.
What do you mean? Do you mean something is missing without 'advanced help'?

sfox2681’s picture

I tried clearing the cache and still had the page not found for the node/1 article. I did some debugging using Drupal for Firebug and could see that the libraries_get_path function is returning the correct value. I am not familiar with jQuery. I stepped thru the jQuery Javascript execution and the error comes out after that executes.

The PHP code generated the above code and it has the correct path in it.

Sue

hgneng’s picture

@sfox2681
Voice setting is added. The default voice is set to eSpeak English.

@kappaluppa
>I noticed you have a jquery function in drupal_get_js. It would probably be best to create a separate js file for that and call the file, rather than call the function like that.
I forgot to reply your comment. The content of the js is dynamic depending on some setting. I can't put it in a static js file.

sfox2681’s picture

I don't know what I did wrong in my git pull, but I did see any changes for voice settings.
I am doing git pull http://git.drupal.org/sandbox/hgneng/1932690.git

Let me know if I should be doing a different command to retrieve your changes.

I tried a different way to set the url in the drupal_add_js("jQuery...... (see below) and still had the node appended to the front of the path. So I tried putting a / in front of the libraries_get_path and now the node/1 page will speak and also the demo pages.

function webspeech_add_init_script() {

// drupal_add_js("jQuery(function() { soundManager.setup ({ url: '" .
// libraries_get_path('WebSpeech') . "/soundmanager2'});
// WebSpeech.server = '" . variable_get('webspeech_server_url',
// 'http://wa.eguidedog.net/cgi-bin/ekho.pl') . "'
// });", 'inline');

drupal_add_js('jQuery(function() { soundManager.url = "/' . // added a slash here
libraries_get_path('WebSpeech') . '/soundmanager2";
WebSpeech.server = "' . variable_get('webspeech_server_url',
'http://wa.eguidedog.net/cgi-bin/ekho.pl') . '"
});', 'inline');
}

Did you make any change so that the demo items and configuration items show up if you only have help installed and not have advanced help installed?

I noticed another thing, the navigation bar has a blank item in the list, just above 'Add content'. This drupal installation only has module_filter, libraries and WebSpeech.

Sue

hgneng’s picture

StatusFileSize
new5.37 KB

@sfox2681
The git command should be right if you are in 7.x-1.x branch.

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/hgneng/1932690.git webspeech

The voice setting appears in configuration page:
admin/config/services/webspeech

From the code your pasted, it's not the latest because I've already appended $base_path to library path with following statement:

libraries_get_path('WebSpeech', TRUE)

I've attached the latest code for reference.

I didn't write special code relating to help/advanced help.

sfox2681’s picture

Got your changes now. Somehow I have the GIT messed up and will have to figure out how to remove it and reinstall your changes properly. Works fine.

Sue

sfox2681’s picture

After I got GIT deleted and redone properly, your code is working properly without advanced help installed. Perhaps the group can assist with your documentation on how to install and use WebSpeech.

Regards,

Sue

sfox2681’s picture

Hello,

In function webspeech_menu(), the $items['webspeech/demo'] assignment is missing the title and page arguments. (See sample below--I put in page arguments because it was in the $items[admin/config/service/webspeech'] array. I tested it without page arguments and it works ok)

$items['webspeech/demo'] = array(
'title' => 'WebSpeech Voices Demo',
'page callback' => 'webspeech_demo_voices',
'page arguments' => array('access webspeech'),
'access arguments' => array('access webspeech'),
'file' => 'webspeech_demo_voices.inc',
'type' => MENU_NORMAL_ITEM,
);

Without the title element of the array, a blank navigation menu item is displayed and is not functional.

Regards,

Sue

hgneng’s picture

@sfox2681
Thanks for the bug report! I've fixed the menu title issue.

A strange thing is that I don't see following in my local edition:

'page arguments' => array('access webspeech'),

I am always confused by Drupal's default tab rules. Why should I write the menu entries twice for default tab? And why are the non-default tab's tittle don't work unless I drupal_set_title again...

densolis’s picture

Cameron,
The word controler is misspelled in the WebSpeech Controller block. I did a web search and did not see that controler is the British spelling of this word. So I've fixed it and attached a patch for this.

If you use it, I would appreciate a commit credit as I'm trying to build up my commits. My git commit to attribute authorship can be found on http://drupal.org/user/2229734.

Below is a copy of the diff file:

$ git diff
diff --git a/webspeech.module b/webspeech.module
index c63542f..12486e9 100644
--- a/webspeech.module
+++ b/webspeech.module
@@ -146,7 +146,7 @@ function webspeech_add_init_script() {
  */
 function webspeech_block_info() {
   $blocks['webspeech_block'] = array(
-    'info' => t('WebSpeech Controler'),
+    'info' => t('WebSpeech Controller'),
     'cache' => DRUPAL_NO_CACHE,
   );

densolis’s picture

Category: bug » task
Status: Needs work » Needs review

The installation and implementation documentation has been completed and published. It can be found at http://drupal.org/node/1948668.

I have used these instructions to install and implement my copy of WebSpeech. Please review the documentation and let me know if there are any issues. Please post the documentation issued to the WebSpeech Issue Queue with a component of "Documentation". I will be monitoring the Issue Queue for any documentation issues.

I am currently working on the documentation for the Web Speech configuration form.

hgneng’s picture

@densolis
Correct-spelling-of-controler-1932796-29.patch applied. Thanks a lot!

sreynen’s picture

Title: WebSpeech » [D7] WebSpeech

Just adding version to title to make this a little easier to find and review.

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

We do have some javascript coding standards that could be used, see https://drupal.org/node/172169. In webspeech_uninstall(), be explicit about the variables you are uninstalling.

Neither of those are major issue though, RTBC from me.

----
Top Shelf Modules - Enterprise modules from the community for the community.

densolis’s picture

Sue,

Our group starting working on the Installation and Initial Setup two days after you posted your comment. If there is anything that needs updating or is incomplete, please reply to this comment. I will be glad to update the documentation.

Dennis

densolis’s picture

hgneng,

I have been tied up on other projects. Have you made any changes to the module that require me to update the web speech documentation?

If so, I can start in a week or so.

In the future, if you make a change that requires a change in the documentation, please let me know.

I still have the documentation for creating a web speech server that I need to look at. Have not forgotten about that.

Dennis

hgneng’s picture

I've just update webspeech_uninstall() to delete variables explictly. And fix some JS coding style according to the standard.

I have not made any big changes to the module. No documents need to be updated. Thanks to densolis!

kscheirer’s picture

Status: Reviewed & tested by the community » Fixed

You should run $block['content'] through a theme function to let users easily modify the appearance of that block if they wish. It's been RTBC for over a month now.

Thanks for your contribution, hgneng!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

----
Top Shelf Modules - Crafted, Curated, Contributed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

remove description that no longer applys