Coder Social home page Coder Social logo

azu / vscode-read-aloud-text Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 6.0 682 KB

VSCode extension that read aloud text like Markdown and text etc...

Home Page: https://marketplace.visualstudio.com/items?itemName=azu.read-aloud-text

License: MIT License

TypeScript 100.00%
vscode extension tts speech-to-text

vscode-read-aloud-text's Introduction

VSCode Read Aloud Text

Simple text-to-speech extension for Visual Studio Code.

Installation

Please visit VSCode Marketplace.

About

Read aloud text and highlight current text.

speech-highlight

VSCode Speech adds basic text-to-speech functionality to the VSCode editor using your operating system's built-in text-to-speech facilities.

Demo

It can either read the entire current document, or just the currently selected text.

Demo

Features

  • Read aloud text like Markdown
  • Read aloud only context text
    • In other words, skip unreasonbale Node like CodeBlock
    • This extension only support .txt, Markdown, and Re:View by using a parser
  • Highlight text that is read currently
  • commands:
    • read-aloud-text.speakDocument: speak document
    • read-aloud-text.speakHere: speak here
    • read-aloud-text.speakSelection: speak selection
    • read-aloud-text.stopSpeaking: stop speaking

Configuration

By default, VSCode Speech uses whatever voice settings you have configured for your operating system. You can change the voice used to read text by using some VSCode settings

Demo

speech.voice

Name of the voice used to read back text. If null, this defaults to the current system voice.

For a list of available voices, on a Mac either:

  1. Open System Preferences
  2. Go to Dictation & Speech
  3. Open the Text to Speech tab
  4. Browse the system voice selections

or, in a command line run:

$ say -v ?

Here's example output for Mac OS 10.11:

