Paragraph and Sentence

The <p> (paragraph) and <s> (sentence) tags in SSML are instrumental in structuring the content to aid in text-to-speech (TTS) synthesis, providing better control over how the TTS engine delivers your content audibly.

Utilizing the <p> Tag

The <p> tag divides paragraphs, creating a clear structure within your content. This organization is key in breaking up extensive text into manageable, coherent blocks, improving the listening experience. Here's an example:

<speak>
  <p>This is the first paragraph. It introduces the topic.</p>
  <p>Here's another paragraph, delving deeper into the subject.</p>
</speak>

The TTS engine will pause between paragraphs, much like a human speaker would, bringing a natural rhythm to the speech.

Utilizing the <s> Tag

The <s> tag is utilized for individual sentences within paragraphs. This is crucial when you're dealing with longer sentences that could benefit from a brief pause to improve understanding. Consider the following:

<speak>
  <p>
    <s>This sentence is an introduction to the concept.</s>
    <s>Here, we expand on the concept with more details.</s>
  </p>
</speak>

Best Practices

  • Non-Mandatory but Beneficial: While <p> and <s> tags are not required in SSML, their usage is recommended to improve the clarity and flow of speech output.

  • Strategic Use: Implement these tags thoughtfully. Overuse can lead to unnatural pauses and disrupt the flow of information.

  • Testing for Naturalness: Always preview the speech output to ensure that the placement of <p> and <s> tags produces a natural and listener-friendly experience.

Last updated