Skip to content

Commit

Permalink
Merge pull request #39 from FunThomas424242/#16/sprachzerlegung
Browse files Browse the repository at this point in the history
close #16/sprachzerlegung
  • Loading branch information
Huluvu424242 committed Jun 30, 2020
2 parents 817194e + 3bb2a44 commit cee36a1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ To the [live demo](https://funthomas424242.github.io/honey-slideshow/index.html)

## releaselog

### v0.0.4

* [issue#16](https://github.com/FunThomas424242/honey-slideshow/issues/16) split of audio texts into 20 char pices is removed.
* [issue#27](https://github.com/FunThomas424242/honey-slideshow/issues/27) load error of audio file response will be handled

### v0.0.3 at 2020-06-27

* build with nodejs 14.1.0
Expand Down
2 changes: 1 addition & 1 deletion src/components/honey-slideshow/custom-elements.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"timestamp": "2020-06-27T12:49:50",
"timestamp": "2020-06-28T16:29:37",
"compiler": {
"name": "@stencil/core",
"version": "1.14.0",
Expand Down
32 changes: 18 additions & 14 deletions src/shared/sprachausgabe/sprachausgabe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ export class Sprachausgabe {
Logger.infoMessage("####constructor finished");
}


initialisiereVorleserStimme(vorleser: SpeechSynthesisUtterance) {
Logger.infoMessage("erzeugeVorleser started");

vorleser.pitch = this.sprachauswahl.getPitch();
vorleser.rate = this.sprachauswahl.getRate();
vorleser.volume = this.sprachauswahl.getVolume();
vorleser.voice = this.sprachauswahl.getVoice();
if (vorleser.voice && vorleser.voice.lang) {
vorleser.lang = vorleser.voice.lang;
} else {
vorleser.lang = "de-DE";
}
}

erzeugeVorleser(text: string): SpeechSynthesisUtterance {
const vorleser: SpeechSynthesisUtterance = new SpeechSynthesisUtterance(text);

Expand Down Expand Up @@ -67,23 +82,12 @@ export class Sprachausgabe {
return vorleser;
}

initialisiereVorleserStimme(vorleser: SpeechSynthesisUtterance) {
Logger.infoMessage("erzeugeVorleser started");

vorleser.pitch = this.sprachauswahl.getPitch();
vorleser.rate = this.sprachauswahl.getRate();
vorleser.volume = this.sprachauswahl.getVolume();
vorleser.voice = this.sprachauswahl.getVoice();
if (vorleser.voice && vorleser.voice.lang) {
vorleser.lang = vorleser.voice.lang;
} else {
vorleser.lang = "de-DE";
}
}

textVorlesen(zuLesenderText: string) {
if (zuLesenderText) {
const texte: string[] = zuLesenderText.match(/(\S+[\s.]){1,20}/g);
// Auftrennung in Textblöcken nach Sprachen.
// const texte: string[] = zuLesenderText.match(/(\S+[\s.]){1,20}/g);
const texte: string[] = [zuLesenderText];

texte.forEach(text => {
const vorleser: SpeechSynthesisUtterance = this.erzeugeVorleser(text);
Expand Down

0 comments on commit cee36a1

Please sign in to comment.