Agnes               en_US    # Isn't it nice to have a computer that will talk to you?
Albert              en_US    #  I have a frog in my throat. No, I mean a real frog!
Alex                en_US    # Most people recognize me by my voice.
Alice               it_IT    # Salve, mi chiamo Alice e sono una voce italiana.
Alva                sv_SE    # Hej, jag heter Alva. Jag är en svensk röst.
Amelie              fr_CA    # Bonjour, je m’appelle Amelie. Je suis une voix canadienne.
Anna                de_DE    # Hallo, ich heiße Anna und ich bin eine deutsche Stimme.
Bad News            en_US    # The light you see at the end of the tunnel is the headlamp of a fast approaching train.
Bahh                en_US    # Do not pull the wool over my eyes.
Bells               en_US    # Time flies when you are having fun.
Boing               en_US    # Spring has sprung, fall has fell, winter's here and it's colder than usual.
Bruce               en_US    # I sure like being inside this fancy computer
Bubbles             en_US    # Pull the plug! I'm drowning!
Carmit              he_IL    # שלום. קוראים לי כרמית, ואני קול בשפה העברית.
Cellos              en_US    # Doo da doo da dum dee dee doodly doo dum dum dum doo da doo da doo da doo da doo da doo da doo
Damayanti           id_ID    # Halo, nama saya Damayanti. Saya berbahasa Indonesia.
Daniel              en_GB    # Hello, my name is Daniel. I am a British-English voice.
Deranged            en_US    # I need to go on a really long vacation.
Diego               es_AR    # Hola, me llamo Diego y soy una voz española.
Ellen               nl_BE    # Hallo, mijn naam is Ellen. Ik ben een Belgische stem.
Fiona               en-scotland # Hello, my name is Fiona. I am a Scottish-English voice.
Fred                en_US    # I sure like being inside this fancy computer
Good News           en_US    # Congratulations you just won the sweepstakes and you don't have to pay income tax again.
Hysterical          en_US    # Please stop tickling me!
Ioana               ro_RO    # Bună, mă cheamă Ioana . Sunt o voce românească.
Joana               pt_PT    # Olá, chamo-me Joana e dou voz ao português falado em Portugal.
Junior              en_US    # My favorite food is pizza.
Kanya               th_TH    # สวัสดีค่ะ ดิฉันชื่อKanya
Karen               en_AU    # Hello, my name is Karen. I am an Australian-English voice.
Kathy               en_US    # Isn't it nice to have a computer that will talk to you?
Kyoko               ja_JP    # こんにちは、私の名前はKyokoです。日本語の音声をお届けします。
Laura               sk_SK    # Ahoj. Volám sa Laura . Som hlas v slovenskom jazyku.
Lekha               hi_IN    # नमस्कार, मेरा नाम लेखा है.Lekha मै हिंदी मे बोलने वाली आवाज़ हूँ.
Luciana             pt_BR    # Olá, o meu nome é Luciana e a minha voz corresponde ao português que é falado no Brasil
Maged               ar_SA    # مرحبًا اسمي Maged. أنا عربي من السعودية.
Mariska             hu_HU    # Üdvözlöm! Mariska vagyok. Én vagyok a magyar hang.
Mei-Jia             zh_TW    # 您好,我叫美佳。我說國語。
Melina              el_GR    # Γεια σας, ονομάζομαι Melina. Είμαι μια ελληνική φωνή.
Milena              ru_RU    # Здравствуйте, меня зовут Milena. Я – русский голос системы.
Moira               en_IE    # Hello, my name is Moira. I am an Irish-English voice.
Monica              es_ES    # Hola, me llamo Monica y soy una voz española.
Nora                nb_NO    # Hei, jeg heter Nora. Jeg er en norsk stemme.
Paulina             es_MX    # Hola, me llamo Paulina y soy una voz mexicana.
Pipe Organ          en_US    # We must rejoice in this morbid voice.
Princess            en_US    # When I grow up I'm going to be a scientist.
Ralph               en_US    # The sum of the squares of the legs of a right triangle is equal to the square of the hypotenuse.
Samantha            en_US    # Hello, my name is Samantha. I am an American-English voice.
Sara                da_DK    # Hej, jeg hedder Sara. Jeg er en dansk stemme.
Satu                fi_FI    # Hei, minun nimeni on Satu. Olen suomalainen ääni.
Sin-ji              zh_HK    # 您好,我叫 Sin-ji。我講廣東話。
Tessa               en_ZA    # Hello, my name is Tessa. I am a South African-English voice.
Thomas              fr_FR    # Bonjour, je m’appelle Thomas. Je suis une voix française.
Ting-Ting           zh_CN    # 您好,我叫Ting-Ting。我讲中文普通话。
Trinoids            en_US    # We cannot communicate with these carbon units.
Veena               en_IN    # Hello, my name is Veena. I am an Indian-English voice.
Vicki               en_US    # Isn't it nice to have a computer that will talk to you?
Victoria            en_US    # Isn't it nice to have a computer that will talk to you?
Whisper             en_US    # Pssssst, hey you, Yeah you, Who do ya think I'm talking to, the mouse?
Xander              nl_NL    # Hallo, mijn naam is Xander. Ik ben een Nederlandse stem.
Yelda               tr_TR    # Merhaba, benim adım Yelda. Ben Türkçe bir sesim.
Yuna                ko_KR    # 안녕하세요. 제 이름은 Yuna입니다. 저는 한국어 음성입니다.
Zarvox              en_US    # That looks like a peaceful planet.
Zosia               pl_PL    # Witaj. Mam na imię Zosia, jestem głosem kobiecym dla języka polskiego.
Zuzana              cs_CZ    # Dobrý den, jmenuji se Zuzana. Jsem český hlas.

On Windows, from a command prompt run:

powershell "Add-Type -AssemblyName System.speech;" ^
    "$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;" ^
    "$speak.GetInstalledVoices()" ^
    "| foreach  { $_.VoiceInfo.Name }"

Example output:

Microsoft David Desktop
Microsoft Zira Desktop

speech.speed

Speed multiplier for the voice. Defaults to the operating system's default rate.

1 reads at the standard rate, 2 reads back twice as fast as normal, and 0.5 reads back half as fast as normal.

Development

Install with npm

npm install

Debug

npm run compile
vscode .
# Lunch Extension on Debug Tag => Open new VSCode

Publish

Credits

vscode-read-aloud-text's People

Contributors

azu avatar mattbierner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-read-aloud-text's Issues

why not .tex?

Hello,
Why is it limited to .txt and markdown?
Why is it not possible for it to read from a .tex? it should be just as readable as a .txt

Extenstion support for source code files

Hello @azu

Many thanks for creating this extension!

As a dyslexic I have been looking for ways to have the code read aloud with word highlighting. Otherwise, I am effectively not able to read. I use chrome extension with word highlighting when browsing the web.

