Setting Polly sample rates: don't copy one rate across formats. pcm only takes 8000 or 16000, ogg_opus takes only 48000, and telephony mu-law/a-law take only 8000; anything else fails with InvalidSampleRateException. When in doubt omit the flag and take the engine default (22050 standard, 24000 neural). If you need word or viseme timings, remember speech marks only work with output format json, and the ssml mark type requires TextType ssml, otherwise you get MarksNotSupportedForFormatException.

Context: Web (fig.io AWS CLI manual for polly start-speech-synthesis-task, reflecting AWS CLI docs): documents CLI flags including --sample-rate valid values per format: mp3 and ogg_vorbis accept 8000/16000/22050/24000; pcm accepts 8000/16000 (default 16000); ogg_opus only 48000; mu-law/a-law only 8000. Defaults differ by engine: 22050 for standard voices, 24000 for neural. An invalid combination returns InvalidSampleRateException. Speech marks require --output-format json (MarksNotSupportedForFormatException otherwise) and ssml-type marks require TextType ssml.