Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
npm install speak-tts
Speech synthesis (tts) for the browser with (optional) language detection. Based on browser SpeechSynthesis API, it improves it by handling some quirks and bugs of IOS/android devices and some chrome versions. Also split sentences into several speeches to make it sound more natural and provides additional callback functions. Work in Chrome, opera and Safari (including ios8 and ios9 devices). Tested successfully on Ipad and Android. See browser support here : http://caniuse.com/#feat=speech-synthesis
Here is a demo: Here
Import the component :
import Speech from 'speak-tts' // es6
// var Speech = require('speak-tts') //if you use es5
Start the component :
Speech.init()
You can pass the following properties at init time:
// Example with full conf
Speech.init({
'onVoicesLoaded': (data) => {console.log('voices', data.voices)},
'lang': 'en-GB', // specify en-GB language (no detection applied)
'volume': 0.5,
'rate': 0.8,
'pitch': 0.8
})
Check browser support :
if(Speech.browserSupport()) {
console.log("speech synthesis supported")
}
Read a text :
Speech.speak({
text: 'Hello, how are you today ?',
onError: (e) => {console.log('sorry an error occured.', e)}, // optionnal error callback
onEnd: () => {console.log('your text has successfully been spoken.')} // optionnal onEnd callback
})
Set language (note that the language must be supported by the client browser) :
Speech.setLanguage('en-GB') // set language to english
Speech.setLanguage(null) // activate language autodetection
Stop talking:
Speech.stop()
"ar-SA" // arabic
"cs-CZ" // czech
"da-DK" // danish
"de-DE" // german
"el-GR" // greek
"en-AU" // australian
"en-GB" // english
"en-IE"
"en-US"
"en-US"
"en-ZA"
"es-ES" // spanish
"es-MX"
"fi-FI" // finish
"fr-CA"
"fr-FR" // french
"he-IL" // hebrew
"hi-IN" // hindi
"hu-HU" // hungarian
"id-ID" // indonesian
"it-IT" // italian
"ja-JP" // japanese
"ko-KR" // korean
"nl-NL" // dutch
"no-NO" // norwegian
"pl-PL" // polish
"pt-BR" // portuguese brazilian
"pt-PT" // portuguese
"ro-RO" // romanian
"ru-RU" // russian
"sk-SK" // slovak
"sv-SE" // swedish
"th-TH" // thai
"tr-TR" // turkish
"zh-CN" // chinese (S)
"zh-HK" // chinese hong kong
"zh-TW" // chinese (T'en-US';
import Speech from 'speak-tts'
const _addVoicesList = (voices) => {
const list = window.document.createElement('div')
let html = '<h2>Available Voices</h2><select id="languages"><option value="">autodetect language</option>'
voices.forEach((voice) => {
html += '<option value="' + voice.lang + '"">' + voice.name + ' (' + voice.lang + ')</option>'
})
list.innerHTML = html
window.document.body.appendChild(list)
}
function _prepareSpeakButton() {
const speakButton = document.getElementById('play')
const textarea = document.getElementById('text')
const languages = document.getElementById('languages')
speakButton.addEventListener('click', () => {
Speech.setLanguage(languages.value)
Speech.speak({
text: textarea.value
})
})
}
Speech.init({
onVoicesLoaded: (data) => {
console.log("loaded voices", data.voices)
_addVoicesList(data.voices)
_prepareSpeakButton()
Speech.speak({
text: 'Hello, how are you today ?'
})
}
});
const text = (Speech.browserSupport()) ? 'Hurray, your browser supports speech synthesis' : "Your browser does NOT support speech synthesis. Try using Chrome of Safari instead !"
document.getElementById("support").innerHTML = text
These will be added soon. Please do not hesitate to add some !
I am a full-stack Javascript developer based in Lyon, France.
speak-tts is dual licensed under the MIT license and GPL. For more information click here.
FAQs
Browser TTS (using Web speech API) made easy
The npm package speak-tts receives a total of 2,391 weekly downloads. As such, speak-tts popularity was classified as popular.
We found that speak-tts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.