However, I found a couple of things that can be improved. As someone who would significantly benefit from this extension, I think that it would be immensely helpful if -

  1. The extension worked on all source code files in vscode and not only.txt, .md files. If it can work on terminal then that would be really amazing 
  2. As of now, the highlighting is not on a word level - it highlights entire phrases. The highlighting  is not delimited by spaces. If the highlighting is one word at a time - it would be very helpful. 
  3. The highlighting in not in sync with the speech. It tends to lag.

If you find my inputs useful, I am happy to share more opinions as well. I am a heavy user of text to speech functionality in general, so I may have a relevant viewpoint to bring. I also believe that the above enhancements will significantly help many other dyslexics as well.

I have just started programming, and this extension can potentially be the difference if I stick with it, or give up.

Many thanks!
Sam

Should this really run on the remote extension host?

I'm using VSCode with WSL on Windows. VSCode tells me the extension prefers to be installed on WSL instead of locally and any attempt to invoke the speak commands results in an error.

As the extension says it works on Windows, I would expect it to be run on Windows rather than WSL, especially as that should normally be where the audio output comes from.

Looking for new maintainers

This project looking for new maintainers.
If you want to help me, then please comment on it or submit Pull Request!

New unsaved files cannot be read

Attempting to run "Speak" on a document that has not yet been saved to the file system will not work. The following exception is occurs in the log:

[2021-12-04 16:13:29.101] [exthost] [error] Error: Anyone does not support ext
	at Object.parse (/Users/deftdawg/.vscode/extensions/azu.read-aloud-text-1.2.3/out/parser.js:15:23)
	at new SpeechEngine (/Users/deftdawg/.vscode/extensions/azu.read-aloud-text-1.2.3/out/SpeechEngine.js:42:30)
	at Object.start (/Users/deftdawg/.vscode/extensions/azu.read-aloud-text-1.2.3/out/extension.js:47:25)
	at speakHere (/Users/deftdawg/.vscode/extensions/azu.read-aloud-text-1.2.3/out/extension.js:112:12)
	at /Users/deftdawg/.vscode/extensions/azu.read-aloud-text-1.2.3/out/extension.js:133:9
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:103:21498
	at Object.edit (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:94:51685)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:103:21485
	at o._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:94:111751)
	at o.$executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:94:112293)
	at n._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:98:13802)
	at n._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:98:13486)
	at n._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:98:12148)
	at n._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:98:10826)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:98:8922
	at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:66:1712)
	at s.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:15990)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:113:30625
	at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:66:1712)
	at s.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:15990)
	at f._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:21260)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:18138
	at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:66:1712)
	at w.acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:13351)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:74:12699
	at Socket.m (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:113:13575)
	at Socket.emit (events.js:315:20)
	at addChunk (internal/streams/readable.js:309:12)
	at readableAddChunk (internal/streams/readable.js:284:9)
	at Socket.Readable.push (internal/streams/readable.js:223:10)
	at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) read-aloud-text.speakHere {"value":"azu.read-aloud-text","_lower":"azu.read-aloud-text"}
  • Suggest triggering "file save" when "Speak Here/Document/Selection" is chosen, if that is required for the plugin to work; if it's not then handle this exception and continue.

How to change highlight color

Issue Type: Bug

Thanks for this extension!
I would like to ask how to change the color of the highlight. Currently it is yellow, but with a dark theme the white text is invisible.

Extension version: 1.2.3
VS Code version: Code 1.50.1 (d2e414d9e4239a252d1ab117bd7067f125afd80a, 2020-10-13T15:06:15.712Z)
OS version: Windows_NT x64 10.0.19042

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.74GB (16.56GB free)
Process Argv --file-uri file:///d%3A/Montessori/Libro%20-%20Tecnologia%20in%20famiglia/Tecnologia%20in%20famiglia.code-workspace
Screen Reader no
VM 0%

Does not work from command palette

export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerTextEditorCommand('read-aloud-text.speakDocument', (editor) => {
console.log("read-aloud-text.speakDocument");
speech.stop();
if (!editor)
return;
speakDocument(editor);
}));
context.subscriptions.push(vscode.commands.registerTextEditorCommand('read-aloud-text.speakSelection', (editor) => {
console.log("read-aloud-text.speakSelection");
speech.stop();
if (!editor)
return;
speakCurrentSelection(editor);
}));
context.subscriptions.push(vscode.commands.registerCommand('read-aloud-text.stopSpeaking', () => {
speech.stop();
}));

I dont know why that is not working.
Instead of it, use context menu and it does work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.