diff --git a/docs/source/soundswallower.js.rst b/docs/source/soundswallower.js.rst index 4d5c3a9..1fc0541 100644 --- a/docs/source/soundswallower.js.rst +++ b/docs/source/soundswallower.js.rst @@ -25,26 +25,6 @@ returns in the usual manner. If this means nothing to you, please consult https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous. -By default, a narrow-bandwidth English acoustic model is loaded and -made available. If you want to use a different one, just put it where -your web server can find it, then pass the relative URL to the -directory containing the model files using the `hmm` configuration -parameter and the URL of the dictionary using the `dict` parameter. -Here is an example, presuming that you have downloaded and unpacked -the Brazilian Portuguese model and dictionary from -https://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/Portuguese/ -and placed them under ``/model`` in your web server root: - -.. code-block:: javascript - - import createModule from "soundswallower"; - // Avoid loading the default model - const soundswallower = { defaultModel: null }; - await createModule(soundswallower); - const decoder = new soundswallower.Decoder({hmm: "/model/cmusphinx-pt-br-5.2", - dict: "/model/br-pt.dic"}); - await decoder.initialize(); - For the moment, to use SoundSwallower with Webpack, an incantation is required in your `webpack.config.js`. Sorry, I don't make the rules: diff --git a/js/README.md b/js/README.md index 475f0cc..a2e8c77 100644 --- a/js/README.md +++ b/js/README.md @@ -87,9 +87,12 @@ import createModule from "soundswallower"; // or whatever name you like const soundswallower = await createModule(); ``` -Because it needs access to the compiled WebAssembly code, all of the actual API is -contained within this object that you get back from `createModule`. Now you can -try to initialize a recognizer and recognize some speech. +Because it needs access to the compiled WebAssembly code, all of the actual API +is contained within this object that you get back from `createModule`. Now you +can try to initialize a recognizer and recognize some speech. This is +asynchronous, because it does a bunch of file loading and such, but the rest of +the API isn't, because Javascript promises are not actually coroutines and thus +will block your program even if they appear to be "asynchronous". ```js let decoder = new soundswallower.Decoder({ @@ -135,8 +138,7 @@ decoder.stop(); ``` The text result can be obtained with `get_text()` or in a more detailed format -with time alignments using `get_alignment()`. These are not asynchronous -methods, as they do not depend on or change the state of the decoder: +with time alignments using `get_alignment()`. ```js console.log(decoder.get_text());