
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
ssml-split
Advanced tools
Splits long texts with SSML tags by batches suitable for working with AWS Polly TTS and Google Cloud Text to Speech.
Splits SSML strings into batches AWS Polly ánd Google's Text to Speech API can consume.
Based on polly-ssml-split by @oleglegun
Added includeSSMLTagsInCounter: boolean
option to count characters based on the complete SSML tag and not just the included text characters.
For example:
<speak><p>some text</p></speak>
The default behaviour would count that as 9 characters, which is fine for AWS Polly, but not for Google's Text to Speech API.
With includeSSMLTagsInCounter: true
it will be count as 31 characters, just like Google's Text to Speech API counts it.
const ssmlSplit = require('ssml-split')
const options = {
softLimit: 4000, // Allow the splitter to find the correct split moment between 4000-5000 characters
hardLimit: 5000, // Google Text to Speech limitation
includeSSMLTagsInCounter: true // Set true when using Google Text to Speech API, set to false with AWS Polly
}
ssmlSplit.configure(options)
const batches = ssmlSplit.split('<speak>your long text here</speak>')
For other documentation, please check the original repo: https://github.com/oleglegun/polly-ssml-split
AWS Polly just counts the characters between the SSML tags. Google's Text to Speech is a little bit different, it includes the SSML tag characters in the character count of the 5000
character limit.
The polly-ssml-split
library already handles splitting of SSML correctly for AWS Polly, but wasn't working properly for Google's Text to Speech.
By adding the option includeSSMLTags
to include the SSML tag characters in the calculation on when to split the SSML, makes the library also work with Google's Text to Speech API.
This package should prevent you from seeing this error when using Google's Text to Speech API:
INVALID_ARGUMENT: 5000 characters limit exceeded.
https://cloud.google.com/text-to-speech/pricing?hl=en
Note that Speech Synthesis Markup Language (SSML) tags are included in the character count for billing purposes. For example, this input counts as 79 characters, including the SSML tags, newlines, and spaces:
<speak> <say-as interpret-as="cardinal">12345</say-as> and one more </speak>
FAQs
Splits long texts with SSML tags by batches suitable for working with AWS Polly TTS and Google Cloud Text to Speech.
The npm package ssml-split receives a total of 50 weekly downloads. As such, ssml-split popularity was classified as not popular.
We found that ssml-split 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.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.