Attribute data-vfact-read. async-api3

Description

"data-vfact-read" attribute allows to set custom text/external sound for a part of the text.
Content of the attribute is set in following form: "#FORMAT: DATA". Supported formats:
  • "T": DATA contains a custom text, see #285
  • "S": DATA contains an url to external sound, see #347
  • "V": DATA contains pitch and/or speed and/or voice_id, see #348
Example of custom text: <div data-vfact-read="Text1">Text2</div> <div data-vfact-read="#T: Text1">Text2</div> In both cases, Text1 is played instead Text2.
Variant "Text1" is deprecated, customers should specify format directly: "#T: Text1"

Example of using external sound file: <div data-vfact-read="#S: http://some.external.mp3">Text2</div> File "http://some.external.mp3" will be played, Text2 won't be played.
If external file doesn't exist, it will be just skipped and next part of the text will be played
Example of setting custom value of pitch/speed/voice: <div data-vfact-read="#V: pitch=1 speed=2 voice=da-kids">Text3</div> <div data-vfact-read="#V: p=1 s=2 v=da-kids">Text3</div> <div data-vfact-read="#V: p=1 s=2 v=14">Text3</div>

#348: Set custom pitch/speed/voice values for selected HTML-nodes

Pitch

Pitch 1 aaa
Pitch 1
Pitch 2
Pitch 3
P=1
P=2
P=3

Speed

Speed 10 aaa
Speed 10
Speed 5 aaa
Speed 5
Speed 0
Speed -5
Speed -10
Speed -10 s
Speed -5 s
Speed 0 s
Speed 5 s
Speed 10 s

Pitch, speed, voice (with ids)

Voice 18 en
Voice 18 en, speed -10
Voice 18 en, speed -5, pitch 1
Voice 18 en, speed -5, pitch 3
Voice 31 en
Voice 31 en, speed 5
Voice 31 en, speed 5, pitch 3
Voice 31 en, speed 5, pitch 1
Voice 31 en, speed 5, pitch 2
Voice 18 en, speed 5, pitch 2

Pitch, speed, voice (with voice tags)

Dette er et eksempel på tekst - Mette, dansk
This is example of voice Lucy, English en, speed 0
Voice Lucy, English, speed 5, pitch 1
Voice Lucy, English, speed -2, pitch 3
Dette er et eksempel på tekst - Rasmus, dansk
Rasmus, dansk, fart 5
This is example of voice Lucy, English en, speed 0
Voice Lucy, speed 5, pitch 3
Voice Lucy, speed 5, pitch 1
Voice Lucy, speed 5, pitch 2
Some incorrect voice tag, speed 5, pitch 2

#347: Set external sound for a part of the text using data-vfact-read attribute

Format #T

Format #T is used:
This is a sample text.
You should hear "Custom text", not "#T: Custom text". There is one more sentence here.

Format #T is used, custom text has two sentences:
This is a sample text.
You should hear "This is a first long sentences. This is the next long sentence". There is one more sentence here.

Format #T is used - text-to read is longer then visible text.
Short.
You should hear "This is long data vfact read text". There is one more sentence here.

Format #T: #T: is used:
This is a sample text.
You should hear "#T: Custom text", not "#T: #T: Custom text". There is one more sentence here.

Format #S

Format "#S: XXX" is used:
You shouldn't hear URL. You should hear content of "vfact-short-example.mp3"
You should hear vfact-short-example.mp3. There is one more sentence here.

Format "#S:xxx" is used:
You shouldn't hear URL. You should hear content of "vfact-short-example.mp3"
You should hear vfact-short-example.mp3. There is one more sentence here.

Format "#S:xxx" is used, three same blocks one by one - single sentence:
1 You shouldn't hear URL. You should hear content of "vfact-short-example.mp3"
2 You shouldn't hear URL. You should hear content of "vfact-short-example.mp3"
3 You shouldn't hear URL. You should hear content of "vfact-short-example.mp3"
In total you should hear vfact-short-example.mp3 three times. There is one more sentence here.

Format "#S:xxx" is used, three same blocks one by one, hidden texts contain embedded blocks:

I You shouldn't hear URL. B You should hear content of "vfact-short-example.mp3"

3 You shouldn't hear URL. You should hear content of "vfact-short-example.mp3"
Original text contains a lot of tags: several short words, some of them are bold/word 1 bold word 2 + several short words/word 1 word 2
In total you should hear vfact-short-example.mp3 three times. There is one more sentence here.

Node with external sound has very complex content (with many nodes)

Next block is complex: two divs are wrapped by a div with data-vfact-read:
DIV You shouldn't hear URL.
DIV You should hear content of "vfact-short-example.mp3"

Next block has text nodes, nodes with children and comments

Text out of the div.
DIV You shouldn't hear URL.
subdiv: this is a first sentence of the complex text.
subdiv2: this is a second sentence of the complex text.
Text out of the div.
DIV You should hear content of "vfact-short-example.mp3". This is last sentences of the complex text.
DIV There is one more sentence here.

