🔥 $100K Hit! Where Will Bitcoin Go Next? Find Out Live!

Code has been added to clipboard!

A Brief Guide on CSS Speak and Other Speech Model Properties

Reading time 3 min
Published Aug 8, 2017
Updated Oct 2, 2019

TL;DR — CSS offers you properties for combining speech synthesis and prerecorded messages to allow users to listen to your content.

The speech module

The CSS speech module is for helping blind, visually-impaired, or people who cannot read written content. There are cases when people prefer hearing information rather than reading it as well.

Note: the aural style sheets have been deprecated. The speech module replaced them.

The CSS sound properties can make your website presentable in the aural dimension. The aural module works with speech synthesis and auditory icons. CSS aural properties let you control the pitch and rate of the speech, voices, the sound levels.

Note: in the future, azimuth CSS values might be supported, but not currently.

DataCamp
Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
edX
Pros
  • A wide range of learning programs
  • University-level courses
  • Easy to navigate
  • Verified certificates
  • Free learning track available
Main Features
  • University-level courses
  • Suitable for enterprises
  • Verified certificates of completion

Creating the module

In this example, the speech synthesizer will play a sound effect and read the headers in a female voice:

Example
h1, h2, h3, h4 {
    voice-stress: moderate;
    voice-family: female;
    voice-rate: normal;
    cue-before: url("rawr.au");
}

List of properties

There are many properties for managing the aural style sheets. For instance, you can set the CSS speak: never to prevent a specific element from being read. The CSS speak: none value does not exist.

Property Description Values
voice-volume Sets the vibration of the audio waveform and the volume level of audio cues silent
x-soft
soft
medium
loud
x-loud
decibel number with dB
voice-balance Sets whether the spoken voice is coming from the left or right side <number>
left
center
right
leftwards
rightwards
speak Sets whether text needs to be rendered aurally auto
never
always
speak-as Indicates how the text is read normal
spell-out
digits
literal-punctuation
no-punctuation
pause-before Sets a silence for a specific amount of time before the speech synthesis rendition or the cue <time>
none
x-weak
weak
medium
x-strong
pause-after Sets a silence for a specific amount of time after the speech synthesis rendition or the cue <time>
none
x-weak
weak
medium
x-strong
pause A shorthand property for pause-before and pause-after <time>
none
x-weak
weak
medium
x-strong
rest-before Sets a silence for a specific amount of time before the speech synthesis rendition <time>
none
x-weak
weak
medium
x-strong
rest-after Sets a silence for a specific amount of time after the speech synthesis rendition <time>
none
x-weak
weak
medium
x-strong
rest A shorthand for rest-before and rest-after <time>
none
x-weak
weak
medium
x-strong
cue-before Sets auditory icons. For instance, prerecorded messages to be played before the selected element <uri>
<decibel>
none
cue-after Sets auditory icons. For instance, prerecorded messages to be played after the selected element <uri>
<decibel>
none
cue A shorthand for cue-before and cue-after <uri>
<decibel>
none
voice-family Sets how the text should be read. Multiple values can be added in case one of them fails <name>
<generic-voice>
<age>
<gender>
<integer>
preserve
voice-rate Sets the rate for the text reading (per minute) normal
x-slow
slow
medium
fast
x-fast
<percentage>
voice-pitch Sets the baseline pitch of the speech output (based on the voice-family) <frequency>
absolute
x-low
low
medium
high
x-high
<semitones>
<percentage>
voice-range Sets the deviation from the average pitch <frequency>
x-low
low
medium
high
x-high
<semitones>
<percentage>
voice-stress Sets the strength of emphasis which is signaled by the change of pitch, loudness, etc. normal
strong
moderate
none
reduced
voice-duration Sets the time in which the selected element should be read auto
<time>