#speech-synthesis #ssml #document #language #speak #world

no-std ssml

Utilities for working with Speech Synthesis Markup Language documents

7 releases

0.2.0 Dec 16, 2024
0.1.0 Nov 23, 2023
0.0.5 Oct 29, 2023

#245 in Audio

Download history 10/week @ 2024-12-21 2/week @ 2025-01-04 2/week @ 2025-01-11 13/week @ 2025-02-15 9/week @ 2025-02-22 52/week @ 2025-03-01 11/week @ 2025-03-08 178/week @ 2025-03-15 60/week @ 2025-03-22 31/week @ 2025-03-29 44/week @ 2025-04-05

313 downloads per month
Used in 3 crates

Apache-2.0

99KB
2.5K SLoC

Utilities for writing SSML documents.

The root document in SSML is Speak. Use [speak()] to quickly create a document.

let doc = ssml::speak(Some("en-US"), ["Hello, world!"]);

Use Serialize to convert SSML elements to their string XML representation, which can then be sent to your speech synthesis service of chocie.

use ssml::Serialize;
let str = doc.serialize_to_string(&ssml::SerializeOptions::default().pretty())?;
assert_eq!(
	str,
	r#"<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
	Hello, world!
</speak>"#
);

ssml-rs

A Rust library for writing SSML.

Currently, ssml-rs focuses on supporting the subsets of SSML supported by major cloud text-to-speech services (Microsoft Azure Cognitive Speech Services, Google Cloud Text-to-Speech, & Amazon Polly) & pyke Songbird.

let doc = ssml::speak(Some("en-US"), ["Hello, world!"]);

use ssml::Serialize;
let str = doc.serialize_to_string(&ssml::SerializeOptions::default().flavor(Flavor::AmazonPolly))?;
assert_eq!(
	str,
	r#"<speak xml:lang="en-US">Hello, world!</speak>"#
);

Dependencies

~150KB