Multi-language: visible text has sentences on different languages

это текст на русском языке, достаточно длинный I de fleste tilfælde kan vi ændre og forbedre på udtalen af ordene i talesyntesen. > You should hear: "This is first sentence. This is second sentence."

Broken external sound

Format "#S:missed sound" is used:
You should not hear this text and shouldn't hear URL. The app should try to play sound file.. but the file doesn't exist.

Missed sound should be skipped, but next part should be played correctly. If we have three parts: P1, P2, P3 and P2 has missed sound, users should hear P1, P3.

External audio has spaces in the name of folder and file

You should not hear this text and shouldn't hear URL.

#258: Set custom text using data-vfact-read attribute

Short and long sentences

Custom text is shorter then original:
This is a sample text.
You should hear "Custom text".

Custom text is longer then original:
Short sample.
You should hear "Long custom text".

Original text consists from several long sentences:
This is first long enough sentence. This is second sentence and it contains many words too.
You should hear "Custom text to replace two sentences".

Original text consists from several long sentences on different languages:
This is first English sentence. А это второе предложение на русском языке.
You should hear "Custom text to replace two sentences".

Custom text consists from several long sentences on different languages:
Text to replace.
You should hear "Custom text 1. Пользовательский текст 2".

Sub-nodes

Original text contains sub-tags:
1/2
You should hear "a half".

Original text contains sub-tags:
10/100
You should hear "one tenth".

Abbreviations

Original and custom texts contain known abbreviation "omg":
Omg omg omg
You should hear "text omg read".

Original and custom texts contain known abbreviation "forberedelsemateriellet":
forberedelsemateriellet forberedelsemateriellet forberedelsemateriellet
You should hear "text omg read".

Original and custom texts contain date "31.07.2020":
a 31.07.2020 b
You should hear "text date read".

Complex content

Original text contains a lot of tags:
several short words, some of them are bold/word 1 bold word 2 + several short words/word 1 word 2
You should hear "This is first sentence. This is second sentence.".

Incorrect - data-vfact-read contains another data-vfact-read:
several short words, some of them are bold/word 1 bold word 2 + several short words/word 1 word 2
It's hard to say what you should hear..

#360: Background sound

Background sound 1

Background sound 1 is played here.
There is no background sound here.

Lont text. Background sound 1 is played here. This is long text, background sound is comparatively small. But background sound should be looped, so you should hear it during playing all parts of the text. While the invention has been shown or described in only some of its forms, it should be apparent to those skilled in the art that it is not so limited, but is susceptible to various changes without departing from the scope of the invention. For example, steps can be performed in a different order to reach the same desired goal and heating can be affected in a variety of ways. Similarly, the process can be practiced as a batch or continuous-batch process without departing from the scope of the invention.

Background sound 2

Background sound 1 is played here.
Background sound 2 is played here.
Background sound 1 is played here.
There are no background sounds here.

Long text. Background sound 2 is played here. This is long text, background sound is comparatively small. But background sound should be looped, so you should hear it during playing all parts of the text. While the invention has been shown or described in only some of its forms, it should be apparent to those skilled in the art that it is not so limited, but is susceptible to various changes without departing from the scope of the invention. For example, steps can be performed in a different order to reach the same desired goal and heating can be affected in a variety of ways. Similarly, the process can be practiced as a batch or continuous-batch process without departing from the scope of the invention.
Background sound 2 is played here. This text consists from several parts. Background sound is started to play for first part. It is stopped to play after finish of the last part. Background sound shouldn't start to be played from the beginning on each text part.

Background sound and other data-vfact-commands

Pitch 1 + background sound is played here.
There are no background sounds here.

pitch 1
Pitch 1 + background sound is played here.
There are no background sounds or changes in the pitch here.

External sound + background sound.
There are no background sounds here.

background sound 1
external sound is played here
background sound 1
There are no background sounds here.

AAA + background sound is played here.
There are no background sounds here.

background sound 1
AAA + background sound (replaced by custom text)
There are no background sounds here.

Nested background sounds

Level 1. background sound 1.
Level 2. background sound 2.
Level 3. background sound 1.
AAA (replaced by "custom text", background 1 is still being played)
Level 3. background sound 1.
Pitch 1, background 1 is still being played.
Pitch 2, background 1 is still being played.
Pitch 3, background 1 is still being played.
Level 3. background sound 1.
Level 2. background sound 2.
Level 1. background sound 1.

Background sound - bad paths

Broken url

Not exist background sound is assigned here.

Data-vfact-read with background sound is included to another data-vfact-read with external sound:

External sound.
external sound + node with background sound
External sound.

Two background sounds in the same data-vfact-read

This is a sample sentence.

Real problems

Text only: Text,Voice-s: Text,Voice-speed: Voice-speed,text: