
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@davi-ai/web-speech-cognitive-services-davi
Advanced tools
Polyfill Web Speech API with Cognitive Services Speech-to-Text service
This package is based on a fork of web-speech-cognitive-services. The primary goal is the use the SpeechSynthetizer from microsoft-cognitiveservices-speech-sdk in the TTS part of the package, in order to receive the boundaries and visemes on a speech synthesis to overcome the existing issues of the original package.
npm install @davi-ai/web-speech-cognitive-services-davi
In order to use speech synthesis, you still need to use the original process :
Use the imports from the new package with :
import { createSpeechSynthesisPonyfill } from '@davi-ai/web-speech-cognitive-services-davi/lib/SpeechServices'
import type { SpeechSynthesisUtterance } from '@davi-ai/web-speech-cognitive-services-davi/lib/SpeechServices'
You can now listen to the following events by attaching callbacks to the utterance :
{
name: string, // the word / punctuation
elapsedTime: number, // time elapsed since the beginning of the speech
duration: number, // duration of the speech for this word / punctuation
boundaryType: 'WordBoundary' | 'PunctuationBoundary' | 'Viseme' // type of the boundary. 'Viseme' was added by us for private needs
}
This event is fired for each boundary and each viseme in the synthesis {
name: string, // the name of the bookmark
elapsedTime: number // time elapsed since the beginning of the speech
}
{
name: string, // the id of the viseme
elapsedTime: number, // time elapsed since the beginning of the speech
duration: 0,
boundaryType: 'Viseme'
}
This event is fired for each viseme in the synthesis.
(Viseme id documentation here)utterance.onsynthesisstart = (): void => { 'Synthesis started !' }
utterance.onsynthesiscompleted = (): void => { 'Synthesis ended !' }
utterance.onboundary = (event): void => { console.log('Boundary data : ', event.boundaryType, event.name, event.elapsedTime, event.duration )}
Using the SpeechSynthetizer class leads to several improvements in the functionalities :
start
event is now linked to the oncanplaythrough
event of the AudioElement used by the AudioContext. This allows a better synchronisation at the beginning of the speech.mute()
and unmute()
on the ponyfill.speechSynthesis object anytimeFAQs
Polyfill Web Speech API with Cognitive Services Speech-to-Text service
We found that @davi-ai/web-speech-cognitive-services-davi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.