Search code examples
visual-studio-codevscode-extensions

Can I use the speech-to-text API in my own extension in VS Code?


I've installed the VS Code Speech extension and love it, but I have some problems with its output.

I suffer from stammering, which means that I often have lengthy pauses in the middle of my sentences. VS Code Speech treats these pauses as the ends of sentences, so the output requires lots of post-editing.

I know how to write VS Code extensions. Is there a way I can access the speech-to-text API? For example, in my extension, instead of having periods and commas automatically inserted into the output, I would like to be able to explicitly dictate their positions using spoken words.


Solution

  • I don't think so? / ... technically? The VS Code Speech extension uses the Azure Speech Services SDK through the @vscode/node-speech NPM package. As far as I know, at the time of this writing, VS Code's extension API does not expose anything to do with speech.

    So... you could

    • write your own extension / fork the extension (honour the license) and make your changes in your fork
    • write your own extension using a different speech tool (see also https://github.com/microsoft/vscode/issues/101621)
    • raise an issue ticket in the extension's issue tracker describing your use-case and problem, and ask if the maintainers can do something about it